1/* C++ code produced by gperf version 3.1 */
2/* Command-line: /usr/bin/gperf --key-positions='*' -D -n -s 2 --output-file=HTTPHeaderNames.cpp HTTPHeaderNames.gperf */
3
4#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27/* The character set is not based on ISO-646. */
28#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29#endif
30
31#line 2 "HTTPHeaderNames.gperf"
32
33/*
34 * Copyright (C) 2014 Apple Inc. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 *
45 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
46 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
47 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
49 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
51 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
55 * THE POSSIBILITY OF SUCH DAMAGE.
56 */
57
58/// This file is generated by create-http-header-name-table, do not edit.
59
60#include "config.h"
61#include "HTTPHeaderNames.h"
62
63#include <wtf/text/StringView.h>
64
65IGNORE_WARNINGS_BEGIN("implicit-fallthrough")
66
67// Older versions of gperf like to use the `register` keyword.
68#define register
69
70namespace WebCore {
71
72static const struct HeaderNameString {
73 const char* const name;
74 unsigned length;
75} headerNameStrings[] = {
76 { "Accept", 6 },
77 { "Accept-Charset", 14 },
78 { "Accept-Encoding", 15 },
79 { "Accept-Language", 15 },
80 { "Accept-Ranges", 13 },
81 { "Access-Control-Allow-Credentials", 32 },
82 { "Access-Control-Allow-Headers", 28 },
83 { "Access-Control-Allow-Methods", 28 },
84 { "Access-Control-Allow-Origin", 27 },
85 { "Access-Control-Expose-Headers", 29 },
86 { "Access-Control-Max-Age", 22 },
87 { "Access-Control-Request-Headers", 30 },
88 { "Access-Control-Request-Method", 29 },
89 { "Age", 3 },
90 { "Authorization", 13 },
91 { "Cache-Control", 13 },
92 { "Connection", 10 },
93 { "Content-Disposition", 19 },
94 { "Content-Encoding", 16 },
95 { "Content-Language", 16 },
96 { "Content-Length", 14 },
97 { "Content-Range", 13 },
98 { "Content-Security-Policy", 23 },
99 { "Content-Security-Policy-Report-Only", 35 },
100 { "Content-Type", 12 },
101 { "Cookie", 6 },
102 { "Cookie2", 7 },
103 { "Cross-Origin-Resource-Policy", 28 },
104 { "DNT", 3 },
105 { "Date", 4 },
106 { "Default-Style", 13 },
107 { "ETag", 4 },
108 { "Expect", 6 },
109 { "Expires", 7 },
110 { "Host", 4 },
111 { "Icy-MetaInt", 11 },
112 { "Icy-Metadata", 12 },
113 { "If-Match", 8 },
114 { "If-Modified-Since", 17 },
115 { "If-None-Match", 13 },
116 { "If-Range", 8 },
117 { "If-Unmodified-Since", 19 },
118 { "Keep-Alive", 10 },
119 { "Last-Event-ID", 13 },
120 { "Last-Modified", 13 },
121 { "Link", 4 },
122 { "Location", 8 },
123 { "Origin", 6 },
124 { "Ping-From", 9 },
125 { "Ping-To", 7 },
126 { "Pragma", 6 },
127 { "Proxy-Authorization", 19 },
128 { "Purpose", 7 },
129 { "Range", 5 },
130 { "Referer", 7 },
131 { "Referrer-Policy", 15 },
132 { "Refresh", 7 },
133 { "Sec-WebSocket-Accept", 20 },
134 { "Sec-WebSocket-Extensions", 24 },
135 { "Sec-WebSocket-Key", 17 },
136 { "Sec-WebSocket-Protocol", 22 },
137 { "Sec-WebSocket-Version", 21 },
138 { "Server-Timing", 13 },
139 { "Service-Worker-Allowed", 22 },
140 { "Set-Cookie", 10 },
141 { "Set-Cookie2", 11 },
142 { "SourceMap", 9 },
143 { "TE", 2 },
144 { "Timing-Allow-Origin", 19 },
145 { "Trailer", 7 },
146 { "Transfer-Encoding", 17 },
147 { "Upgrade", 7 },
148 { "Upgrade-Insecure-Requests", 25 },
149 { "User-Agent", 10 },
150 { "Vary", 4 },
151 { "Via", 3 },
152 { "X-Content-Type-Options", 22 },
153 { "X-DNS-Prefetch-Control", 22 },
154 { "X-Frame-Options", 15 },
155 { "X-SourceMap", 11 },
156 { "X-WebKit-CSP", 12 },
157 { "X-WebKit-CSP-Report-Only", 24 },
158 { "X-XSS-Protection", 16 },
159};
160
161
162#line 140 "HTTPHeaderNames.gperf"
163struct HeaderNameHashEntry {
164 const char* name;
165 HTTPHeaderName headerName;
166};
167enum
168 {
169 TOTAL_KEYWORDS = 83,
170 MIN_WORD_LENGTH = 2,
171 MAX_WORD_LENGTH = 35,
172 MIN_HASH_VALUE = 9,
173 MAX_HASH_VALUE = 630
174 };
175
176/* maximum key range = 622, duplicates = 0 */
177
178#ifndef GPERF_DOWNCASE
179#define GPERF_DOWNCASE 1
180static unsigned char gperf_downcase[256] =
181 {
182 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
183 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
184 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
185 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
186 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
187 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
188 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
189 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
190 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
191 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
192 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
193 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
194 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
195 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
196 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
197 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
198 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
199 255
200 };
201#endif
202
203#ifndef GPERF_CASE_STRNCMP
204#define GPERF_CASE_STRNCMP 1
205static int
206gperf_case_strncmp (const char *s1, const char *s2, size_t n)
207{
208 for (; n > 0;)
209 {
210 unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
211 unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
212 if (c1 != 0 && c1 == c2)
213 {
214 n--;
215 continue;
216 }
217 return (int)c1 - (int)c2;
218 }
219 return 0;
220}
221#endif
222
223class HTTPHeaderNamesHash
224{
225private:
226 static inline unsigned int header_name_hash_function (const char *str, size_t len);
227public:
228 static const struct HeaderNameHashEntry *findHeaderNameImpl (const char *str, size_t len);
229};
230
231inline unsigned int
232HTTPHeaderNamesHash::header_name_hash_function (const char *str, size_t len)
233{
234 static const unsigned short asso_values[] =
235 {
236 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
237 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
238 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
239 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
240 631, 631, 631, 631, 631, 0, 631, 631, 631, 631,
241 85, 631, 631, 631, 631, 631, 631, 631, 631, 631,
242 631, 631, 631, 631, 631, 10, 125, 5, 10, 20,
243 25, 0, 4, 0, 631, 55, 85, 75, 5, 0,
244 50, 20, 5, 0, 5, 60, 255, 15, 110, 50,
245 0, 631, 631, 631, 631, 631, 631, 10, 125, 5,
246 10, 20, 25, 0, 4, 0, 631, 55, 85, 75,
247 5, 0, 50, 20, 5, 0, 5, 60, 255, 15,
248 110, 50, 0, 631, 631, 631, 631, 631, 631, 631,
249 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
250 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
251 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
252 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
253 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
254 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
255 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
256 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
257 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
258 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
259 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
260 631, 631, 631, 631, 631, 631, 631, 631, 631, 631,
261 631, 631, 631, 631, 631, 631
262 };
263 unsigned int hval = 0;
264
265 switch (len)
266 {
267 default:
268 hval += asso_values[static_cast<unsigned char>(str[34])];
269 /*FALLTHROUGH*/
270 case 34:
271 hval += asso_values[static_cast<unsigned char>(str[33])];
272 /*FALLTHROUGH*/
273 case 33:
274 hval += asso_values[static_cast<unsigned char>(str[32])];
275 /*FALLTHROUGH*/
276 case 32:
277 hval += asso_values[static_cast<unsigned char>(str[31])];
278 /*FALLTHROUGH*/
279 case 31:
280 hval += asso_values[static_cast<unsigned char>(str[30])];
281 /*FALLTHROUGH*/
282 case 30:
283 hval += asso_values[static_cast<unsigned char>(str[29])];
284 /*FALLTHROUGH*/
285 case 29:
286 hval += asso_values[static_cast<unsigned char>(str[28])];
287 /*FALLTHROUGH*/
288 case 28:
289 hval += asso_values[static_cast<unsigned char>(str[27])];
290 /*FALLTHROUGH*/
291 case 27:
292 hval += asso_values[static_cast<unsigned char>(str[26])];
293 /*FALLTHROUGH*/
294 case 26:
295 hval += asso_values[static_cast<unsigned char>(str[25])];
296 /*FALLTHROUGH*/
297 case 25:
298 hval += asso_values[static_cast<unsigned char>(str[24])];
299 /*FALLTHROUGH*/
300 case 24:
301 hval += asso_values[static_cast<unsigned char>(str[23])];
302 /*FALLTHROUGH*/
303 case 23:
304 hval += asso_values[static_cast<unsigned char>(str[22])];
305 /*FALLTHROUGH*/
306 case 22:
307 hval += asso_values[static_cast<unsigned char>(str[21])];
308 /*FALLTHROUGH*/
309 case 21:
310 hval += asso_values[static_cast<unsigned char>(str[20])];
311 /*FALLTHROUGH*/
312 case 20:
313 hval += asso_values[static_cast<unsigned char>(str[19])];
314 /*FALLTHROUGH*/
315 case 19:
316 hval += asso_values[static_cast<unsigned char>(str[18])];
317 /*FALLTHROUGH*/
318 case 18:
319 hval += asso_values[static_cast<unsigned char>(str[17])];
320 /*FALLTHROUGH*/
321 case 17:
322 hval += asso_values[static_cast<unsigned char>(str[16])];
323 /*FALLTHROUGH*/
324 case 16:
325 hval += asso_values[static_cast<unsigned char>(str[15])];
326 /*FALLTHROUGH*/
327 case 15:
328 hval += asso_values[static_cast<unsigned char>(str[14])];
329 /*FALLTHROUGH*/
330 case 14:
331 hval += asso_values[static_cast<unsigned char>(str[13])];
332 /*FALLTHROUGH*/
333 case 13:
334 hval += asso_values[static_cast<unsigned char>(str[12])];
335 /*FALLTHROUGH*/
336 case 12:
337 hval += asso_values[static_cast<unsigned char>(str[11])];
338 /*FALLTHROUGH*/
339 case 11:
340 hval += asso_values[static_cast<unsigned char>(str[10])];
341 /*FALLTHROUGH*/
342 case 10:
343 hval += asso_values[static_cast<unsigned char>(str[9])];
344 /*FALLTHROUGH*/
345 case 9:
346 hval += asso_values[static_cast<unsigned char>(str[8])];
347 /*FALLTHROUGH*/
348 case 8:
349 hval += asso_values[static_cast<unsigned char>(str[7])];
350 /*FALLTHROUGH*/
351 case 7:
352 hval += asso_values[static_cast<unsigned char>(str[6])];
353 /*FALLTHROUGH*/
354 case 6:
355 hval += asso_values[static_cast<unsigned char>(str[5])];
356 /*FALLTHROUGH*/
357 case 5:
358 hval += asso_values[static_cast<unsigned char>(str[4])];
359 /*FALLTHROUGH*/
360 case 4:
361 hval += asso_values[static_cast<unsigned char>(str[3])];
362 /*FALLTHROUGH*/
363 case 3:
364 hval += asso_values[static_cast<unsigned char>(str[2])];
365 /*FALLTHROUGH*/
366 case 2:
367 hval += asso_values[static_cast<unsigned char>(str[1])];
368 /*FALLTHROUGH*/
369 case 1:
370 hval += asso_values[static_cast<unsigned char>(str[0])];
371 break;
372 }
373 return hval;
374}
375
376static const struct HeaderNameHashEntry header_name_wordlist[] =
377 {
378#line 184 "HTTPHeaderNames.gperf"
379 {"Host", HTTPHeaderName::Host},
380#line 197 "HTTPHeaderNames.gperf"
381 {"Origin", HTTPHeaderName::Origin},
382#line 178 "HTTPHeaderNames.gperf"
383 {"DNT", HTTPHeaderName::DNT},
384#line 217 "HTTPHeaderNames.gperf"
385 {"TE", HTTPHeaderName::TE},
386#line 163 "HTTPHeaderNames.gperf"
387 {"Age", HTTPHeaderName::Age},
388#line 181 "HTTPHeaderNames.gperf"
389 {"ETag", HTTPHeaderName::ETag},
390#line 203 "HTTPHeaderNames.gperf"
391 {"Range", HTTPHeaderName::Range},
392#line 179 "HTTPHeaderNames.gperf"
393 {"Date", HTTPHeaderName::Date},
394#line 166 "HTTPHeaderNames.gperf"
395 {"Connection", HTTPHeaderName::Connection},
396#line 199 "HTTPHeaderNames.gperf"
397 {"Ping-To", HTTPHeaderName::PingTo},
398#line 190 "HTTPHeaderNames.gperf"
399 {"If-Range", HTTPHeaderName::IfRange},
400#line 206 "HTTPHeaderNames.gperf"
401 {"Refresh", HTTPHeaderName::Refresh},
402#line 175 "HTTPHeaderNames.gperf"
403 {"Cookie", HTTPHeaderName::Cookie},
404#line 171 "HTTPHeaderNames.gperf"
405 {"Content-Range", HTTPHeaderName::ContentRange},
406#line 168 "HTTPHeaderNames.gperf"
407 {"Content-Encoding", HTTPHeaderName::ContentEncoding},
408#line 150 "HTTPHeaderNames.gperf"
409 {"Accept", HTTPHeaderName::Accept},
410#line 204 "HTTPHeaderNames.gperf"
411 {"Referer", HTTPHeaderName::Referer},
412#line 164 "HTTPHeaderNames.gperf"
413 {"Authorization", HTTPHeaderName::Authorization},
414#line 214 "HTTPHeaderNames.gperf"
415 {"Set-Cookie", HTTPHeaderName::SetCookie},
416#line 196 "HTTPHeaderNames.gperf"
417 {"Location", HTTPHeaderName::Location},
418#line 167 "HTTPHeaderNames.gperf"
419 {"Content-Disposition", HTTPHeaderName::ContentDisposition},
420#line 220 "HTTPHeaderNames.gperf"
421 {"Transfer-Encoding", HTTPHeaderName::TransferEncoding},
422#line 187 "HTTPHeaderNames.gperf"
423 {"If-Match", HTTPHeaderName::IfMatch},
424#line 223 "HTTPHeaderNames.gperf"
425 {"User-Agent", HTTPHeaderName::UserAgent},
426#line 219 "HTTPHeaderNames.gperf"
427 {"Trailer", HTTPHeaderName::Trailer},
428#line 154 "HTTPHeaderNames.gperf"
429 {"Accept-Ranges", HTTPHeaderName::AcceptRanges},
430#line 152 "HTTPHeaderNames.gperf"
431 {"Accept-Encoding", HTTPHeaderName::AcceptEncoding},
432#line 151 "HTTPHeaderNames.gperf"
433 {"Accept-Charset", HTTPHeaderName::AcceptCharset},
434#line 195 "HTTPHeaderNames.gperf"
435 {"Link", HTTPHeaderName::Link},
436#line 165 "HTTPHeaderNames.gperf"
437 {"Cache-Control", HTTPHeaderName::CacheControl},
438#line 200 "HTTPHeaderNames.gperf"
439 {"Pragma", HTTPHeaderName::Pragma},
440#line 189 "HTTPHeaderNames.gperf"
441 {"If-None-Match", HTTPHeaderName::IfNoneMatch},
442#line 221 "HTTPHeaderNames.gperf"
443 {"Upgrade", HTTPHeaderName::Upgrade},
444#line 198 "HTTPHeaderNames.gperf"
445 {"Ping-From", HTTPHeaderName::PingFrom},
446#line 170 "HTTPHeaderNames.gperf"
447 {"Content-Length", HTTPHeaderName::ContentLength},
448#line 176 "HTTPHeaderNames.gperf"
449 {"Cookie2", HTTPHeaderName::Cookie2},
450#line 174 "HTTPHeaderNames.gperf"
451 {"Content-Type", HTTPHeaderName::ContentType},
452#line 185 "HTTPHeaderNames.gperf"
453 {"Icy-MetaInt", HTTPHeaderName::IcyMetaInt},
454#line 202 "HTTPHeaderNames.gperf"
455 {"Purpose", HTTPHeaderName::Purpose},
456#line 215 "HTTPHeaderNames.gperf"
457 {"Set-Cookie2", HTTPHeaderName::SetCookie2},
458#line 188 "HTTPHeaderNames.gperf"
459 {"If-Modified-Since", HTTPHeaderName::IfModifiedSince},
460#line 186 "HTTPHeaderNames.gperf"
461 {"Icy-Metadata", HTTPHeaderName::IcyMetadata},
462#line 183 "HTTPHeaderNames.gperf"
463 {"Expires", HTTPHeaderName::Expires},
464#line 182 "HTTPHeaderNames.gperf"
465 {"Expect", HTTPHeaderName::Expect},
466#line 216 "HTTPHeaderNames.gperf"
467 {"SourceMap", HTTPHeaderName::SourceMap},
468#line 169 "HTTPHeaderNames.gperf"
469 {"Content-Language", HTTPHeaderName::ContentLanguage},
470#line 194 "HTTPHeaderNames.gperf"
471 {"Last-Modified", HTTPHeaderName::LastModified},
472#line 191 "HTTPHeaderNames.gperf"
473 {"If-Unmodified-Since", HTTPHeaderName::IfUnmodifiedSince},
474#line 225 "HTTPHeaderNames.gperf"
475 {"Via", HTTPHeaderName::Via},
476#line 153 "HTTPHeaderNames.gperf"
477 {"Accept-Language", HTTPHeaderName::AcceptLanguage},
478#line 218 "HTTPHeaderNames.gperf"
479 {"Timing-Allow-Origin", HTTPHeaderName::TimingAllowOrigin},
480#line 205 "HTTPHeaderNames.gperf"
481 {"Referrer-Policy", HTTPHeaderName::ReferrerPolicy},
482#line 228 "HTTPHeaderNames.gperf"
483 {"X-Frame-Options", HTTPHeaderName::XFrameOptions},
484#line 232 "HTTPHeaderNames.gperf"
485 {"X-XSS-Protection", HTTPHeaderName::XXSSProtection},
486#line 201 "HTTPHeaderNames.gperf"
487 {"Proxy-Authorization", HTTPHeaderName::ProxyAuthorization},
488#line 224 "HTTPHeaderNames.gperf"
489 {"Vary", HTTPHeaderName::Vary},
490#line 177 "HTTPHeaderNames.gperf"
491 {"Cross-Origin-Resource-Policy", HTTPHeaderName::CrossOriginResourcePolicy},
492#line 229 "HTTPHeaderNames.gperf"
493 {"X-SourceMap", HTTPHeaderName::XSourceMap},
494#line 226 "HTTPHeaderNames.gperf"
495 {"X-Content-Type-Options", HTTPHeaderName::XContentTypeOptions},
496#line 161 "HTTPHeaderNames.gperf"
497 {"Access-Control-Request-Headers", HTTPHeaderName::AccessControlRequestHeaders},
498#line 158 "HTTPHeaderNames.gperf"
499 {"Access-Control-Allow-Origin", HTTPHeaderName::AccessControlAllowOrigin},
500#line 227 "HTTPHeaderNames.gperf"
501 {"X-DNS-Prefetch-Control", HTTPHeaderName::XDNSPrefetchControl},
502#line 207 "HTTPHeaderNames.gperf"
503 {"Sec-WebSocket-Accept", HTTPHeaderName::SecWebSocketAccept},
504#line 160 "HTTPHeaderNames.gperf"
505 {"Access-Control-Max-Age", HTTPHeaderName::AccessControlMaxAge},
506#line 180 "HTTPHeaderNames.gperf"
507 {"Default-Style", HTTPHeaderName::DefaultStyle},
508#line 172 "HTTPHeaderNames.gperf"
509 {"Content-Security-Policy", HTTPHeaderName::ContentSecurityPolicy},
510#line 230 "HTTPHeaderNames.gperf"
511 {"X-WebKit-CSP", HTTPHeaderName::XWebKitCSP},
512#line 162 "HTTPHeaderNames.gperf"
513 {"Access-Control-Request-Method", HTTPHeaderName::AccessControlRequestMethod},
514#line 212 "HTTPHeaderNames.gperf"
515 {"Server-Timing", HTTPHeaderName::ServerTiming},
516#line 209 "HTTPHeaderNames.gperf"
517 {"Sec-WebSocket-Key", HTTPHeaderName::SecWebSocketKey},
518#line 222 "HTTPHeaderNames.gperf"
519 {"Upgrade-Insecure-Requests", HTTPHeaderName::UpgradeInsecureRequests},
520#line 156 "HTTPHeaderNames.gperf"
521 {"Access-Control-Allow-Headers", HTTPHeaderName::AccessControlAllowHeaders},
522#line 159 "HTTPHeaderNames.gperf"
523 {"Access-Control-Expose-Headers", HTTPHeaderName::AccessControlExposeHeaders},
524#line 193 "HTTPHeaderNames.gperf"
525 {"Last-Event-ID", HTTPHeaderName::LastEventID},
526#line 210 "HTTPHeaderNames.gperf"
527 {"Sec-WebSocket-Protocol", HTTPHeaderName::SecWebSocketProtocol},
528#line 208 "HTTPHeaderNames.gperf"
529 {"Sec-WebSocket-Extensions", HTTPHeaderName::SecWebSocketExtensions},
530#line 157 "HTTPHeaderNames.gperf"
531 {"Access-Control-Allow-Methods", HTTPHeaderName::AccessControlAllowMethods},
532#line 155 "HTTPHeaderNames.gperf"
533 {"Access-Control-Allow-Credentials", HTTPHeaderName::AccessControlAllowCredentials},
534#line 192 "HTTPHeaderNames.gperf"
535 {"Keep-Alive", HTTPHeaderName::KeepAlive},
536#line 211 "HTTPHeaderNames.gperf"
537 {"Sec-WebSocket-Version", HTTPHeaderName::SecWebSocketVersion},
538#line 173 "HTTPHeaderNames.gperf"
539 {"Content-Security-Policy-Report-Only", HTTPHeaderName::ContentSecurityPolicyReportOnly},
540#line 231 "HTTPHeaderNames.gperf"
541 {"X-WebKit-CSP-Report-Only", HTTPHeaderName::XWebKitCSPReportOnly},
542#line 213 "HTTPHeaderNames.gperf"
543 {"Service-Worker-Allowed", HTTPHeaderName::ServiceWorkerAllowed}
544 };
545
546static const signed char lookup[] =
547 {
548 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1,
549 -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, 3, -1, -1,
550 -1, -1, 4, -1, -1, -1, -1, 5, -1, -1, -1, -1, 6, -1,
551 -1, -1, -1, 7, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1,
552 -1, -1, -1, -1, 9, -1, -1, -1, -1, 10, -1, -1, -1, -1,
553 -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, -1, -1, -1,
554 -1, 13, -1, -1, -1, -1, 14, -1, -1, -1, -1, 15, -1, -1,
555 -1, -1, 16, -1, -1, -1, 17, 18, -1, -1, -1, -1, 19, -1,
556 -1, -1, -1, 20, -1, -1, -1, -1, 21, -1, -1, -1, 22, 23,
557 -1, -1, -1, -1, 24, -1, -1, -1, -1, 25, -1, -1, -1, -1,
558 26, -1, -1, -1, 27, 28, -1, -1, -1, 29, 30, -1, -1, -1,
559 31, 32, -1, -1, -1, -1, 33, -1, -1, -1, 34, 35, -1, -1,
560 -1, -1, 36, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
561 -1, -1, -1, 38, -1, -1, -1, -1, 39, -1, -1, -1, -1, 40,
562 -1, -1, -1, -1, 41, -1, -1, -1, -1, 42, -1, -1, -1, -1,
563 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
564 -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, 45, -1, -1,
565 -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
566 -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, 48,
567 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
568 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, 50, -1, -1, -1,
569 -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1,
570 -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, 54, 55, -1,
571 -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
572 -1, -1, -1, -1, 58, -1, -1, -1, 59, -1, -1, -1, -1, -1,
573 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
574 61, 62, -1, -1, -1, -1, 63, -1, -1, -1, -1, 64, -1, -1,
575 -1, -1, 65, -1, -1, -1, -1, 66, -1, -1, -1, 67, 68, -1,
576 -1, -1, -1, 69, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1,
577 -1, -1, -1, 71, -1, -1, -1, -1, 72, 73, -1, -1, -1, -1,
578 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
579 -1, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
580 -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1,
581 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
583 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
584 -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1,
585 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
587 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1,
588 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
589 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
591 -1, -1, -1, 80, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1,
592 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
593 82
594 };
595
596const struct HeaderNameHashEntry *
597HTTPHeaderNamesHash::findHeaderNameImpl (const char *str, size_t len)
598{
599 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
600 {
601 unsigned int key = header_name_hash_function (str, len);
602
603 if (key <= MAX_HASH_VALUE)
604 {
605 int index = lookup[key];
606
607 if (index >= 0)
608 {
609 const char *s = header_name_wordlist[index].name;
610
611 if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
612 return &header_name_wordlist[index];
613 }
614 }
615 }
616 return 0;
617}
618#line 233 "HTTPHeaderNames.gperf"
619
620bool findHTTPHeaderName(StringView stringView, HTTPHeaderName& headerName)
621{
622 unsigned length = stringView.length();
623 if (length > maxHTTPHeaderNameLength || length < minHTTPHeaderNameLength)
624 return false;
625
626 if (stringView.is8Bit()) {
627 if (auto nameAndString = HTTPHeaderNamesHash::findHeaderNameImpl(reinterpret_cast<const char*>(stringView.characters8()), length)) {
628 headerName = nameAndString->headerName;
629 return true;
630 }
631 } else {
632 LChar characters[maxHTTPHeaderNameLength];
633 for (unsigned i = 0; i < length; ++i) {
634 UChar character = stringView.characters16()[i];
635 if (!isASCII(character))
636 return false;
637
638 characters[i] = static_cast<LChar>(character);
639 }
640
641 if (auto nameAndString = HTTPHeaderNamesHash::findHeaderNameImpl(reinterpret_cast<const char*>(characters), length)) {
642 headerName = nameAndString->headerName;
643 return true;
644 }
645 }
646
647 return false;
648}
649
650StringView httpHeaderNameString(HTTPHeaderName headerName)
651{
652 ASSERT(static_cast<unsigned>(headerName) < numHTTPHeaderNames);
653
654 const auto& name = headerNameStrings[static_cast<unsigned>(headerName)];
655
656 return StringView { reinterpret_cast<const LChar*>(name.name), static_cast<unsigned>(name.length) };
657}
658
659} // namespace WebCore
660
661#if defined(__clang__)
662IGNORE_WARNINGS_END
663#endif
664