This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +29
-7
lines changed
Common/src/System/Net/Http
System.Net.Http.WinHttpHandler Expand file tree Collapse file tree 6 files changed +29
-7
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ namespace System . Net . Http
5
+ {
6
+ /// <summary>
7
+ /// Defines default values for http handler properties which is meant to be re-used across WinHttp & UnixHttp Handlers
8
+ /// </summary>
9
+ internal static class HttpHandlerDefaults
10
+ {
11
+ public const int DefaultMaxAutomaticRedirections = 50 ;
12
+ public const DecompressionMethods DefaultAutomaticDecompression = DecompressionMethods . GZip | DecompressionMethods . Deflate ;
13
+ public const bool DefaultAutomaticRedirection = true ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change 13
13
<CompileItem Include =" $(CommonPath)\Interop\Windows\winhttp\Interop.winhttp_types.cs" />
14
14
<CompileItem Include =" $(CommonPath)\Interop\Windows\winhttp\Interop.winhttp.cs" />
15
15
<CompileItem Include =" $(CommonPath)\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
16
+ <CompileItem Include =" $(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" />
16
17
<CompileItem Include =" $(MSBuildThisFileDirectory)\System\Net\Http\CertificateHelper.cs" />
17
18
<CompileItem Include =" $(MSBuildThisFileDirectory)\System\Net\Http\WinHttpChannelBinding.cs" />
18
19
<CompileItem Include =" $(MSBuildThisFileDirectory)\System\Net\Http\WinHttpException.cs" />
Original file line number Diff line number Diff line change @@ -107,9 +107,9 @@ public class WinHttpHandler : HttpMessageHandler
107
107
private object _lockObject = new object ( ) ;
108
108
private bool _doManualDecompressionCheck = false ;
109
109
private WinInetProxyHelper _proxyHelper = null ;
110
- private bool _automaticRedirection = true ;
111
- private int _maxAutomaticRedirections = 50 ;
112
- private DecompressionMethods _automaticDecompression = DecompressionMethods . Deflate | DecompressionMethods . GZip ;
110
+ private bool _automaticRedirection = HttpHandlerDefaults . DefaultAutomaticRedirection ;
111
+ private int _maxAutomaticRedirections = HttpHandlerDefaults . DefaultMaxAutomaticRedirections ;
112
+ private DecompressionMethods _automaticDecompression = HttpHandlerDefaults . DefaultAutomaticDecompression ;
113
113
private CookieUsePolicy _cookieUsePolicy = CookieUsePolicy . UseInternalCookieStoreOnly ;
114
114
private CookieContainer _cookieContainer = null ;
115
115
Original file line number Diff line number Diff line change 37
37
<Compile Include =" $(CommonPath)\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" >
38
38
<Link >Common\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs</Link >
39
39
</Compile >
40
+ <Compile Include =" $(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" >
41
+ <Link >Common\System\Net\Http\HttpHandlerDefaults.cs</Link >
42
+ </Compile >
40
43
<Compile Include =" ..\..\src\System\Net\Http\CertificateHelper.cs" >
41
44
<Link >ProductionCode\CertificateHelper.cs</Link >
42
45
</Compile >
Original file line number Diff line number Diff line change 182
182
</Compile >
183
183
<Compile Include =" $(CommonPath)\System\NotImplemented.cs" >
184
184
<Link >Common\System\NotImplemented.cs</Link >
185
- </Compile >
185
+ </Compile >
186
+ <Compile Include =" $(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" >
187
+ <Link >Common\System\Net\Http\HttpHandlerDefaults.cs</Link >
188
+ </Compile >
186
189
</ItemGroup >
187
190
<ItemGroup >
188
191
<None Include =" project.json" />
Original file line number Diff line number Diff line change @@ -57,15 +57,15 @@ internal partial class CurlHandler : HttpMessageHandler
57
57
private IWebProxy _proxy = null ;
58
58
private ICredentials _serverCredentials = null ;
59
59
private ProxyUsePolicy _proxyPolicy = ProxyUsePolicy . UseDefaultProxy ;
60
- private DecompressionMethods _automaticDecompression = DecompressionMethods . GZip | DecompressionMethods . Deflate ;
60
+ private DecompressionMethods _automaticDecompression = HttpHandlerDefaults . DefaultAutomaticDecompression ;
61
61
private SafeCurlMultiHandle _multiHandle ;
62
62
private GCHandle _multiHandlePtr = new GCHandle ( ) ;
63
63
private bool _preAuthenticate = false ;
64
64
private CredentialCache _credentialCache = null ;
65
65
private CookieContainer _cookieContainer = null ;
66
66
private bool _useCookie = false ;
67
- private bool _automaticRedirection = true ;
68
- private int _maxAutomaticRedirections = 50 ;
67
+ private bool _automaticRedirection = HttpHandlerDefaults . DefaultAutomaticRedirection ;
68
+ private int _maxAutomaticRedirections = HttpHandlerDefaults . DefaultMaxAutomaticRedirections ;
69
69
70
70
#endregion
71
71
You can’t perform that action at this time.
0 commit comments