Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessReceivedCookies()

static void System.Net.Http.CookieHelper.ProcessReceivedCookies ( HttpResponseMessage response,
CookieContainer cookieContainer )
inlinestatic

Definition at line 7 of file CookieHelper.cs.

8 {
9 if (!response.Headers.TryGetValues(KnownHeaders.SetCookie.Descriptor, out var values))
10 {
11 return;
12 }
13 string[] array = (string[])values;
14 Uri requestUri = response.RequestMessage.RequestUri;
15 for (int i = 0; i < array.Length; i++)
16 {
17 try
18 {
19 cookieContainer.SetCookies(requestUri, array[i]);
20 }
21 catch (CookieException)
22 {
23 if (System.Net.NetEventSource.Log.IsEnabled())
24 {
25 System.Net.NetEventSource.Error(response, $"Invalid Set-Cookie '{array[i]}' ignored.", "ProcessReceivedCookies");
26 }
27 }
28 }
29 }
static readonly KnownHeader SetCookie
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)

References System.array, System.Net.NetEventSource.Error(), System.Net.Http.HttpResponseMessage.Headers, System.Net.NetEventSource.Log, System.Net.Http.HttpResponseMessage.RequestMessage, System.Net.Http.HttpRequestMessage.RequestUri, System.Net.Http.Headers.KnownHeaders.SetCookie, System.Net.CookieContainer.SetCookies(), System.Net.Http.Headers.HttpHeaders.TryGetValues(), and System.values.

Referenced by System.Net.Http.Http2Connection.Http2Stream.ReadResponseHeadersAsync(), System.Net.Http.Http3RequestStream.SendAsync(), and System.Net.Http.HttpConnection.SendAsyncCore().