Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CookieHelper.cs
Go to the documentation of this file.
2
3namespace System.Net.Http;
4
5internal static class CookieHelper
6{
7 public static void ProcessReceivedCookies(HttpResponseMessage response, CookieContainer cookieContainer)
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 }
30}
void SetCookies(Uri uri, string cookieHeader)
static void ProcessReceivedCookies(HttpResponseMessage response, CookieContainer cookieContainer)
bool TryGetValues(string name, [NotNullWhen(true)] out IEnumerable< string >? values)
static readonly KnownHeader SetCookie
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)