Inheritance: HttpMessageHandler
コード例 #1
0
        public HttpClientHandler()
        {
            _rtFilter            = new RTHttpBaseProtocolFilter();
            _handlerToFilter     = new HttpHandlerToFilter(_rtFilter);
            _diagnosticsPipeline = new DiagnosticsHandler(_handlerToFilter);

            _clientCertificateOptions = ClientCertificateOption.Manual;

            InitRTCookieUsageBehavior();

            _useCookies      = true;                  // deal with cookies by default.
            _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            // Managed at this layer for granularity, but uses the desktop default.
            _rtFilter.AutomaticDecompression = false;
            _automaticDecompression          = DecompressionMethods.None;

            // Set initial proxy credentials based on default system proxy.
            SetProxyCredential(null);

            // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses.
            _rtFilter.AllowUI = false;

            // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default.
            // To preserve app-compat, we turn off caching (as much as possible) in the WinRT HttpClient APIs.
            // TODO (#7877): use RTHttpCacheReadBehavior.NoCache when available in the next version of WinRT HttpClient API.
            _rtFilter.CacheControl.ReadBehavior  = RTHttpCacheReadBehavior.MostRecent;
            _rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache;
        }
コード例 #2
0
        public HttpClientHandler()
        {
            _rtFilter        = new RTHttpBaseProtocolFilter();
            _handlerToFilter = new HttpHandlerToFilter(_rtFilter);
            _handlerToFilter.RequestMessageLookupKey             = RequestMessageLookupKey;
            _handlerToFilter.SavedExceptionDispatchInfoLookupKey = SavedExceptionDispatchInfoLookupKey;
            _diagnosticsPipeline = new DiagnosticsHandler(_handlerToFilter);

            _clientCertificateOptions = ClientCertificateOption.Manual;

            // Always turn off WinRT cookie processing if the WinRT API supports turning it off.
            // Use .NET CookieContainer handling only.
            if (RTCookieUsageBehaviorSupported)
            {
                _rtFilter.CookieUsageBehavior = RTHttpCookieUsageBehavior.NoCookies;
            }

            _useCookies      = true;                  // deal with cookies by default.
            _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            // Managed at this layer for granularity, but uses the desktop default.
            _rtFilter.AutomaticDecompression = false;
            _automaticDecompression          = DecompressionMethods.None;

            // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses.
            _rtFilter.AllowUI = false;

            // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default.
            // To preserve app-compat, we turn off caching in the WinRT HttpClient APIs.
            _rtFilter.CacheControl.ReadBehavior = RTNoCacheSupported ?
                                                  RTHttpCacheReadBehavior.NoCache : RTHttpCacheReadBehavior.MostRecent;
            _rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache;
        }
コード例 #3
0
        public HttpClientHandler()
        {
            _rtFilter = CreateFilter();

            _handlerToFilter = new HttpHandlerToFilter(_rtFilter, this);
            _handlerToFilter.RequestMessageLookupKey             = RequestMessageLookupKey;
            _handlerToFilter.SavedExceptionDispatchInfoLookupKey = SavedExceptionDispatchInfoLookupKey;
            _diagnosticsPipeline = new DiagnosticsHandler(_handlerToFilter);

            _clientCertificateOptions = ClientCertificateOption.Manual;

            _useCookies      = true;                  // deal with cookies by default.
            _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            _allowAutoRedirect        = true;
            _maxAutomaticRedirections = 50;

            _automaticDecompression = DecompressionMethods.None;
        }
コード例 #4
0
ファイル: HttpClientHandler.cs プロジェクト: ESgarbi/corefx
        public HttpClientHandler()
        {
            this.rtFilter = new RTHttpBaseProtocolFilter();
            this.handlerToFilter = new HttpHandlerToFilter(this.rtFilter);

            this.clientCertificateOptions = ClientCertificateOption.Manual;

            InitRTCookieUsageBehavior();

            this.useCookies = true; // deal with cookies by default.
            this.cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            // Managed at this layer for granularity, but uses the desktop default.
            this.rtFilter.AutomaticDecompression = false;
            this.automaticDecompression = DecompressionMethods.None;

            // Set initial proxy credentials based on default system proxy.
            SetProxyCredential(null);

            // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses.
            this.rtFilter.AllowUI = false;
            
            // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default.
            // To preserve app-compat, we turn off caching (as much as possible) in the WinRT HttpClient APIs.
            // TODO (#7877): use RTHttpCacheReadBehavior.NoCache when available in the next version of WinRT HttpClient API.
            this.rtFilter.CacheControl.ReadBehavior = RTHttpCacheReadBehavior.MostRecent; 
            this.rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache;
        }