@@ -47,7 +47,6 @@ internal class HttpChannelFactory<TChannel>
4747 private TransferMode _transferMode ;
4848 private ISecurityCapabilities _securityCapabilities ;
4949 private WebSocketTransportSettings _webSocketSettings ;
50- private bool _useDefaultWebProxy ;
5150 private Lazy < string > _webSocketSoapContentType ;
5251 private SHA512 _hashAlgorithm ;
5352 private bool _keepAliveEnabled ;
@@ -299,14 +298,19 @@ internal async Task<HttpClient> GetHttpClientAsync(EndpointAddress to,
299298 var clientHandler = GetHttpClientHandler ( to , clientCertificateToken ) ;
300299 clientHandler . AutomaticDecompression = DecompressionMethods . Deflate | DecompressionMethods . GZip ;
301300
302- if ( _proxy != null )
303- {
304- clientHandler . Proxy = _proxy ;
305- }
306- else if ( _proxyFactory != null )
301+ if ( clientHandler . SupportsProxy )
307302 {
308- clientHandler . Proxy = await _proxyFactory . CreateWebProxyAsync ( authenticationLevelWrapper . Value ,
309- impersonationLevelWrapper . Value , proxyTokenProvider , cancellationToken ) ;
303+ if ( _proxy != null )
304+ {
305+ clientHandler . Proxy = _proxy ;
306+ clientHandler . UseProxy = true ;
307+ }
308+ else if ( _proxyFactory != null )
309+ {
310+ clientHandler . Proxy = await _proxyFactory . CreateWebProxyAsync ( authenticationLevelWrapper . Value ,
311+ impersonationLevelWrapper . Value , proxyTokenProvider , cancellationToken ) ;
312+ clientHandler . UseProxy = true ;
313+ }
310314 }
311315
312316 clientHandler . UseCookies = _allowCookies ;
@@ -316,10 +320,6 @@ internal async Task<HttpClient> GetHttpClientAsync(EndpointAddress to,
316320 }
317321
318322 clientHandler . PreAuthenticate = true ;
319- if ( clientHandler . SupportsProxy )
320- {
321- clientHandler . UseProxy = _useDefaultWebProxy ;
322- }
323323
324324 clientHandler . UseDefaultCredentials = false ;
325325 if ( credential == CredentialCache . DefaultCredentials )
0 commit comments