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 +28
-6
lines changed
Common/src/System/Net/Http
System.Net.Http.WinHttpHandler Expand file tree Collapse file tree 6 files changed +28
-6
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 109
109
<Compile Include =" $(CommonPath)\System\Net\Logging.cs" >
110
110
<Link >Common\System\Net\Logging.cs</Link >
111
111
</Compile >
112
+ <Compile Include =" $(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" >
113
+ <Link >Common\System\Net\Http\HttpHandlerDefaults.cs</Link >
114
+ </Compile >
112
115
</ItemGroup >
113
116
114
117
<ItemGroup Condition =" '$(TargetsWindows)' == 'true' " >
Original file line number Diff line number Diff line change @@ -55,13 +55,13 @@ internal partial class CurlHandler : HttpMessageHandler
55
55
private IWebProxy _proxy = null ;
56
56
private ICredentials _serverCredentials = null ;
57
57
private ProxyUsePolicy _proxyPolicy = ProxyUsePolicy . UseDefaultProxy ;
58
- private DecompressionMethods _automaticDecompression = DecompressionMethods . GZip | DecompressionMethods . Deflate ;
58
+ private DecompressionMethods _automaticDecompression = HttpHandlerDefaults . DefaultAutomaticDecompression ;
59
59
private SafeCurlMultiHandle _multiHandle ;
60
60
private GCHandle _multiHandlePtr = new GCHandle ( ) ;
61
61
private CookieContainer _cookieContainer = null ;
62
62
private bool _useCookie = false ;
63
- private bool _automaticRedirection = true ;
64
- private int _maxAutomaticRedirections = 50 ;
63
+ private bool _automaticRedirection = HttpHandlerDefaults . DefaultAutomaticRedirection ;
64
+ private int _maxAutomaticRedirections = HttpHandlerDefaults . DefaultMaxAutomaticRedirections ;
65
65
66
66
#endregion
67
67
You can’t perform that action at this time.
0 commit comments