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

◆ GetServer()

Cookie System.Net.CookieParser.GetServer ( )
inlinepackage

Definition at line 47 of file CookieParser.cs.

48 {
49 Cookie cookie = _savedCookie;
50 _savedCookie = null;
51 bool flag = false;
52 bool flag2 = false;
53 bool flag3 = false;
54 do
55 {
56 bool flag4 = cookie == null || string.IsNullOrEmpty(cookie.Name);
57 System.Net.CookieToken cookieToken = _tokenizer.Next(flag4, parseResponseCookies: false);
58 if (flag4 && (cookieToken == System.Net.CookieToken.NameValuePair || cookieToken == System.Net.CookieToken.Attribute))
59 {
60 if (cookie == null)
61 {
62 cookie = new Cookie();
63 }
65 cookie.Value = _tokenizer.Value;
66 continue;
67 }
68 switch (cookieToken)
69 {
70 case System.Net.CookieToken.NameValuePair:
71 switch (_tokenizer.Token)
72 {
73 case System.Net.CookieToken.Domain:
74 if (!flag)
75 {
76 flag = true;
77 cookie.Domain = CheckQuoted(_tokenizer.Value);
78 IsQuotedDomainField.SetValue(cookie, _tokenizer.Quoted);
79 }
80 break;
81 case System.Net.CookieToken.Path:
82 if (!flag2)
83 {
84 flag2 = true;
85 cookie.Path = _tokenizer.Value;
86 }
87 break;
88 case System.Net.CookieToken.Port:
89 if (!flag3)
90 {
91 flag3 = true;
92 try
93 {
94 cookie.Port = _tokenizer.Value;
95 }
96 catch (CookieException)
97 {
98 InternalSetNameMethod(cookie, string.Empty);
99 }
100 }
101 break;
102 case System.Net.CookieToken.Version:
103 {
104 _savedCookie = new Cookie();
105 if (int.TryParse(_tokenizer.Value, out var result))
106 {
107 _savedCookie.Version = result;
108 }
109 return cookie;
110 }
111 case System.Net.CookieToken.Unknown:
112 _savedCookie = new Cookie();
114 _savedCookie.Value = _tokenizer.Value;
115 return cookie;
116 }
117 break;
118 case System.Net.CookieToken.Attribute:
119 if (_tokenizer.Token == System.Net.CookieToken.Port && !flag3)
120 {
121 flag3 = true;
122 cookie.Port = string.Empty;
123 }
124 break;
125 }
126 }
127 while (!_tokenizer.Eof && !_tokenizer.EndOfCookie);
128 return cookie;
129 }
System.Net.CookieTokenizer _tokenizer
static FieldInfo IsQuotedDomainField
static string CheckQuoted(string value)
static Func< Cookie, string, bool > InternalSetNameMethod

References System.Net.CookieParser._savedCookie, System.Net.CookieParser._tokenizer, System.Net.CookieParser.CheckQuoted(), System.Net.Cookie, System.Net.CookieParser.InternalSetNameMethod, System.Net.CookieParser.IsQuotedDomainField, and System.Net.Cookie.Name.