protected HttpClient CreateHttpClientForRemoteServer(Configuration.Http.RemoteServer remoteServer, HttpClientHandler httpClientHandler) { HttpMessageHandler wrappedHandler = httpClientHandler; // ActiveIssue #39293: WinHttpHandler will downgrade to 1.1 if you set Transfer-Encoding: chunked. // So, skip this verification if we're not using SocketsHttpHandler. if (PlatformDetection.SupportsAlpn && IsSocketsHttpHandler(httpClientHandler)) { wrappedHandler = new VersionCheckerHttpHandler(httpClientHandler, remoteServer.HttpVersion); } var client = new HttpClient(wrappedHandler); SetDefaultRequestVersion(client, remoteServer.HttpVersion); return(client); }
protected HttpClient CreateHttpClientForRemoteServer(Configuration.Http.RemoteServer remoteServer, HttpMessageHandler httpClientHandler) { HttpMessageHandler wrappedHandler = httpClientHandler; // WinHttpHandler will downgrade to 1.1 if you set Transfer-Encoding: chunked. // So, skip this verification if we're not using SocketsHttpHandler. if (PlatformDetection.SupportsAlpn && !IsWinHttpHandler) { wrappedHandler = new VersionCheckerHttpHandler(httpClientHandler, remoteServer.HttpVersion); } return(new HttpClient(wrappedHandler) { #if !NETFRAMEWORK DefaultRequestVersion = remoteServer.HttpVersion #endif }); }