Source file static_table.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
module TokenIndices = struct
let authority = 0
let _method = 1
let path = 3
let scheme = 5
let status = 7
let accept_charset = 14
let accept_encoding = 15
let accept_language = 16
let accept_ranges = 17
let accept = 18
let access_control_allow_origin = 19
let age = 20
let allow = 21
let authorization = 22
let cache_control = 23
let content_disposition = 24
let content_encoding = 25
let content_language = 26
let content_length = 27
let content_location = 28
let content_range = 29
let content_type = 30
let cookie = 31
let date = 32
let etag = 33
let expect = 34
let expires = 35
let from = 36
let host = 37
let if_match = 38
let if_modified_since = 39
let if_none_match = 40
let if_range = 41
let if_unmodified_since = 42
let last_modified = 43
let link = 44
let location = 45
let max_forwards = 46
let proxy_authenticate = 47
let proxy_authorization = 48
let range = 49
let referer = 50
let refresh = 51
let retry_after = 52
let server = 53
let set_cookie = 54
let strict_transport_security = 55
let transfer_encoding = 56
let user_agent = 57
let vary = 58
let via = 59
let www_authenticate = 60
end
let table_size = 61
let table =
[| ":authority", ""
; ":method", "GET"
; ":method", "POST"
; ":path", "/"
; ":path", "/index.html"
; ":scheme", "http"
; ":scheme", "https"
; ":status", "200"
; ":status", "204"
; ":status", "206"
; ":status", "304"
; ":status", "400"
; ":status", "404"
; ":status", "500"
; "accept-charset", ""
; "accept-encoding", "gzip, deflate"
; "accept-language", ""
; "accept-ranges", ""
; "accept", ""
; "access-control-allow-origin", ""
; "age", ""
; "allow", ""
; "authorization", ""
; "cache-control", ""
; "content-disposition", ""
; "content-encoding", ""
; "content-language", ""
; "content-length", ""
; "content-location", ""
; "content-range", ""
; "content-type", ""
; "cookie", ""
; "date", ""
; "etag", ""
; "expect", ""
; "expires", ""
; "from", ""
; "host", ""
; "if-match", ""
; "if-modified-since", ""
; "if-none-match", ""
; "if-range", ""
; "if-unmodified-since", ""
; "last-modified", ""
; "link", ""
; "location", ""
; "max-forwards", ""
; "proxy-authenticate", ""
; "proxy-authorization", ""
; "range", ""
; "referer", ""
; "refresh", ""
; "retry-after", ""
; "server", ""
; "set-cookie", ""
; "strict-transport-security", ""
; "transfer-encoding", ""
; "user-agent", ""
; "vary", ""
; "via", ""
; "www-authenticate", ""
|]
let lookup_token_index name =
match String.length name with
| 3 ->
(match name.[0] with
| 'a' when name = "age" ->
20
| 'v' when name = "via" ->
59
| _ ->
-1)
| 4 ->
(match name.[0] with
| 'd' when name = "date" ->
32
| 'e' when name = "etag" ->
33
| 'f' when name = "from" ->
36
| 'h' when name = "host" ->
37
| 'l' when name = "link" ->
44
| 'v' when name = "vary" ->
58
| _ ->
-1)
| 5 ->
(match name.[0] with
| ':' when name = ":path" ->
3
| 'a' when name = "allow" ->
21
| 'r' when name = "range" ->
49
| _ ->
-1)
| 6 ->
(match name.[0] with
| 'a' when name = "accept" ->
18
| 'c' when name = "cookie" ->
31
| 'e' when name = "expect" ->
34
| 's' when name = "server" ->
53
| _ ->
-1)
| 7 ->
(match name.[3] with
| 't' when name = ":method" ->
1
| 'h' when name = ":scheme" ->
5
| 'a' when name = ":status" ->
7
| 'i' when name = "expires" ->
35
| 'e' when name = "referer" ->
50
| 'r' when name = "refresh" ->
51
| _ ->
-1)
| 8 ->
(match name.[3] with
| 'm' when name = "if-match" ->
38
| 'r' when name = "if-range" ->
41
| 'a' when name = "location" ->
45
| _ ->
-1)
| 10 ->
(match name.[0] with
| ':' when name = ":authority" ->
0
| 's' when name = "set-cookie" ->
54
| 'u' when name = "user-agent" ->
57
| _ ->
-1)
| 11 ->
(match name.[0] with 'r' when name = "retry-after" -> 52 | _ -> -1)
| 12 ->
(match name.[0] with
| 'c' when name = "content-type" ->
30
| 'm' when name = "max-forwards" ->
46
| _ ->
-1)
| 13 ->
(match name.[6] with
| '-' when name = "accept-ranges" ->
17
| 'i' when name = "authorization" ->
22
| 'c' when name = "cache-control" ->
23
| 't' when name = "content-range" ->
29
| 'e' when name = "if-none-match" ->
40
| 'o' when name = "last-modified" ->
43
| _ ->
-1)
| 14 ->
(match name.[0] with
| 'a' when name = "accept-charset" ->
14
| 'c' when name = "content-length" ->
27
| _ ->
-1)
| 15 ->
(match name.[7] with
| 'e' when name = "accept-encoding" ->
15
| 'l' when name = "accept-language" ->
16
| _ ->
-1)
| 16 ->
(match name.[11] with
| 'o' when name = "content-encoding" ->
25
| 'g' when name = "content-language" ->
26
| 'a' when name = "content-location" ->
28
| 'i' when name = "www-authenticate" ->
60
| _ ->
-1)
| 17 ->
(match name.[0] with
| 'i' when name = "if-modified-since" ->
39
| 't' when name = "transfer-encoding" ->
56
| _ ->
-1)
| 18 ->
(match name.[0] with 'p' when name = "proxy-authenticate" -> 47 | _ -> -1)
| 19 ->
(match name.[0] with
| 'c' when name = "content-disposition" ->
24
| 'i' when name = "if-unmodified-since" ->
42
| 'p' when name = "proxy-authorization" ->
48
| _ ->
-1)
| 25 ->
(match name.[0] with
| 's' when name = "strict-transport-security" ->
55
| _ ->
-1)
| 27 ->
(match name.[0] with
| 'a' when name = "access-control-allow-origin" ->
19
| _ ->
-1)
| _ ->
-1