public HttpClientHandler()
 {
     _underlyingHandler = new HttpHandlerType();
     if (DiagnosticsHandler.IsGloballyEnabled())
     {
         _diagnosticsHandler = new DiagnosticsHandler(_underlyingHandler);
     }
     ClientCertificateOptions = ClientCertificateOption.Manual;
 }
Exemple #2
0
        public HttpClientHandler()
        {
#if TARGET_BROWSER
            _underlyingHandler = new BrowserHttpHandler();
#else
            _underlyingHandler = new SocketsHttpHandler();
#endif
            if (DiagnosticsHandler.IsGloballyEnabled())
            {
                _diagnosticsHandler = new DiagnosticsHandler(_underlyingHandler);
            }
            ClientCertificateOptions = ClientCertificateOption.Manual;
        }
        public HttpClientHandler()
        {
            _underlyingHandler = new HttpHandlerType();

#if TARGET_BROWSER
            Handler = _underlyingHandler;
            if (DiagnosticsHandler.IsGloballyEnabled())
            {
                Handler = new DiagnosticsHandler(Handler, DistributedContextPropagator.Current);
            }
#endif

            ClientCertificateOptions = ClientCertificateOption.Manual;
        }
        protected internal override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request,
                                                                         CancellationToken cancellationToken)
        {
            if (DiagnosticsHandler.IsGloballyEnabled() && _diagnosticsHandler != null)
            {
                return(_diagnosticsHandler !.SendAsync(request, cancellationToken));
            }

            if (IsNativeHandlerEnabled)
            {
                return(_nativeHandler !.SendAsync(request, cancellationToken));
            }
            else
            {
                return(_socketHandler !.SendAsync(request, cancellationToken));
            }
        }
        public HttpClientHandler()
        {
            HttpMessageHandler handler;

            if (IsNativeHandlerEnabled)
            {
                _nativeHandler = CreateNativeHandler();
                handler        = _nativeHandler;
            }
            else
            {
                _socketHandler = new SocketsHttpHandler();
                handler        = _socketHandler;
            }

            if (DiagnosticsHandler.IsGloballyEnabled())
            {
                _diagnosticsHandler = new DiagnosticsHandler(handler, DistributedContextPropagator.Current);
            }
        }