22using Hi3Helper . Shared . Region ;
33using System ;
44using System . Collections . Generic ;
5- using System . Diagnostics ;
65using System . Net ;
76using System . Net . Http ;
87using System . Net . Security ;
@@ -15,23 +14,23 @@ public class HttpClientBuilder : HttpClientBuilder<SocketsHttpHandler>;
1514
1615 public class HttpClientBuilder< THandler > where THandler : HttpMessageHandler , new ( )
1716 {
18- private const int _maxConnectionsDefault = 32 ;
19- private const double _httpTimeoutDefault = 90 ; // in Seconds
17+ private const int MaxConnectionsDefault = 32 ;
18+ private const double HttpTimeoutDefault = 90 ; // in Seconds
2019
2120 private bool IsUseProxy { get ; set ; } = true ;
2221 private bool IsUseSystemProxy { get ; set ; } = true ;
2322 private bool IsAllowHttpRedirections { get ; set ; }
2423 private bool IsAllowHttpCookies { get ; set ; }
2524 private bool IsAllowUntrustedCert { get ; set ; }
2625
27- private int MaxConnections { get ; set ; } = _maxConnectionsDefault ;
26+ private int MaxConnections { get ; set ; } = MaxConnectionsDefault ;
2827 private DecompressionMethods DecompressionMethod { get ; set ; } = DecompressionMethods . All ;
2928 private WebProxy ? ExternalProxy { get ; set ; }
3029 private Version HttpProtocolVersion { get ; set ; } = HttpVersion . Version30 ;
3130 private string ? HttpUserAgent { get ; set ; } = GetDefaultUserAgent ( ) ;
3231 private string ? HttpAuthHeader { get ; set ; }
3332 private HttpVersionPolicy HttpProtocolVersionPolicy { get ; set ; } = HttpVersionPolicy . RequestVersionOrLower ;
34- private TimeSpan HttpTimeout { get ; set ; } = TimeSpan . FromSeconds ( _httpTimeoutDefault ) ;
33+ private TimeSpan HttpTimeout { get ; set ; } = TimeSpan . FromSeconds ( HttpTimeoutDefault ) ;
3534 private Uri ? HttpBaseUri { get ; set ; }
3635 private Dictionary < string , string ? > HttpHeaders { get ; set ; } = new ( StringComparer . OrdinalIgnoreCase ) ;
3736
@@ -80,7 +79,7 @@ public HttpClientBuilder<THandler> UseExternalProxy(Uri hostUri, string? usernam
8079 return this ;
8180 }
8281
83- public HttpClientBuilder < THandler > UseLauncherConfig ( int maxConnections = _maxConnectionsDefault )
82+ public HttpClientBuilder < THandler > UseLauncherConfig ( int maxConnections = MaxConnectionsDefault )
8483 {
8584 bool lIsUseProxy = LauncherConfig . GetAppConfigValue ( "IsUseProxy" ) . ToBool ( ) ;
8685 bool lIsAllowHttpRedirections = LauncherConfig . GetAppConfigValue ( "IsAllowHttpRedirections" ) . ToBool ( ) ;
@@ -111,7 +110,7 @@ public HttpClientBuilder<THandler> UseLauncherConfig(int maxConnections = _maxCo
111110 return this ;
112111 }
113112
114- public HttpClientBuilder < THandler > SetMaxConnection ( int maxConnections = _maxConnectionsDefault )
113+ public HttpClientBuilder < THandler > SetMaxConnection ( int maxConnections = MaxConnectionsDefault )
115114 {
116115 if ( maxConnections < 2 )
117116 maxConnections = 2 ;
@@ -159,18 +158,18 @@ public HttpClientBuilder<THandler> SetHttpVersion(Version? version = null, HttpV
159158 return this ;
160159 }
161160
162- public HttpClientBuilder < THandler > SetTimeout ( double fromSeconds = _httpTimeoutDefault )
161+ public HttpClientBuilder < THandler > SetTimeout ( double fromSeconds = HttpTimeoutDefault )
163162 {
164163 if ( double . IsNaN ( fromSeconds ) || double . IsInfinity ( fromSeconds ) )
165- fromSeconds = _httpTimeoutDefault ;
164+ fromSeconds = HttpTimeoutDefault ;
166165
167166 return SetTimeout ( TimeSpan . FromSeconds ( fromSeconds ) ) ;
168167 }
169168
170169 public HttpClientBuilder < THandler > SetTimeout ( TimeSpan ? timeout = null )
171170 {
172- timeout ??= TimeSpan . FromSeconds ( _httpTimeoutDefault ) ;
173- HttpTimeout = timeout . Value ;
171+ timeout ??= TimeSpan . FromSeconds ( HttpTimeoutDefault ) ;
172+ HttpTimeout = timeout . Value ;
174173 return this ;
175174 }
176175
0 commit comments