Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b2de381

Browse files
committed
Incorporated comments
modified: System/Net/Http/Unix/CurlHandler.cs modified: System/Net/Http/Unix/HttpClientHandler.Unix.cs
1 parent f79c1cd commit b2de381

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.cs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,7 @@
2323
using size_t = System.IntPtr;
2424

2525
namespace System.Net.Http
26-
{
27-
#region Enums
28-
internal enum CookieUsePolicy
29-
{
30-
IgnoreCookies = 0,
31-
UseSpecifiedCookieContainer = 1
32-
}
33-
34-
#endregion
35-
26+
{
3627
internal partial class CurlHandler : HttpMessageHandler
3728
{
3829
#region Constants
@@ -60,7 +51,7 @@ internal partial class CurlHandler : HttpMessageHandler
6051
private SafeCurlMultiHandle _multiHandle;
6152
private GCHandle _multiHandlePtr = new GCHandle();
6253
private CookieContainer _cookieContainer = null;
63-
private CookieUsePolicy _cookieUsePolicy = CookieUsePolicy.IgnoreCookies;
54+
private bool _useCookie = false;
6455

6556
#endregion
6657

@@ -189,23 +180,17 @@ internal DecompressionMethods AutomaticDecompression
189180
}
190181
}
191182

192-
internal CookieUsePolicy CookieUsePolicy
183+
internal bool UseCookie
193184
{
194185
get
195186
{
196-
return _cookieUsePolicy;
187+
return _useCookie;
197188
}
198189

199190
set
200-
{
201-
if (value != CookieUsePolicy.IgnoreCookies
202-
&& value != CookieUsePolicy.UseSpecifiedCookieContainer)
203-
{
204-
throw new ArgumentOutOfRangeException("value");
205-
}
206-
191+
{
207192
CheckDisposedOrStarted();
208-
_cookieUsePolicy = value;
193+
_useCookie = value;
209194
}
210195
}
211196

@@ -490,7 +475,7 @@ private void SetProxyOptions(SafeCurlHandle requestHandle, Uri requestUri)
490475

491476
private void SetCookieOption(SafeCurlHandle requestHandle, Uri requestUri)
492477
{
493-
if (_cookieUsePolicy != CookieUsePolicy.UseSpecifiedCookieContainer)
478+
if (!_useCookie)
494479
{
495480
return;
496481
}

src/System.Net.Http/src/System/Net/Http/Unix/HttpClientHandler.Unix.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ public virtual bool SupportsRedirectConfiguration
2727

2828
public bool UseCookies
2929
{
30-
get { return (_curlHandler.CookieUsePolicy == CookieUsePolicy.UseSpecifiedCookieContainer); }
31-
set { _curlHandler.CookieUsePolicy = value ? CookieUsePolicy.UseSpecifiedCookieContainer : CookieUsePolicy.IgnoreCookies; }
30+
get
31+
{
32+
return _curlHandler.UseCookie;
33+
}
34+
35+
set
36+
{
37+
_curlHandler.UseCookie = value;
38+
}
3239
}
3340

3441
public CookieContainer CookieContainer

0 commit comments

Comments
 (0)