Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HeaderInfoTable.cs
Go to the documentation of this file.
3
4namespace System.Net;
5
6internal sealed class HeaderInfoTable
7{
8 private static readonly Func<string, string[]> s_singleParser = (string value) => new string[1] { value };
9
11
13
15
17
18 internal HeaderInfo this[string name]
19 {
20 get
21 {
23 if (headerInfo == null)
24 {
26 }
27 return headerInfo;
28 }
29 }
30
31 private static string[] ParseValueHelper(string value, bool isSetCookie)
32 {
33 if (isSetCookie && !value.Contains('='))
34 {
35 return Array.Empty<string>();
36 }
38 bool flag = false;
39 int num = 0;
40 int num2 = 0;
41 for (int i = 0; i < value.Length; i++)
42 {
43 if (value[i] == '"')
44 {
45 flag = !flag;
46 }
47 else if (value[i] == ',' && !flag)
48 {
49 string text = value.SubstringTrim(num, num2);
51 {
52 list.Add(text);
53 num = i + 1;
54 num2 = 0;
55 continue;
56 }
57 }
58 num2++;
59 }
61 {
62 list.Add(value.SubstringTrim(num, num2));
63 }
64 return list.ToArray();
65 }
66
67 private static bool IsDuringExpiresAttributeParsing(string singleValue)
68 {
69 if (!singleValue.Contains(';'))
70 {
71 return false;
72 }
73 string text = singleValue.Split(';')[^1];
74 bool flag = !text.Contains(',');
75 string a = text.Split('=')[0].Trim();
76 bool flag2 = string.Equals(a, "Expires", StringComparison.OrdinalIgnoreCase);
77 return flag2 && flag;
78 }
79
81 {
83 {
84 {
85 "Age",
86 new HeaderInfo("Age", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
87 },
88 {
89 "Allow",
90 new HeaderInfo("Allow", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
91 },
92 {
93 "Accept",
94 new HeaderInfo("Accept", requestRestricted: true, responseRestricted: false, multi: true, s_multiParser)
95 },
96 {
97 "Authorization",
98 new HeaderInfo("Authorization", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
99 },
100 {
101 "Accept-Ranges",
102 new HeaderInfo("Accept-Ranges", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
103 },
104 {
105 "Accept-Charset",
106 new HeaderInfo("Accept-Charset", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
107 },
108 {
109 "Accept-Encoding",
110 new HeaderInfo("Accept-Encoding", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
111 },
112 {
113 "Accept-Language",
114 new HeaderInfo("Accept-Language", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
115 },
116 {
117 "Cookie",
118 new HeaderInfo("Cookie", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
119 },
120 {
121 "Connection",
122 new HeaderInfo("Connection", requestRestricted: true, responseRestricted: false, multi: true, s_multiParser)
123 },
124 {
125 "Content-MD5",
126 new HeaderInfo("Content-MD5", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
127 },
128 {
129 "Content-Type",
130 new HeaderInfo("Content-Type", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
131 },
132 {
133 "Cache-Control",
134 new HeaderInfo("Cache-Control", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
135 },
136 {
137 "Content-Range",
138 new HeaderInfo("Content-Range", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
139 },
140 {
141 "Content-Length",
142 new HeaderInfo("Content-Length", requestRestricted: true, responseRestricted: true, multi: false, s_singleParser)
143 },
144 {
145 "Content-Encoding",
146 new HeaderInfo("Content-Encoding", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
147 },
148 {
149 "Content-Language",
150 new HeaderInfo("Content-Language", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
151 },
152 {
153 "Content-Location",
154 new HeaderInfo("Content-Location", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
155 },
156 {
157 "Date",
158 new HeaderInfo("Date", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
159 },
160 {
161 "ETag",
162 new HeaderInfo("ETag", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
163 },
164 {
165 "Expect",
166 new HeaderInfo("Expect", requestRestricted: true, responseRestricted: false, multi: true, s_multiParser)
167 },
168 {
169 "Expires",
170 new HeaderInfo("Expires", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
171 },
172 {
173 "From",
174 new HeaderInfo("From", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
175 },
176 {
177 "Host",
178 new HeaderInfo("Host", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
179 },
180 {
181 "If-Match",
182 new HeaderInfo("If-Match", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
183 },
184 {
185 "If-Range",
186 new HeaderInfo("If-Range", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
187 },
188 {
189 "If-None-Match",
190 new HeaderInfo("If-None-Match", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
191 },
192 {
193 "If-Modified-Since",
194 new HeaderInfo("If-Modified-Since", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
195 },
196 {
197 "If-Unmodified-Since",
198 new HeaderInfo("If-Unmodified-Since", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
199 },
200 {
201 "Keep-Alive",
202 new HeaderInfo("Keep-Alive", requestRestricted: false, responseRestricted: true, multi: false, s_singleParser)
203 },
204 {
205 "Location",
206 new HeaderInfo("Location", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
207 },
208 {
209 "Last-Modified",
210 new HeaderInfo("Last-Modified", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
211 },
212 {
213 "Max-Forwards",
214 new HeaderInfo("Max-Forwards", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
215 },
216 {
217 "Pragma",
218 new HeaderInfo("Pragma", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
219 },
220 {
221 "Proxy-Authenticate",
222 new HeaderInfo("Proxy-Authenticate", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
223 },
224 {
225 "Proxy-Authorization",
226 new HeaderInfo("Proxy-Authorization", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
227 },
228 {
229 "Proxy-Connection",
230 new HeaderInfo("Proxy-Connection", requestRestricted: true, responseRestricted: false, multi: true, s_multiParser)
231 },
232 {
233 "Range",
234 new HeaderInfo("Range", requestRestricted: true, responseRestricted: false, multi: true, s_multiParser)
235 },
236 {
237 "Referer",
238 new HeaderInfo("Referer", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
239 },
240 {
241 "Retry-After",
242 new HeaderInfo("Retry-After", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
243 },
244 {
245 "Server",
246 new HeaderInfo("Server", requestRestricted: false, responseRestricted: false, multi: false, s_singleParser)
247 },
248 {
249 "Set-Cookie",
250 new HeaderInfo("Set-Cookie", requestRestricted: false, responseRestricted: false, multi: true, s_setCookieParser)
251 },
252 {
253 "Set-Cookie2",
254 new HeaderInfo("Set-Cookie2", requestRestricted: false, responseRestricted: false, multi: true, s_setCookieParser)
255 },
256 {
257 "TE",
258 new HeaderInfo("TE", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
259 },
260 {
261 "Trailer",
262 new HeaderInfo("Trailer", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
263 },
264 {
265 "Transfer-Encoding",
266 new HeaderInfo("Transfer-Encoding", requestRestricted: true, responseRestricted: true, multi: true, s_multiParser)
267 },
268 {
269 "Upgrade",
270 new HeaderInfo("Upgrade", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
271 },
272 {
273 "User-Agent",
274 new HeaderInfo("User-Agent", requestRestricted: true, responseRestricted: false, multi: false, s_singleParser)
275 },
276 {
277 "Via",
278 new HeaderInfo("Via", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
279 },
280 {
281 "Vary",
282 new HeaderInfo("Vary", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
283 },
284 {
285 "Warning",
286 new HeaderInfo("Warning", requestRestricted: false, responseRestricted: false, multi: true, s_multiParser)
287 },
288 {
289 "WWW-Authenticate",
290 new HeaderInfo("WWW-Authenticate", requestRestricted: false, responseRestricted: true, multi: true, s_singleParser)
291 }
292 };
293 }
294}
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static readonly CaseInsensitiveAscii StaticInstance
static Hashtable CreateHeaderHashtable()
static string[] ParseValueHelper(string value, bool isSetCookie)
static readonly Hashtable s_headerHashTable
static readonly HeaderInfo s_unknownHeaderInfo
static readonly Func< string, string[]> s_singleParser
static readonly Func< string, string[]> s_multiParser
static readonly Func< string, string[]> s_setCookieParser
static bool IsDuringExpiresAttributeParsing(string singleValue)