waitress-core 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/LICENSE +21 -21
  4. data/Rakefile +13 -4
  5. data/bin/waitress +22 -22
  6. data/ext/Thanks.md +1 -1
  7. data/ext/waitress_http11/ext_help.h +15 -15
  8. data/ext/waitress_http11/extconf.rb +6 -6
  9. data/ext/waitress_http11/http11.c +532 -532
  10. data/ext/waitress_http11/http11_parser.c +1216 -1216
  11. data/ext/waitress_http11/http11_parser.h +49 -49
  12. data/ext/waitress_http11/http11_parser.java.rl +171 -171
  13. data/ext/waitress_http11/http11_parser.rl +165 -165
  14. data/ext/waitress_http11/http11_parser_common.rl +55 -55
  15. data/ext/waitress_http11/http11_wrb_parser.h +83 -83
  16. data/lib/waitress/chef.rb +110 -110
  17. data/lib/waitress/configure.rb +116 -116
  18. data/lib/waitress/handlers/dirhandler.rb +39 -39
  19. data/lib/waitress/handlers/handler.rb +57 -57
  20. data/lib/waitress/handlers/handler404.rb +25 -25
  21. data/lib/waitress/handlers/libhandler.rb +58 -58
  22. data/lib/waitress/kernel.rb +182 -182
  23. data/lib/waitress/parse/query.rb +60 -60
  24. data/lib/waitress/request.rb +45 -45
  25. data/lib/waitress/resources/default_config.rb +52 -52
  26. data/lib/waitress/resources/http/404.html +18 -18
  27. data/lib/waitress/resources/http/css/hack.css +37 -37
  28. data/lib/waitress/resources/http/css/waitress.css +57 -57
  29. data/lib/waitress/resources/http/fonts/eot/latin/hack-bold-latin-webfont.eot +0 -0
  30. data/lib/waitress/resources/http/fonts/eot/latin/hack-bolditalic-latin-webfont.eot +0 -0
  31. data/lib/waitress/resources/http/fonts/eot/latin/hack-italic-latin-webfont.eot +0 -0
  32. data/lib/waitress/resources/http/fonts/eot/latin/hack-regular-latin-webfont.eot +0 -0
  33. data/lib/waitress/resources/http/fonts/svg/latin/hack-bold-latin-webfont.svg +240 -240
  34. data/lib/waitress/resources/http/fonts/svg/latin/hack-bolditalic-latin-webfont.svg +240 -240
  35. data/lib/waitress/resources/http/fonts/svg/latin/hack-italic-latin-webfont.svg +240 -240
  36. data/lib/waitress/resources/http/fonts/svg/latin/hack-regular-latin-webfont.svg +240 -240
  37. data/lib/waitress/resources/http/fonts/web-ttf/latin/hack-bold-latin-webfont.ttf +0 -0
  38. data/lib/waitress/resources/http/fonts/web-ttf/latin/hack-bolditalic-latin-webfont.ttf +0 -0
  39. data/lib/waitress/resources/http/fonts/web-ttf/latin/hack-italic-latin-webfont.ttf +0 -0
  40. data/lib/waitress/resources/http/fonts/web-ttf/latin/hack-regular-latin-webfont.ttf +0 -0
  41. data/lib/waitress/resources/http/fonts/woff/latin/hack-bold-latin-webfont.woff +0 -0
  42. data/lib/waitress/resources/http/fonts/woff/latin/hack-bolditalic-latin-webfont.woff +0 -0
  43. data/lib/waitress/resources/http/fonts/woff/latin/hack-italic-latin-webfont.woff +0 -0
  44. data/lib/waitress/resources/http/fonts/woff/latin/hack-regular-latin-webfont.woff +0 -0
  45. data/lib/waitress/resources/http/fonts/woff2/latin/hack-bold-latin-webfont.woff2 +0 -0
  46. data/lib/waitress/resources/http/fonts/woff2/latin/hack-bolditalic-latin-webfont.woff2 +0 -0
  47. data/lib/waitress/resources/http/fonts/woff2/latin/hack-italic-latin-webfont.woff2 +0 -0
  48. data/lib/waitress/resources/http/fonts/woff2/latin/hack-regular-latin-webfont.woff2 +0 -0
  49. data/lib/waitress/resources/http/img/404.png +0 -0
  50. data/lib/waitress/resources/http/index.html +15 -15
  51. data/lib/waitress/response.rb +104 -104
  52. data/lib/waitress/server.rb +126 -115
  53. data/lib/waitress/util.rb +707 -713
  54. data/lib/waitress/version.rb +3 -3
  55. data/lib/waitress/vhost.rb +217 -217
  56. data/lib/waitress.rb +98 -98
  57. data/lib/waitress_http11.bundle +0 -0
  58. data/waitress-core.gemspec +29 -27
  59. metadata +35 -7
  60. data/lib/waitress_http11.so +0 -0
@@ -1,1216 +1,1216 @@
1
- #line 1 "http11_parser.rl"
2
- /**
3
- * Copyright (c) 2005 Zed A. Shaw
4
- * You can redistribute it and/or modify it under the same terms as Ruby.
5
- */
6
- #include "http11_parser.h"
7
- #include <stdio.h>
8
- #include <assert.h>
9
- #include <stdlib.h>
10
- #include <ctype.h>
11
- #include <string.h>
12
-
13
- /*
14
- * capitalizes all lower-case ASCII characters,
15
- * converts dashes to underscores.
16
- */
17
- static void snake_upcase_char(char *c)
18
- {
19
- if (*c >= 'a' && *c <= 'z')
20
- *c &= ~0x20;
21
- else if (*c == '-')
22
- *c = '_';
23
- }
24
-
25
- #define LEN(AT, FPC) (FPC - buffer - parser->AT)
26
- #define MARK(M,FPC) (parser->M = (FPC) - buffer)
27
- #define PTR_TO(F) (buffer + parser->F)
28
-
29
- /** Machine **/
30
-
31
- #line 87 "http11_parser.rl"
32
-
33
-
34
- /** Data **/
35
-
36
- #line 37 "http11_parser.c"
37
- static const int http_parser_start = 1;
38
- static const int http_parser_first_final = 57;
39
- static const int http_parser_error = 0;
40
-
41
- static const int http_parser_en_main = 1;
42
-
43
- #line 91 "http11_parser.rl"
44
-
45
- int http_parser_init(http_parser *parser) {
46
- int cs = 0;
47
-
48
- #line 49 "http11_parser.c"
49
- {
50
- cs = http_parser_start;
51
- }
52
- #line 95 "http11_parser.rl"
53
- parser->cs = cs;
54
- parser->body_start = 0;
55
- parser->content_len = 0;
56
- parser->mark = 0;
57
- parser->nread = 0;
58
- parser->field_len = 0;
59
- parser->field_start = 0;
60
-
61
- return(1);
62
- }
63
-
64
-
65
- /** exec **/
66
- size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
67
- const char *p, *pe;
68
- int cs = parser->cs;
69
-
70
- assert(off <= len && "offset past end of buffer");
71
-
72
- p = buffer+off;
73
- pe = buffer+len;
74
-
75
- assert(*pe == '\0' && "pointer does not end on NUL");
76
- assert(pe - p == len - off && "pointers aren't same distance");
77
-
78
-
79
-
80
- #line 81 "http11_parser.c"
81
- {
82
- if ( p == pe )
83
- goto _out;
84
- switch ( cs )
85
- {
86
- case 1:
87
- switch( (*p) ) {
88
- case 36: goto tr0;
89
- case 95: goto tr0;
90
- }
91
- if ( (*p) < 48 ) {
92
- if ( 45 <= (*p) && (*p) <= 46 )
93
- goto tr0;
94
- } else if ( (*p) > 57 ) {
95
- if ( 65 <= (*p) && (*p) <= 90 )
96
- goto tr0;
97
- } else
98
- goto tr0;
99
- goto st0;
100
- st0:
101
- goto _out0;
102
- tr0:
103
- #line 34 "http11_parser.rl"
104
- {MARK(mark, p); }
105
- goto st2;
106
- st2:
107
- if ( ++p == pe )
108
- goto _out2;
109
- case 2:
110
- #line 111 "http11_parser.c"
111
- switch( (*p) ) {
112
- case 32: goto tr2;
113
- case 36: goto st38;
114
- case 95: goto st38;
115
- }
116
- if ( (*p) < 48 ) {
117
- if ( 45 <= (*p) && (*p) <= 46 )
118
- goto st38;
119
- } else if ( (*p) > 57 ) {
120
- if ( 65 <= (*p) && (*p) <= 90 )
121
- goto st38;
122
- } else
123
- goto st38;
124
- goto st0;
125
- tr2:
126
- #line 49 "http11_parser.rl"
127
- {
128
- if(parser->request_method != NULL)
129
- parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
130
- }
131
- goto st3;
132
- st3:
133
- if ( ++p == pe )
134
- goto _out3;
135
- case 3:
136
- #line 137 "http11_parser.c"
137
- switch( (*p) ) {
138
- case 42: goto tr4;
139
- case 43: goto tr5;
140
- case 47: goto tr6;
141
- case 58: goto tr7;
142
- }
143
- if ( (*p) < 65 ) {
144
- if ( 45 <= (*p) && (*p) <= 57 )
145
- goto tr5;
146
- } else if ( (*p) > 90 ) {
147
- if ( 97 <= (*p) && (*p) <= 122 )
148
- goto tr5;
149
- } else
150
- goto tr5;
151
- goto st0;
152
- tr4:
153
- #line 34 "http11_parser.rl"
154
- {MARK(mark, p); }
155
- goto st4;
156
- st4:
157
- if ( ++p == pe )
158
- goto _out4;
159
- case 4:
160
- #line 161 "http11_parser.c"
161
- switch( (*p) ) {
162
- case 32: goto tr8;
163
- case 35: goto tr9;
164
- }
165
- goto st0;
166
- tr8:
167
- #line 53 "http11_parser.rl"
168
- {
169
- if(parser->request_uri != NULL)
170
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
171
- }
172
- goto st5;
173
- tr30:
174
- #line 57 "http11_parser.rl"
175
- {
176
- if(parser->fragment != NULL)
177
- parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
178
- }
179
- goto st5;
180
- tr40:
181
- #line 73 "http11_parser.rl"
182
- {
183
- if(parser->request_path != NULL)
184
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
185
- }
186
- #line 53 "http11_parser.rl"
187
- {
188
- if(parser->request_uri != NULL)
189
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
190
- }
191
- goto st5;
192
- tr51:
193
- #line 62 "http11_parser.rl"
194
- {MARK(query_start, p); }
195
- #line 63 "http11_parser.rl"
196
- {
197
- if(parser->query_string != NULL)
198
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
199
- }
200
- #line 53 "http11_parser.rl"
201
- {
202
- if(parser->request_uri != NULL)
203
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
204
- }
205
- goto st5;
206
- tr55:
207
- #line 63 "http11_parser.rl"
208
- {
209
- if(parser->query_string != NULL)
210
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
211
- }
212
- #line 53 "http11_parser.rl"
213
- {
214
- if(parser->request_uri != NULL)
215
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
216
- }
217
- goto st5;
218
- st5:
219
- if ( ++p == pe )
220
- goto _out5;
221
- case 5:
222
- #line 223 "http11_parser.c"
223
- if ( (*p) == 72 )
224
- goto tr10;
225
- goto st0;
226
- tr10:
227
- #line 34 "http11_parser.rl"
228
- {MARK(mark, p); }
229
- goto st6;
230
- st6:
231
- if ( ++p == pe )
232
- goto _out6;
233
- case 6:
234
- #line 235 "http11_parser.c"
235
- if ( (*p) == 84 )
236
- goto st7;
237
- goto st0;
238
- st7:
239
- if ( ++p == pe )
240
- goto _out7;
241
- case 7:
242
- if ( (*p) == 84 )
243
- goto st8;
244
- goto st0;
245
- st8:
246
- if ( ++p == pe )
247
- goto _out8;
248
- case 8:
249
- if ( (*p) == 80 )
250
- goto st9;
251
- goto st0;
252
- st9:
253
- if ( ++p == pe )
254
- goto _out9;
255
- case 9:
256
- if ( (*p) == 47 )
257
- goto st10;
258
- goto st0;
259
- st10:
260
- if ( ++p == pe )
261
- goto _out10;
262
- case 10:
263
- if ( 48 <= (*p) && (*p) <= 57 )
264
- goto st11;
265
- goto st0;
266
- st11:
267
- if ( ++p == pe )
268
- goto _out11;
269
- case 11:
270
- if ( (*p) == 46 )
271
- goto st12;
272
- if ( 48 <= (*p) && (*p) <= 57 )
273
- goto st11;
274
- goto st0;
275
- st12:
276
- if ( ++p == pe )
277
- goto _out12;
278
- case 12:
279
- if ( 48 <= (*p) && (*p) <= 57 )
280
- goto st13;
281
- goto st0;
282
- st13:
283
- if ( ++p == pe )
284
- goto _out13;
285
- case 13:
286
- if ( (*p) == 13 )
287
- goto tr18;
288
- if ( 48 <= (*p) && (*p) <= 57 )
289
- goto st13;
290
- goto st0;
291
- tr18:
292
- #line 68 "http11_parser.rl"
293
- {
294
- if(parser->http_version != NULL)
295
- parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
296
- }
297
- goto st14;
298
- tr26:
299
- #line 44 "http11_parser.rl"
300
- {
301
- if(parser->http_field != NULL) {
302
- parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
303
- }
304
- }
305
- goto st14;
306
- st14:
307
- if ( ++p == pe )
308
- goto _out14;
309
- case 14:
310
- #line 311 "http11_parser.c"
311
- if ( (*p) == 10 )
312
- goto st15;
313
- goto st0;
314
- st15:
315
- if ( ++p == pe )
316
- goto _out15;
317
- case 15:
318
- switch( (*p) ) {
319
- case 13: goto st16;
320
- case 33: goto tr21;
321
- case 124: goto tr21;
322
- case 126: goto tr21;
323
- }
324
- if ( (*p) < 45 ) {
325
- if ( (*p) > 39 ) {
326
- if ( 42 <= (*p) && (*p) <= 43 )
327
- goto tr21;
328
- } else if ( (*p) >= 35 )
329
- goto tr21;
330
- } else if ( (*p) > 46 ) {
331
- if ( (*p) < 65 ) {
332
- if ( 48 <= (*p) && (*p) <= 57 )
333
- goto tr21;
334
- } else if ( (*p) > 90 ) {
335
- if ( 94 <= (*p) && (*p) <= 122 )
336
- goto tr21;
337
- } else
338
- goto tr21;
339
- } else
340
- goto tr21;
341
- goto st0;
342
- st16:
343
- if ( ++p == pe )
344
- goto _out16;
345
- case 16:
346
- if ( (*p) == 10 )
347
- goto tr22;
348
- goto st0;
349
- tr22:
350
- #line 78 "http11_parser.rl"
351
- {
352
- parser->body_start = p - buffer + 1;
353
- if(parser->header_done != NULL)
354
- parser->header_done(parser->data, p + 1, pe - p - 1);
355
- goto _out57;
356
- }
357
- goto st57;
358
- st57:
359
- if ( ++p == pe )
360
- goto _out57;
361
- case 57:
362
- #line 363 "http11_parser.c"
363
- goto st0;
364
- tr21:
365
- #line 37 "http11_parser.rl"
366
- { MARK(field_start, p); }
367
- #line 38 "http11_parser.rl"
368
- { snake_upcase_char((char *)p); }
369
- goto st17;
370
- tr23:
371
- #line 38 "http11_parser.rl"
372
- { snake_upcase_char((char *)p); }
373
- goto st17;
374
- st17:
375
- if ( ++p == pe )
376
- goto _out17;
377
- case 17:
378
- #line 379 "http11_parser.c"
379
- switch( (*p) ) {
380
- case 33: goto tr23;
381
- case 58: goto tr24;
382
- case 124: goto tr23;
383
- case 126: goto tr23;
384
- }
385
- if ( (*p) < 45 ) {
386
- if ( (*p) > 39 ) {
387
- if ( 42 <= (*p) && (*p) <= 43 )
388
- goto tr23;
389
- } else if ( (*p) >= 35 )
390
- goto tr23;
391
- } else if ( (*p) > 46 ) {
392
- if ( (*p) < 65 ) {
393
- if ( 48 <= (*p) && (*p) <= 57 )
394
- goto tr23;
395
- } else if ( (*p) > 90 ) {
396
- if ( 94 <= (*p) && (*p) <= 122 )
397
- goto tr23;
398
- } else
399
- goto tr23;
400
- } else
401
- goto tr23;
402
- goto st0;
403
- tr24:
404
- #line 39 "http11_parser.rl"
405
- {
406
- parser->field_len = LEN(field_start, p);
407
- }
408
- goto st18;
409
- tr27:
410
- #line 43 "http11_parser.rl"
411
- { MARK(mark, p); }
412
- goto st18;
413
- st18:
414
- if ( ++p == pe )
415
- goto _out18;
416
- case 18:
417
- #line 418 "http11_parser.c"
418
- switch( (*p) ) {
419
- case 13: goto tr26;
420
- case 32: goto tr27;
421
- }
422
- goto tr25;
423
- tr25:
424
- #line 43 "http11_parser.rl"
425
- { MARK(mark, p); }
426
- goto st19;
427
- st19:
428
- if ( ++p == pe )
429
- goto _out19;
430
- case 19:
431
- #line 432 "http11_parser.c"
432
- if ( (*p) == 13 )
433
- goto tr26;
434
- goto st19;
435
- tr9:
436
- #line 53 "http11_parser.rl"
437
- {
438
- if(parser->request_uri != NULL)
439
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
440
- }
441
- goto st20;
442
- tr41:
443
- #line 73 "http11_parser.rl"
444
- {
445
- if(parser->request_path != NULL)
446
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
447
- }
448
- #line 53 "http11_parser.rl"
449
- {
450
- if(parser->request_uri != NULL)
451
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
452
- }
453
- goto st20;
454
- tr52:
455
- #line 62 "http11_parser.rl"
456
- {MARK(query_start, p); }
457
- #line 63 "http11_parser.rl"
458
- {
459
- if(parser->query_string != NULL)
460
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
461
- }
462
- #line 53 "http11_parser.rl"
463
- {
464
- if(parser->request_uri != NULL)
465
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
466
- }
467
- goto st20;
468
- tr56:
469
- #line 63 "http11_parser.rl"
470
- {
471
- if(parser->query_string != NULL)
472
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
473
- }
474
- #line 53 "http11_parser.rl"
475
- {
476
- if(parser->request_uri != NULL)
477
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
478
- }
479
- goto st20;
480
- st20:
481
- if ( ++p == pe )
482
- goto _out20;
483
- case 20:
484
- #line 485 "http11_parser.c"
485
- switch( (*p) ) {
486
- case 32: goto tr30;
487
- case 35: goto st0;
488
- case 37: goto tr31;
489
- case 127: goto st0;
490
- }
491
- if ( 0 <= (*p) && (*p) <= 31 )
492
- goto st0;
493
- goto tr29;
494
- tr29:
495
- #line 34 "http11_parser.rl"
496
- {MARK(mark, p); }
497
- goto st21;
498
- st21:
499
- if ( ++p == pe )
500
- goto _out21;
501
- case 21:
502
- #line 503 "http11_parser.c"
503
- switch( (*p) ) {
504
- case 32: goto tr30;
505
- case 35: goto st0;
506
- case 37: goto st22;
507
- case 127: goto st0;
508
- }
509
- if ( 0 <= (*p) && (*p) <= 31 )
510
- goto st0;
511
- goto st21;
512
- tr31:
513
- #line 34 "http11_parser.rl"
514
- {MARK(mark, p); }
515
- goto st22;
516
- st22:
517
- if ( ++p == pe )
518
- goto _out22;
519
- case 22:
520
- #line 521 "http11_parser.c"
521
- if ( (*p) < 65 ) {
522
- if ( 48 <= (*p) && (*p) <= 57 )
523
- goto st23;
524
- } else if ( (*p) > 70 ) {
525
- if ( 97 <= (*p) && (*p) <= 102 )
526
- goto st23;
527
- } else
528
- goto st23;
529
- goto st0;
530
- st23:
531
- if ( ++p == pe )
532
- goto _out23;
533
- case 23:
534
- if ( (*p) < 65 ) {
535
- if ( 48 <= (*p) && (*p) <= 57 )
536
- goto st21;
537
- } else if ( (*p) > 70 ) {
538
- if ( 97 <= (*p) && (*p) <= 102 )
539
- goto st21;
540
- } else
541
- goto st21;
542
- goto st0;
543
- tr5:
544
- #line 34 "http11_parser.rl"
545
- {MARK(mark, p); }
546
- goto st24;
547
- st24:
548
- if ( ++p == pe )
549
- goto _out24;
550
- case 24:
551
- #line 552 "http11_parser.c"
552
- switch( (*p) ) {
553
- case 43: goto st24;
554
- case 58: goto st25;
555
- }
556
- if ( (*p) < 48 ) {
557
- if ( 45 <= (*p) && (*p) <= 46 )
558
- goto st24;
559
- } else if ( (*p) > 57 ) {
560
- if ( (*p) > 90 ) {
561
- if ( 97 <= (*p) && (*p) <= 122 )
562
- goto st24;
563
- } else if ( (*p) >= 65 )
564
- goto st24;
565
- } else
566
- goto st24;
567
- goto st0;
568
- tr7:
569
- #line 34 "http11_parser.rl"
570
- {MARK(mark, p); }
571
- goto st25;
572
- st25:
573
- if ( ++p == pe )
574
- goto _out25;
575
- case 25:
576
- #line 577 "http11_parser.c"
577
- switch( (*p) ) {
578
- case 32: goto tr8;
579
- case 35: goto tr9;
580
- case 37: goto st26;
581
- case 127: goto st0;
582
- }
583
- if ( 0 <= (*p) && (*p) <= 31 )
584
- goto st0;
585
- goto st25;
586
- st26:
587
- if ( ++p == pe )
588
- goto _out26;
589
- case 26:
590
- if ( (*p) < 65 ) {
591
- if ( 48 <= (*p) && (*p) <= 57 )
592
- goto st27;
593
- } else if ( (*p) > 70 ) {
594
- if ( 97 <= (*p) && (*p) <= 102 )
595
- goto st27;
596
- } else
597
- goto st27;
598
- goto st0;
599
- st27:
600
- if ( ++p == pe )
601
- goto _out27;
602
- case 27:
603
- if ( (*p) < 65 ) {
604
- if ( 48 <= (*p) && (*p) <= 57 )
605
- goto st25;
606
- } else if ( (*p) > 70 ) {
607
- if ( 97 <= (*p) && (*p) <= 102 )
608
- goto st25;
609
- } else
610
- goto st25;
611
- goto st0;
612
- tr6:
613
- #line 34 "http11_parser.rl"
614
- {MARK(mark, p); }
615
- goto st28;
616
- st28:
617
- if ( ++p == pe )
618
- goto _out28;
619
- case 28:
620
- #line 621 "http11_parser.c"
621
- switch( (*p) ) {
622
- case 32: goto tr40;
623
- case 35: goto tr41;
624
- case 37: goto st29;
625
- case 59: goto tr43;
626
- case 63: goto tr44;
627
- case 127: goto st0;
628
- }
629
- if ( 0 <= (*p) && (*p) <= 31 )
630
- goto st0;
631
- goto st28;
632
- st29:
633
- if ( ++p == pe )
634
- goto _out29;
635
- case 29:
636
- if ( (*p) < 65 ) {
637
- if ( 48 <= (*p) && (*p) <= 57 )
638
- goto st30;
639
- } else if ( (*p) > 70 ) {
640
- if ( 97 <= (*p) && (*p) <= 102 )
641
- goto st30;
642
- } else
643
- goto st30;
644
- goto st0;
645
- st30:
646
- if ( ++p == pe )
647
- goto _out30;
648
- case 30:
649
- if ( (*p) < 65 ) {
650
- if ( 48 <= (*p) && (*p) <= 57 )
651
- goto st28;
652
- } else if ( (*p) > 70 ) {
653
- if ( 97 <= (*p) && (*p) <= 102 )
654
- goto st28;
655
- } else
656
- goto st28;
657
- goto st0;
658
- tr43:
659
- #line 73 "http11_parser.rl"
660
- {
661
- if(parser->request_path != NULL)
662
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
663
- }
664
- goto st31;
665
- st31:
666
- if ( ++p == pe )
667
- goto _out31;
668
- case 31:
669
- #line 670 "http11_parser.c"
670
- switch( (*p) ) {
671
- case 32: goto tr8;
672
- case 35: goto tr9;
673
- case 37: goto st32;
674
- case 63: goto st34;
675
- case 127: goto st0;
676
- }
677
- if ( 0 <= (*p) && (*p) <= 31 )
678
- goto st0;
679
- goto st31;
680
- st32:
681
- if ( ++p == pe )
682
- goto _out32;
683
- case 32:
684
- if ( (*p) < 65 ) {
685
- if ( 48 <= (*p) && (*p) <= 57 )
686
- goto st33;
687
- } else if ( (*p) > 70 ) {
688
- if ( 97 <= (*p) && (*p) <= 102 )
689
- goto st33;
690
- } else
691
- goto st33;
692
- goto st0;
693
- st33:
694
- if ( ++p == pe )
695
- goto _out33;
696
- case 33:
697
- if ( (*p) < 65 ) {
698
- if ( 48 <= (*p) && (*p) <= 57 )
699
- goto st31;
700
- } else if ( (*p) > 70 ) {
701
- if ( 97 <= (*p) && (*p) <= 102 )
702
- goto st31;
703
- } else
704
- goto st31;
705
- goto st0;
706
- tr44:
707
- #line 73 "http11_parser.rl"
708
- {
709
- if(parser->request_path != NULL)
710
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
711
- }
712
- goto st34;
713
- st34:
714
- if ( ++p == pe )
715
- goto _out34;
716
- case 34:
717
- #line 718 "http11_parser.c"
718
- switch( (*p) ) {
719
- case 32: goto tr51;
720
- case 35: goto tr52;
721
- case 37: goto tr53;
722
- case 127: goto st0;
723
- }
724
- if ( 0 <= (*p) && (*p) <= 31 )
725
- goto st0;
726
- goto tr50;
727
- tr50:
728
- #line 62 "http11_parser.rl"
729
- {MARK(query_start, p); }
730
- goto st35;
731
- st35:
732
- if ( ++p == pe )
733
- goto _out35;
734
- case 35:
735
- #line 736 "http11_parser.c"
736
- switch( (*p) ) {
737
- case 32: goto tr55;
738
- case 35: goto tr56;
739
- case 37: goto st36;
740
- case 127: goto st0;
741
- }
742
- if ( 0 <= (*p) && (*p) <= 31 )
743
- goto st0;
744
- goto st35;
745
- tr53:
746
- #line 62 "http11_parser.rl"
747
- {MARK(query_start, p); }
748
- goto st36;
749
- st36:
750
- if ( ++p == pe )
751
- goto _out36;
752
- case 36:
753
- #line 754 "http11_parser.c"
754
- if ( (*p) < 65 ) {
755
- if ( 48 <= (*p) && (*p) <= 57 )
756
- goto st37;
757
- } else if ( (*p) > 70 ) {
758
- if ( 97 <= (*p) && (*p) <= 102 )
759
- goto st37;
760
- } else
761
- goto st37;
762
- goto st0;
763
- st37:
764
- if ( ++p == pe )
765
- goto _out37;
766
- case 37:
767
- if ( (*p) < 65 ) {
768
- if ( 48 <= (*p) && (*p) <= 57 )
769
- goto st35;
770
- } else if ( (*p) > 70 ) {
771
- if ( 97 <= (*p) && (*p) <= 102 )
772
- goto st35;
773
- } else
774
- goto st35;
775
- goto st0;
776
- st38:
777
- if ( ++p == pe )
778
- goto _out38;
779
- case 38:
780
- switch( (*p) ) {
781
- case 32: goto tr2;
782
- case 36: goto st39;
783
- case 95: goto st39;
784
- }
785
- if ( (*p) < 48 ) {
786
- if ( 45 <= (*p) && (*p) <= 46 )
787
- goto st39;
788
- } else if ( (*p) > 57 ) {
789
- if ( 65 <= (*p) && (*p) <= 90 )
790
- goto st39;
791
- } else
792
- goto st39;
793
- goto st0;
794
- st39:
795
- if ( ++p == pe )
796
- goto _out39;
797
- case 39:
798
- switch( (*p) ) {
799
- case 32: goto tr2;
800
- case 36: goto st40;
801
- case 95: goto st40;
802
- }
803
- if ( (*p) < 48 ) {
804
- if ( 45 <= (*p) && (*p) <= 46 )
805
- goto st40;
806
- } else if ( (*p) > 57 ) {
807
- if ( 65 <= (*p) && (*p) <= 90 )
808
- goto st40;
809
- } else
810
- goto st40;
811
- goto st0;
812
- st40:
813
- if ( ++p == pe )
814
- goto _out40;
815
- case 40:
816
- switch( (*p) ) {
817
- case 32: goto tr2;
818
- case 36: goto st41;
819
- case 95: goto st41;
820
- }
821
- if ( (*p) < 48 ) {
822
- if ( 45 <= (*p) && (*p) <= 46 )
823
- goto st41;
824
- } else if ( (*p) > 57 ) {
825
- if ( 65 <= (*p) && (*p) <= 90 )
826
- goto st41;
827
- } else
828
- goto st41;
829
- goto st0;
830
- st41:
831
- if ( ++p == pe )
832
- goto _out41;
833
- case 41:
834
- switch( (*p) ) {
835
- case 32: goto tr2;
836
- case 36: goto st42;
837
- case 95: goto st42;
838
- }
839
- if ( (*p) < 48 ) {
840
- if ( 45 <= (*p) && (*p) <= 46 )
841
- goto st42;
842
- } else if ( (*p) > 57 ) {
843
- if ( 65 <= (*p) && (*p) <= 90 )
844
- goto st42;
845
- } else
846
- goto st42;
847
- goto st0;
848
- st42:
849
- if ( ++p == pe )
850
- goto _out42;
851
- case 42:
852
- switch( (*p) ) {
853
- case 32: goto tr2;
854
- case 36: goto st43;
855
- case 95: goto st43;
856
- }
857
- if ( (*p) < 48 ) {
858
- if ( 45 <= (*p) && (*p) <= 46 )
859
- goto st43;
860
- } else if ( (*p) > 57 ) {
861
- if ( 65 <= (*p) && (*p) <= 90 )
862
- goto st43;
863
- } else
864
- goto st43;
865
- goto st0;
866
- st43:
867
- if ( ++p == pe )
868
- goto _out43;
869
- case 43:
870
- switch( (*p) ) {
871
- case 32: goto tr2;
872
- case 36: goto st44;
873
- case 95: goto st44;
874
- }
875
- if ( (*p) < 48 ) {
876
- if ( 45 <= (*p) && (*p) <= 46 )
877
- goto st44;
878
- } else if ( (*p) > 57 ) {
879
- if ( 65 <= (*p) && (*p) <= 90 )
880
- goto st44;
881
- } else
882
- goto st44;
883
- goto st0;
884
- st44:
885
- if ( ++p == pe )
886
- goto _out44;
887
- case 44:
888
- switch( (*p) ) {
889
- case 32: goto tr2;
890
- case 36: goto st45;
891
- case 95: goto st45;
892
- }
893
- if ( (*p) < 48 ) {
894
- if ( 45 <= (*p) && (*p) <= 46 )
895
- goto st45;
896
- } else if ( (*p) > 57 ) {
897
- if ( 65 <= (*p) && (*p) <= 90 )
898
- goto st45;
899
- } else
900
- goto st45;
901
- goto st0;
902
- st45:
903
- if ( ++p == pe )
904
- goto _out45;
905
- case 45:
906
- switch( (*p) ) {
907
- case 32: goto tr2;
908
- case 36: goto st46;
909
- case 95: goto st46;
910
- }
911
- if ( (*p) < 48 ) {
912
- if ( 45 <= (*p) && (*p) <= 46 )
913
- goto st46;
914
- } else if ( (*p) > 57 ) {
915
- if ( 65 <= (*p) && (*p) <= 90 )
916
- goto st46;
917
- } else
918
- goto st46;
919
- goto st0;
920
- st46:
921
- if ( ++p == pe )
922
- goto _out46;
923
- case 46:
924
- switch( (*p) ) {
925
- case 32: goto tr2;
926
- case 36: goto st47;
927
- case 95: goto st47;
928
- }
929
- if ( (*p) < 48 ) {
930
- if ( 45 <= (*p) && (*p) <= 46 )
931
- goto st47;
932
- } else if ( (*p) > 57 ) {
933
- if ( 65 <= (*p) && (*p) <= 90 )
934
- goto st47;
935
- } else
936
- goto st47;
937
- goto st0;
938
- st47:
939
- if ( ++p == pe )
940
- goto _out47;
941
- case 47:
942
- switch( (*p) ) {
943
- case 32: goto tr2;
944
- case 36: goto st48;
945
- case 95: goto st48;
946
- }
947
- if ( (*p) < 48 ) {
948
- if ( 45 <= (*p) && (*p) <= 46 )
949
- goto st48;
950
- } else if ( (*p) > 57 ) {
951
- if ( 65 <= (*p) && (*p) <= 90 )
952
- goto st48;
953
- } else
954
- goto st48;
955
- goto st0;
956
- st48:
957
- if ( ++p == pe )
958
- goto _out48;
959
- case 48:
960
- switch( (*p) ) {
961
- case 32: goto tr2;
962
- case 36: goto st49;
963
- case 95: goto st49;
964
- }
965
- if ( (*p) < 48 ) {
966
- if ( 45 <= (*p) && (*p) <= 46 )
967
- goto st49;
968
- } else if ( (*p) > 57 ) {
969
- if ( 65 <= (*p) && (*p) <= 90 )
970
- goto st49;
971
- } else
972
- goto st49;
973
- goto st0;
974
- st49:
975
- if ( ++p == pe )
976
- goto _out49;
977
- case 49:
978
- switch( (*p) ) {
979
- case 32: goto tr2;
980
- case 36: goto st50;
981
- case 95: goto st50;
982
- }
983
- if ( (*p) < 48 ) {
984
- if ( 45 <= (*p) && (*p) <= 46 )
985
- goto st50;
986
- } else if ( (*p) > 57 ) {
987
- if ( 65 <= (*p) && (*p) <= 90 )
988
- goto st50;
989
- } else
990
- goto st50;
991
- goto st0;
992
- st50:
993
- if ( ++p == pe )
994
- goto _out50;
995
- case 50:
996
- switch( (*p) ) {
997
- case 32: goto tr2;
998
- case 36: goto st51;
999
- case 95: goto st51;
1000
- }
1001
- if ( (*p) < 48 ) {
1002
- if ( 45 <= (*p) && (*p) <= 46 )
1003
- goto st51;
1004
- } else if ( (*p) > 57 ) {
1005
- if ( 65 <= (*p) && (*p) <= 90 )
1006
- goto st51;
1007
- } else
1008
- goto st51;
1009
- goto st0;
1010
- st51:
1011
- if ( ++p == pe )
1012
- goto _out51;
1013
- case 51:
1014
- switch( (*p) ) {
1015
- case 32: goto tr2;
1016
- case 36: goto st52;
1017
- case 95: goto st52;
1018
- }
1019
- if ( (*p) < 48 ) {
1020
- if ( 45 <= (*p) && (*p) <= 46 )
1021
- goto st52;
1022
- } else if ( (*p) > 57 ) {
1023
- if ( 65 <= (*p) && (*p) <= 90 )
1024
- goto st52;
1025
- } else
1026
- goto st52;
1027
- goto st0;
1028
- st52:
1029
- if ( ++p == pe )
1030
- goto _out52;
1031
- case 52:
1032
- switch( (*p) ) {
1033
- case 32: goto tr2;
1034
- case 36: goto st53;
1035
- case 95: goto st53;
1036
- }
1037
- if ( (*p) < 48 ) {
1038
- if ( 45 <= (*p) && (*p) <= 46 )
1039
- goto st53;
1040
- } else if ( (*p) > 57 ) {
1041
- if ( 65 <= (*p) && (*p) <= 90 )
1042
- goto st53;
1043
- } else
1044
- goto st53;
1045
- goto st0;
1046
- st53:
1047
- if ( ++p == pe )
1048
- goto _out53;
1049
- case 53:
1050
- switch( (*p) ) {
1051
- case 32: goto tr2;
1052
- case 36: goto st54;
1053
- case 95: goto st54;
1054
- }
1055
- if ( (*p) < 48 ) {
1056
- if ( 45 <= (*p) && (*p) <= 46 )
1057
- goto st54;
1058
- } else if ( (*p) > 57 ) {
1059
- if ( 65 <= (*p) && (*p) <= 90 )
1060
- goto st54;
1061
- } else
1062
- goto st54;
1063
- goto st0;
1064
- st54:
1065
- if ( ++p == pe )
1066
- goto _out54;
1067
- case 54:
1068
- switch( (*p) ) {
1069
- case 32: goto tr2;
1070
- case 36: goto st55;
1071
- case 95: goto st55;
1072
- }
1073
- if ( (*p) < 48 ) {
1074
- if ( 45 <= (*p) && (*p) <= 46 )
1075
- goto st55;
1076
- } else if ( (*p) > 57 ) {
1077
- if ( 65 <= (*p) && (*p) <= 90 )
1078
- goto st55;
1079
- } else
1080
- goto st55;
1081
- goto st0;
1082
- st55:
1083
- if ( ++p == pe )
1084
- goto _out55;
1085
- case 55:
1086
- switch( (*p) ) {
1087
- case 32: goto tr2;
1088
- case 36: goto st56;
1089
- case 95: goto st56;
1090
- }
1091
- if ( (*p) < 48 ) {
1092
- if ( 45 <= (*p) && (*p) <= 46 )
1093
- goto st56;
1094
- } else if ( (*p) > 57 ) {
1095
- if ( 65 <= (*p) && (*p) <= 90 )
1096
- goto st56;
1097
- } else
1098
- goto st56;
1099
- goto st0;
1100
- st56:
1101
- if ( ++p == pe )
1102
- goto _out56;
1103
- case 56:
1104
- if ( (*p) == 32 )
1105
- goto tr2;
1106
- goto st0;
1107
- }
1108
- _out0: cs = 0; goto _out;
1109
- _out2: cs = 2; goto _out;
1110
- _out3: cs = 3; goto _out;
1111
- _out4: cs = 4; goto _out;
1112
- _out5: cs = 5; goto _out;
1113
- _out6: cs = 6; goto _out;
1114
- _out7: cs = 7; goto _out;
1115
- _out8: cs = 8; goto _out;
1116
- _out9: cs = 9; goto _out;
1117
- _out10: cs = 10; goto _out;
1118
- _out11: cs = 11; goto _out;
1119
- _out12: cs = 12; goto _out;
1120
- _out13: cs = 13; goto _out;
1121
- _out14: cs = 14; goto _out;
1122
- _out15: cs = 15; goto _out;
1123
- _out16: cs = 16; goto _out;
1124
- _out57: cs = 57; goto _out;
1125
- _out17: cs = 17; goto _out;
1126
- _out18: cs = 18; goto _out;
1127
- _out19: cs = 19; goto _out;
1128
- _out20: cs = 20; goto _out;
1129
- _out21: cs = 21; goto _out;
1130
- _out22: cs = 22; goto _out;
1131
- _out23: cs = 23; goto _out;
1132
- _out24: cs = 24; goto _out;
1133
- _out25: cs = 25; goto _out;
1134
- _out26: cs = 26; goto _out;
1135
- _out27: cs = 27; goto _out;
1136
- _out28: cs = 28; goto _out;
1137
- _out29: cs = 29; goto _out;
1138
- _out30: cs = 30; goto _out;
1139
- _out31: cs = 31; goto _out;
1140
- _out32: cs = 32; goto _out;
1141
- _out33: cs = 33; goto _out;
1142
- _out34: cs = 34; goto _out;
1143
- _out35: cs = 35; goto _out;
1144
- _out36: cs = 36; goto _out;
1145
- _out37: cs = 37; goto _out;
1146
- _out38: cs = 38; goto _out;
1147
- _out39: cs = 39; goto _out;
1148
- _out40: cs = 40; goto _out;
1149
- _out41: cs = 41; goto _out;
1150
- _out42: cs = 42; goto _out;
1151
- _out43: cs = 43; goto _out;
1152
- _out44: cs = 44; goto _out;
1153
- _out45: cs = 45; goto _out;
1154
- _out46: cs = 46; goto _out;
1155
- _out47: cs = 47; goto _out;
1156
- _out48: cs = 48; goto _out;
1157
- _out49: cs = 49; goto _out;
1158
- _out50: cs = 50; goto _out;
1159
- _out51: cs = 51; goto _out;
1160
- _out52: cs = 52; goto _out;
1161
- _out53: cs = 53; goto _out;
1162
- _out54: cs = 54; goto _out;
1163
- _out55: cs = 55; goto _out;
1164
- _out56: cs = 56; goto _out;
1165
-
1166
- _out: {}
1167
- }
1168
- #line 122 "http11_parser.rl"
1169
-
1170
- parser->cs = cs;
1171
- parser->nread += p - (buffer + off);
1172
-
1173
- assert(p <= pe && "buffer overflow after parsing execute");
1174
- assert(parser->nread <= len && "nread longer than length");
1175
- assert(parser->body_start <= len && "body starts after buffer end");
1176
- assert(parser->mark < len && "mark is after buffer end");
1177
- assert(parser->field_len <= len && "field has length longer than whole buffer");
1178
- assert(parser->field_start < len && "field starts after buffer end");
1179
-
1180
- if(parser->body_start) {
1181
- /* final \r\n combo encountered so stop right here */
1182
-
1183
- #line 1184 "http11_parser.c"
1184
- #line 136 "http11_parser.rl"
1185
- parser->nread++;
1186
- }
1187
-
1188
- return(parser->nread);
1189
- }
1190
-
1191
- int http_parser_finish(http_parser *parser)
1192
- {
1193
- int cs = parser->cs;
1194
-
1195
-
1196
- #line 1197 "http11_parser.c"
1197
- #line 147 "http11_parser.rl"
1198
-
1199
- parser->cs = cs;
1200
-
1201
- if (http_parser_has_error(parser) ) {
1202
- return -1;
1203
- } else if (http_parser_is_finished(parser) ) {
1204
- return 1;
1205
- } else {
1206
- return 0;
1207
- }
1208
- }
1209
-
1210
- int http_parser_has_error(http_parser *parser) {
1211
- return parser->cs == http_parser_error;
1212
- }
1213
-
1214
- int http_parser_is_finished(http_parser *parser) {
1215
- return parser->cs == http_parser_first_final;
1216
- }
1
+ #line 1 "http11_parser.rl"
2
+ /**
3
+ * Copyright (c) 2005 Zed A. Shaw
4
+ * You can redistribute it and/or modify it under the same terms as Ruby.
5
+ */
6
+ #include "http11_parser.h"
7
+ #include <stdio.h>
8
+ #include <assert.h>
9
+ #include <stdlib.h>
10
+ #include <ctype.h>
11
+ #include <string.h>
12
+
13
+ /*
14
+ * capitalizes all lower-case ASCII characters,
15
+ * converts dashes to underscores.
16
+ */
17
+ static void snake_upcase_char(char *c)
18
+ {
19
+ if (*c >= 'a' && *c <= 'z')
20
+ *c &= ~0x20;
21
+ else if (*c == '-')
22
+ *c = '_';
23
+ }
24
+
25
+ #define LEN(AT, FPC) (FPC - buffer - parser->AT)
26
+ #define MARK(M,FPC) (parser->M = (FPC) - buffer)
27
+ #define PTR_TO(F) (buffer + parser->F)
28
+
29
+ /** Machine **/
30
+
31
+ #line 87 "http11_parser.rl"
32
+
33
+
34
+ /** Data **/
35
+
36
+ #line 37 "http11_parser.c"
37
+ static const int http_parser_start = 1;
38
+ static const int http_parser_first_final = 57;
39
+ static const int http_parser_error = 0;
40
+
41
+ static const int http_parser_en_main = 1;
42
+
43
+ #line 91 "http11_parser.rl"
44
+
45
+ int http_parser_init(http_parser *parser) {
46
+ int cs = 0;
47
+
48
+ #line 49 "http11_parser.c"
49
+ {
50
+ cs = http_parser_start;
51
+ }
52
+ #line 95 "http11_parser.rl"
53
+ parser->cs = cs;
54
+ parser->body_start = 0;
55
+ parser->content_len = 0;
56
+ parser->mark = 0;
57
+ parser->nread = 0;
58
+ parser->field_len = 0;
59
+ parser->field_start = 0;
60
+
61
+ return(1);
62
+ }
63
+
64
+
65
+ /** exec **/
66
+ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
67
+ const char *p, *pe;
68
+ int cs = parser->cs;
69
+
70
+ assert(off <= len && "offset past end of buffer");
71
+
72
+ p = buffer+off;
73
+ pe = buffer+len;
74
+
75
+ assert(*pe == '\0' && "pointer does not end on NUL");
76
+ assert(pe - p == len - off && "pointers aren't same distance");
77
+
78
+
79
+
80
+ #line 81 "http11_parser.c"
81
+ {
82
+ if ( p == pe )
83
+ goto _out;
84
+ switch ( cs )
85
+ {
86
+ case 1:
87
+ switch( (*p) ) {
88
+ case 36: goto tr0;
89
+ case 95: goto tr0;
90
+ }
91
+ if ( (*p) < 48 ) {
92
+ if ( 45 <= (*p) && (*p) <= 46 )
93
+ goto tr0;
94
+ } else if ( (*p) > 57 ) {
95
+ if ( 65 <= (*p) && (*p) <= 90 )
96
+ goto tr0;
97
+ } else
98
+ goto tr0;
99
+ goto st0;
100
+ st0:
101
+ goto _out0;
102
+ tr0:
103
+ #line 34 "http11_parser.rl"
104
+ {MARK(mark, p); }
105
+ goto st2;
106
+ st2:
107
+ if ( ++p == pe )
108
+ goto _out2;
109
+ case 2:
110
+ #line 111 "http11_parser.c"
111
+ switch( (*p) ) {
112
+ case 32: goto tr2;
113
+ case 36: goto st38;
114
+ case 95: goto st38;
115
+ }
116
+ if ( (*p) < 48 ) {
117
+ if ( 45 <= (*p) && (*p) <= 46 )
118
+ goto st38;
119
+ } else if ( (*p) > 57 ) {
120
+ if ( 65 <= (*p) && (*p) <= 90 )
121
+ goto st38;
122
+ } else
123
+ goto st38;
124
+ goto st0;
125
+ tr2:
126
+ #line 49 "http11_parser.rl"
127
+ {
128
+ if(parser->request_method != NULL)
129
+ parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
130
+ }
131
+ goto st3;
132
+ st3:
133
+ if ( ++p == pe )
134
+ goto _out3;
135
+ case 3:
136
+ #line 137 "http11_parser.c"
137
+ switch( (*p) ) {
138
+ case 42: goto tr4;
139
+ case 43: goto tr5;
140
+ case 47: goto tr6;
141
+ case 58: goto tr7;
142
+ }
143
+ if ( (*p) < 65 ) {
144
+ if ( 45 <= (*p) && (*p) <= 57 )
145
+ goto tr5;
146
+ } else if ( (*p) > 90 ) {
147
+ if ( 97 <= (*p) && (*p) <= 122 )
148
+ goto tr5;
149
+ } else
150
+ goto tr5;
151
+ goto st0;
152
+ tr4:
153
+ #line 34 "http11_parser.rl"
154
+ {MARK(mark, p); }
155
+ goto st4;
156
+ st4:
157
+ if ( ++p == pe )
158
+ goto _out4;
159
+ case 4:
160
+ #line 161 "http11_parser.c"
161
+ switch( (*p) ) {
162
+ case 32: goto tr8;
163
+ case 35: goto tr9;
164
+ }
165
+ goto st0;
166
+ tr8:
167
+ #line 53 "http11_parser.rl"
168
+ {
169
+ if(parser->request_uri != NULL)
170
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
171
+ }
172
+ goto st5;
173
+ tr30:
174
+ #line 57 "http11_parser.rl"
175
+ {
176
+ if(parser->fragment != NULL)
177
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
178
+ }
179
+ goto st5;
180
+ tr40:
181
+ #line 73 "http11_parser.rl"
182
+ {
183
+ if(parser->request_path != NULL)
184
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
185
+ }
186
+ #line 53 "http11_parser.rl"
187
+ {
188
+ if(parser->request_uri != NULL)
189
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
190
+ }
191
+ goto st5;
192
+ tr51:
193
+ #line 62 "http11_parser.rl"
194
+ {MARK(query_start, p); }
195
+ #line 63 "http11_parser.rl"
196
+ {
197
+ if(parser->query_string != NULL)
198
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
199
+ }
200
+ #line 53 "http11_parser.rl"
201
+ {
202
+ if(parser->request_uri != NULL)
203
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
204
+ }
205
+ goto st5;
206
+ tr55:
207
+ #line 63 "http11_parser.rl"
208
+ {
209
+ if(parser->query_string != NULL)
210
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
211
+ }
212
+ #line 53 "http11_parser.rl"
213
+ {
214
+ if(parser->request_uri != NULL)
215
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
216
+ }
217
+ goto st5;
218
+ st5:
219
+ if ( ++p == pe )
220
+ goto _out5;
221
+ case 5:
222
+ #line 223 "http11_parser.c"
223
+ if ( (*p) == 72 )
224
+ goto tr10;
225
+ goto st0;
226
+ tr10:
227
+ #line 34 "http11_parser.rl"
228
+ {MARK(mark, p); }
229
+ goto st6;
230
+ st6:
231
+ if ( ++p == pe )
232
+ goto _out6;
233
+ case 6:
234
+ #line 235 "http11_parser.c"
235
+ if ( (*p) == 84 )
236
+ goto st7;
237
+ goto st0;
238
+ st7:
239
+ if ( ++p == pe )
240
+ goto _out7;
241
+ case 7:
242
+ if ( (*p) == 84 )
243
+ goto st8;
244
+ goto st0;
245
+ st8:
246
+ if ( ++p == pe )
247
+ goto _out8;
248
+ case 8:
249
+ if ( (*p) == 80 )
250
+ goto st9;
251
+ goto st0;
252
+ st9:
253
+ if ( ++p == pe )
254
+ goto _out9;
255
+ case 9:
256
+ if ( (*p) == 47 )
257
+ goto st10;
258
+ goto st0;
259
+ st10:
260
+ if ( ++p == pe )
261
+ goto _out10;
262
+ case 10:
263
+ if ( 48 <= (*p) && (*p) <= 57 )
264
+ goto st11;
265
+ goto st0;
266
+ st11:
267
+ if ( ++p == pe )
268
+ goto _out11;
269
+ case 11:
270
+ if ( (*p) == 46 )
271
+ goto st12;
272
+ if ( 48 <= (*p) && (*p) <= 57 )
273
+ goto st11;
274
+ goto st0;
275
+ st12:
276
+ if ( ++p == pe )
277
+ goto _out12;
278
+ case 12:
279
+ if ( 48 <= (*p) && (*p) <= 57 )
280
+ goto st13;
281
+ goto st0;
282
+ st13:
283
+ if ( ++p == pe )
284
+ goto _out13;
285
+ case 13:
286
+ if ( (*p) == 13 )
287
+ goto tr18;
288
+ if ( 48 <= (*p) && (*p) <= 57 )
289
+ goto st13;
290
+ goto st0;
291
+ tr18:
292
+ #line 68 "http11_parser.rl"
293
+ {
294
+ if(parser->http_version != NULL)
295
+ parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
296
+ }
297
+ goto st14;
298
+ tr26:
299
+ #line 44 "http11_parser.rl"
300
+ {
301
+ if(parser->http_field != NULL) {
302
+ parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
303
+ }
304
+ }
305
+ goto st14;
306
+ st14:
307
+ if ( ++p == pe )
308
+ goto _out14;
309
+ case 14:
310
+ #line 311 "http11_parser.c"
311
+ if ( (*p) == 10 )
312
+ goto st15;
313
+ goto st0;
314
+ st15:
315
+ if ( ++p == pe )
316
+ goto _out15;
317
+ case 15:
318
+ switch( (*p) ) {
319
+ case 13: goto st16;
320
+ case 33: goto tr21;
321
+ case 124: goto tr21;
322
+ case 126: goto tr21;
323
+ }
324
+ if ( (*p) < 45 ) {
325
+ if ( (*p) > 39 ) {
326
+ if ( 42 <= (*p) && (*p) <= 43 )
327
+ goto tr21;
328
+ } else if ( (*p) >= 35 )
329
+ goto tr21;
330
+ } else if ( (*p) > 46 ) {
331
+ if ( (*p) < 65 ) {
332
+ if ( 48 <= (*p) && (*p) <= 57 )
333
+ goto tr21;
334
+ } else if ( (*p) > 90 ) {
335
+ if ( 94 <= (*p) && (*p) <= 122 )
336
+ goto tr21;
337
+ } else
338
+ goto tr21;
339
+ } else
340
+ goto tr21;
341
+ goto st0;
342
+ st16:
343
+ if ( ++p == pe )
344
+ goto _out16;
345
+ case 16:
346
+ if ( (*p) == 10 )
347
+ goto tr22;
348
+ goto st0;
349
+ tr22:
350
+ #line 78 "http11_parser.rl"
351
+ {
352
+ parser->body_start = p - buffer + 1;
353
+ if(parser->header_done != NULL)
354
+ parser->header_done(parser->data, p + 1, pe - p - 1);
355
+ goto _out57;
356
+ }
357
+ goto st57;
358
+ st57:
359
+ if ( ++p == pe )
360
+ goto _out57;
361
+ case 57:
362
+ #line 363 "http11_parser.c"
363
+ goto st0;
364
+ tr21:
365
+ #line 37 "http11_parser.rl"
366
+ { MARK(field_start, p); }
367
+ #line 38 "http11_parser.rl"
368
+ { snake_upcase_char((char *)p); }
369
+ goto st17;
370
+ tr23:
371
+ #line 38 "http11_parser.rl"
372
+ { snake_upcase_char((char *)p); }
373
+ goto st17;
374
+ st17:
375
+ if ( ++p == pe )
376
+ goto _out17;
377
+ case 17:
378
+ #line 379 "http11_parser.c"
379
+ switch( (*p) ) {
380
+ case 33: goto tr23;
381
+ case 58: goto tr24;
382
+ case 124: goto tr23;
383
+ case 126: goto tr23;
384
+ }
385
+ if ( (*p) < 45 ) {
386
+ if ( (*p) > 39 ) {
387
+ if ( 42 <= (*p) && (*p) <= 43 )
388
+ goto tr23;
389
+ } else if ( (*p) >= 35 )
390
+ goto tr23;
391
+ } else if ( (*p) > 46 ) {
392
+ if ( (*p) < 65 ) {
393
+ if ( 48 <= (*p) && (*p) <= 57 )
394
+ goto tr23;
395
+ } else if ( (*p) > 90 ) {
396
+ if ( 94 <= (*p) && (*p) <= 122 )
397
+ goto tr23;
398
+ } else
399
+ goto tr23;
400
+ } else
401
+ goto tr23;
402
+ goto st0;
403
+ tr24:
404
+ #line 39 "http11_parser.rl"
405
+ {
406
+ parser->field_len = LEN(field_start, p);
407
+ }
408
+ goto st18;
409
+ tr27:
410
+ #line 43 "http11_parser.rl"
411
+ { MARK(mark, p); }
412
+ goto st18;
413
+ st18:
414
+ if ( ++p == pe )
415
+ goto _out18;
416
+ case 18:
417
+ #line 418 "http11_parser.c"
418
+ switch( (*p) ) {
419
+ case 13: goto tr26;
420
+ case 32: goto tr27;
421
+ }
422
+ goto tr25;
423
+ tr25:
424
+ #line 43 "http11_parser.rl"
425
+ { MARK(mark, p); }
426
+ goto st19;
427
+ st19:
428
+ if ( ++p == pe )
429
+ goto _out19;
430
+ case 19:
431
+ #line 432 "http11_parser.c"
432
+ if ( (*p) == 13 )
433
+ goto tr26;
434
+ goto st19;
435
+ tr9:
436
+ #line 53 "http11_parser.rl"
437
+ {
438
+ if(parser->request_uri != NULL)
439
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
440
+ }
441
+ goto st20;
442
+ tr41:
443
+ #line 73 "http11_parser.rl"
444
+ {
445
+ if(parser->request_path != NULL)
446
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
447
+ }
448
+ #line 53 "http11_parser.rl"
449
+ {
450
+ if(parser->request_uri != NULL)
451
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
452
+ }
453
+ goto st20;
454
+ tr52:
455
+ #line 62 "http11_parser.rl"
456
+ {MARK(query_start, p); }
457
+ #line 63 "http11_parser.rl"
458
+ {
459
+ if(parser->query_string != NULL)
460
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
461
+ }
462
+ #line 53 "http11_parser.rl"
463
+ {
464
+ if(parser->request_uri != NULL)
465
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
466
+ }
467
+ goto st20;
468
+ tr56:
469
+ #line 63 "http11_parser.rl"
470
+ {
471
+ if(parser->query_string != NULL)
472
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
473
+ }
474
+ #line 53 "http11_parser.rl"
475
+ {
476
+ if(parser->request_uri != NULL)
477
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
478
+ }
479
+ goto st20;
480
+ st20:
481
+ if ( ++p == pe )
482
+ goto _out20;
483
+ case 20:
484
+ #line 485 "http11_parser.c"
485
+ switch( (*p) ) {
486
+ case 32: goto tr30;
487
+ case 35: goto st0;
488
+ case 37: goto tr31;
489
+ case 127: goto st0;
490
+ }
491
+ if ( 0 <= (*p) && (*p) <= 31 )
492
+ goto st0;
493
+ goto tr29;
494
+ tr29:
495
+ #line 34 "http11_parser.rl"
496
+ {MARK(mark, p); }
497
+ goto st21;
498
+ st21:
499
+ if ( ++p == pe )
500
+ goto _out21;
501
+ case 21:
502
+ #line 503 "http11_parser.c"
503
+ switch( (*p) ) {
504
+ case 32: goto tr30;
505
+ case 35: goto st0;
506
+ case 37: goto st22;
507
+ case 127: goto st0;
508
+ }
509
+ if ( 0 <= (*p) && (*p) <= 31 )
510
+ goto st0;
511
+ goto st21;
512
+ tr31:
513
+ #line 34 "http11_parser.rl"
514
+ {MARK(mark, p); }
515
+ goto st22;
516
+ st22:
517
+ if ( ++p == pe )
518
+ goto _out22;
519
+ case 22:
520
+ #line 521 "http11_parser.c"
521
+ if ( (*p) < 65 ) {
522
+ if ( 48 <= (*p) && (*p) <= 57 )
523
+ goto st23;
524
+ } else if ( (*p) > 70 ) {
525
+ if ( 97 <= (*p) && (*p) <= 102 )
526
+ goto st23;
527
+ } else
528
+ goto st23;
529
+ goto st0;
530
+ st23:
531
+ if ( ++p == pe )
532
+ goto _out23;
533
+ case 23:
534
+ if ( (*p) < 65 ) {
535
+ if ( 48 <= (*p) && (*p) <= 57 )
536
+ goto st21;
537
+ } else if ( (*p) > 70 ) {
538
+ if ( 97 <= (*p) && (*p) <= 102 )
539
+ goto st21;
540
+ } else
541
+ goto st21;
542
+ goto st0;
543
+ tr5:
544
+ #line 34 "http11_parser.rl"
545
+ {MARK(mark, p); }
546
+ goto st24;
547
+ st24:
548
+ if ( ++p == pe )
549
+ goto _out24;
550
+ case 24:
551
+ #line 552 "http11_parser.c"
552
+ switch( (*p) ) {
553
+ case 43: goto st24;
554
+ case 58: goto st25;
555
+ }
556
+ if ( (*p) < 48 ) {
557
+ if ( 45 <= (*p) && (*p) <= 46 )
558
+ goto st24;
559
+ } else if ( (*p) > 57 ) {
560
+ if ( (*p) > 90 ) {
561
+ if ( 97 <= (*p) && (*p) <= 122 )
562
+ goto st24;
563
+ } else if ( (*p) >= 65 )
564
+ goto st24;
565
+ } else
566
+ goto st24;
567
+ goto st0;
568
+ tr7:
569
+ #line 34 "http11_parser.rl"
570
+ {MARK(mark, p); }
571
+ goto st25;
572
+ st25:
573
+ if ( ++p == pe )
574
+ goto _out25;
575
+ case 25:
576
+ #line 577 "http11_parser.c"
577
+ switch( (*p) ) {
578
+ case 32: goto tr8;
579
+ case 35: goto tr9;
580
+ case 37: goto st26;
581
+ case 127: goto st0;
582
+ }
583
+ if ( 0 <= (*p) && (*p) <= 31 )
584
+ goto st0;
585
+ goto st25;
586
+ st26:
587
+ if ( ++p == pe )
588
+ goto _out26;
589
+ case 26:
590
+ if ( (*p) < 65 ) {
591
+ if ( 48 <= (*p) && (*p) <= 57 )
592
+ goto st27;
593
+ } else if ( (*p) > 70 ) {
594
+ if ( 97 <= (*p) && (*p) <= 102 )
595
+ goto st27;
596
+ } else
597
+ goto st27;
598
+ goto st0;
599
+ st27:
600
+ if ( ++p == pe )
601
+ goto _out27;
602
+ case 27:
603
+ if ( (*p) < 65 ) {
604
+ if ( 48 <= (*p) && (*p) <= 57 )
605
+ goto st25;
606
+ } else if ( (*p) > 70 ) {
607
+ if ( 97 <= (*p) && (*p) <= 102 )
608
+ goto st25;
609
+ } else
610
+ goto st25;
611
+ goto st0;
612
+ tr6:
613
+ #line 34 "http11_parser.rl"
614
+ {MARK(mark, p); }
615
+ goto st28;
616
+ st28:
617
+ if ( ++p == pe )
618
+ goto _out28;
619
+ case 28:
620
+ #line 621 "http11_parser.c"
621
+ switch( (*p) ) {
622
+ case 32: goto tr40;
623
+ case 35: goto tr41;
624
+ case 37: goto st29;
625
+ case 59: goto tr43;
626
+ case 63: goto tr44;
627
+ case 127: goto st0;
628
+ }
629
+ if ( 0 <= (*p) && (*p) <= 31 )
630
+ goto st0;
631
+ goto st28;
632
+ st29:
633
+ if ( ++p == pe )
634
+ goto _out29;
635
+ case 29:
636
+ if ( (*p) < 65 ) {
637
+ if ( 48 <= (*p) && (*p) <= 57 )
638
+ goto st30;
639
+ } else if ( (*p) > 70 ) {
640
+ if ( 97 <= (*p) && (*p) <= 102 )
641
+ goto st30;
642
+ } else
643
+ goto st30;
644
+ goto st0;
645
+ st30:
646
+ if ( ++p == pe )
647
+ goto _out30;
648
+ case 30:
649
+ if ( (*p) < 65 ) {
650
+ if ( 48 <= (*p) && (*p) <= 57 )
651
+ goto st28;
652
+ } else if ( (*p) > 70 ) {
653
+ if ( 97 <= (*p) && (*p) <= 102 )
654
+ goto st28;
655
+ } else
656
+ goto st28;
657
+ goto st0;
658
+ tr43:
659
+ #line 73 "http11_parser.rl"
660
+ {
661
+ if(parser->request_path != NULL)
662
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
663
+ }
664
+ goto st31;
665
+ st31:
666
+ if ( ++p == pe )
667
+ goto _out31;
668
+ case 31:
669
+ #line 670 "http11_parser.c"
670
+ switch( (*p) ) {
671
+ case 32: goto tr8;
672
+ case 35: goto tr9;
673
+ case 37: goto st32;
674
+ case 63: goto st34;
675
+ case 127: goto st0;
676
+ }
677
+ if ( 0 <= (*p) && (*p) <= 31 )
678
+ goto st0;
679
+ goto st31;
680
+ st32:
681
+ if ( ++p == pe )
682
+ goto _out32;
683
+ case 32:
684
+ if ( (*p) < 65 ) {
685
+ if ( 48 <= (*p) && (*p) <= 57 )
686
+ goto st33;
687
+ } else if ( (*p) > 70 ) {
688
+ if ( 97 <= (*p) && (*p) <= 102 )
689
+ goto st33;
690
+ } else
691
+ goto st33;
692
+ goto st0;
693
+ st33:
694
+ if ( ++p == pe )
695
+ goto _out33;
696
+ case 33:
697
+ if ( (*p) < 65 ) {
698
+ if ( 48 <= (*p) && (*p) <= 57 )
699
+ goto st31;
700
+ } else if ( (*p) > 70 ) {
701
+ if ( 97 <= (*p) && (*p) <= 102 )
702
+ goto st31;
703
+ } else
704
+ goto st31;
705
+ goto st0;
706
+ tr44:
707
+ #line 73 "http11_parser.rl"
708
+ {
709
+ if(parser->request_path != NULL)
710
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
711
+ }
712
+ goto st34;
713
+ st34:
714
+ if ( ++p == pe )
715
+ goto _out34;
716
+ case 34:
717
+ #line 718 "http11_parser.c"
718
+ switch( (*p) ) {
719
+ case 32: goto tr51;
720
+ case 35: goto tr52;
721
+ case 37: goto tr53;
722
+ case 127: goto st0;
723
+ }
724
+ if ( 0 <= (*p) && (*p) <= 31 )
725
+ goto st0;
726
+ goto tr50;
727
+ tr50:
728
+ #line 62 "http11_parser.rl"
729
+ {MARK(query_start, p); }
730
+ goto st35;
731
+ st35:
732
+ if ( ++p == pe )
733
+ goto _out35;
734
+ case 35:
735
+ #line 736 "http11_parser.c"
736
+ switch( (*p) ) {
737
+ case 32: goto tr55;
738
+ case 35: goto tr56;
739
+ case 37: goto st36;
740
+ case 127: goto st0;
741
+ }
742
+ if ( 0 <= (*p) && (*p) <= 31 )
743
+ goto st0;
744
+ goto st35;
745
+ tr53:
746
+ #line 62 "http11_parser.rl"
747
+ {MARK(query_start, p); }
748
+ goto st36;
749
+ st36:
750
+ if ( ++p == pe )
751
+ goto _out36;
752
+ case 36:
753
+ #line 754 "http11_parser.c"
754
+ if ( (*p) < 65 ) {
755
+ if ( 48 <= (*p) && (*p) <= 57 )
756
+ goto st37;
757
+ } else if ( (*p) > 70 ) {
758
+ if ( 97 <= (*p) && (*p) <= 102 )
759
+ goto st37;
760
+ } else
761
+ goto st37;
762
+ goto st0;
763
+ st37:
764
+ if ( ++p == pe )
765
+ goto _out37;
766
+ case 37:
767
+ if ( (*p) < 65 ) {
768
+ if ( 48 <= (*p) && (*p) <= 57 )
769
+ goto st35;
770
+ } else if ( (*p) > 70 ) {
771
+ if ( 97 <= (*p) && (*p) <= 102 )
772
+ goto st35;
773
+ } else
774
+ goto st35;
775
+ goto st0;
776
+ st38:
777
+ if ( ++p == pe )
778
+ goto _out38;
779
+ case 38:
780
+ switch( (*p) ) {
781
+ case 32: goto tr2;
782
+ case 36: goto st39;
783
+ case 95: goto st39;
784
+ }
785
+ if ( (*p) < 48 ) {
786
+ if ( 45 <= (*p) && (*p) <= 46 )
787
+ goto st39;
788
+ } else if ( (*p) > 57 ) {
789
+ if ( 65 <= (*p) && (*p) <= 90 )
790
+ goto st39;
791
+ } else
792
+ goto st39;
793
+ goto st0;
794
+ st39:
795
+ if ( ++p == pe )
796
+ goto _out39;
797
+ case 39:
798
+ switch( (*p) ) {
799
+ case 32: goto tr2;
800
+ case 36: goto st40;
801
+ case 95: goto st40;
802
+ }
803
+ if ( (*p) < 48 ) {
804
+ if ( 45 <= (*p) && (*p) <= 46 )
805
+ goto st40;
806
+ } else if ( (*p) > 57 ) {
807
+ if ( 65 <= (*p) && (*p) <= 90 )
808
+ goto st40;
809
+ } else
810
+ goto st40;
811
+ goto st0;
812
+ st40:
813
+ if ( ++p == pe )
814
+ goto _out40;
815
+ case 40:
816
+ switch( (*p) ) {
817
+ case 32: goto tr2;
818
+ case 36: goto st41;
819
+ case 95: goto st41;
820
+ }
821
+ if ( (*p) < 48 ) {
822
+ if ( 45 <= (*p) && (*p) <= 46 )
823
+ goto st41;
824
+ } else if ( (*p) > 57 ) {
825
+ if ( 65 <= (*p) && (*p) <= 90 )
826
+ goto st41;
827
+ } else
828
+ goto st41;
829
+ goto st0;
830
+ st41:
831
+ if ( ++p == pe )
832
+ goto _out41;
833
+ case 41:
834
+ switch( (*p) ) {
835
+ case 32: goto tr2;
836
+ case 36: goto st42;
837
+ case 95: goto st42;
838
+ }
839
+ if ( (*p) < 48 ) {
840
+ if ( 45 <= (*p) && (*p) <= 46 )
841
+ goto st42;
842
+ } else if ( (*p) > 57 ) {
843
+ if ( 65 <= (*p) && (*p) <= 90 )
844
+ goto st42;
845
+ } else
846
+ goto st42;
847
+ goto st0;
848
+ st42:
849
+ if ( ++p == pe )
850
+ goto _out42;
851
+ case 42:
852
+ switch( (*p) ) {
853
+ case 32: goto tr2;
854
+ case 36: goto st43;
855
+ case 95: goto st43;
856
+ }
857
+ if ( (*p) < 48 ) {
858
+ if ( 45 <= (*p) && (*p) <= 46 )
859
+ goto st43;
860
+ } else if ( (*p) > 57 ) {
861
+ if ( 65 <= (*p) && (*p) <= 90 )
862
+ goto st43;
863
+ } else
864
+ goto st43;
865
+ goto st0;
866
+ st43:
867
+ if ( ++p == pe )
868
+ goto _out43;
869
+ case 43:
870
+ switch( (*p) ) {
871
+ case 32: goto tr2;
872
+ case 36: goto st44;
873
+ case 95: goto st44;
874
+ }
875
+ if ( (*p) < 48 ) {
876
+ if ( 45 <= (*p) && (*p) <= 46 )
877
+ goto st44;
878
+ } else if ( (*p) > 57 ) {
879
+ if ( 65 <= (*p) && (*p) <= 90 )
880
+ goto st44;
881
+ } else
882
+ goto st44;
883
+ goto st0;
884
+ st44:
885
+ if ( ++p == pe )
886
+ goto _out44;
887
+ case 44:
888
+ switch( (*p) ) {
889
+ case 32: goto tr2;
890
+ case 36: goto st45;
891
+ case 95: goto st45;
892
+ }
893
+ if ( (*p) < 48 ) {
894
+ if ( 45 <= (*p) && (*p) <= 46 )
895
+ goto st45;
896
+ } else if ( (*p) > 57 ) {
897
+ if ( 65 <= (*p) && (*p) <= 90 )
898
+ goto st45;
899
+ } else
900
+ goto st45;
901
+ goto st0;
902
+ st45:
903
+ if ( ++p == pe )
904
+ goto _out45;
905
+ case 45:
906
+ switch( (*p) ) {
907
+ case 32: goto tr2;
908
+ case 36: goto st46;
909
+ case 95: goto st46;
910
+ }
911
+ if ( (*p) < 48 ) {
912
+ if ( 45 <= (*p) && (*p) <= 46 )
913
+ goto st46;
914
+ } else if ( (*p) > 57 ) {
915
+ if ( 65 <= (*p) && (*p) <= 90 )
916
+ goto st46;
917
+ } else
918
+ goto st46;
919
+ goto st0;
920
+ st46:
921
+ if ( ++p == pe )
922
+ goto _out46;
923
+ case 46:
924
+ switch( (*p) ) {
925
+ case 32: goto tr2;
926
+ case 36: goto st47;
927
+ case 95: goto st47;
928
+ }
929
+ if ( (*p) < 48 ) {
930
+ if ( 45 <= (*p) && (*p) <= 46 )
931
+ goto st47;
932
+ } else if ( (*p) > 57 ) {
933
+ if ( 65 <= (*p) && (*p) <= 90 )
934
+ goto st47;
935
+ } else
936
+ goto st47;
937
+ goto st0;
938
+ st47:
939
+ if ( ++p == pe )
940
+ goto _out47;
941
+ case 47:
942
+ switch( (*p) ) {
943
+ case 32: goto tr2;
944
+ case 36: goto st48;
945
+ case 95: goto st48;
946
+ }
947
+ if ( (*p) < 48 ) {
948
+ if ( 45 <= (*p) && (*p) <= 46 )
949
+ goto st48;
950
+ } else if ( (*p) > 57 ) {
951
+ if ( 65 <= (*p) && (*p) <= 90 )
952
+ goto st48;
953
+ } else
954
+ goto st48;
955
+ goto st0;
956
+ st48:
957
+ if ( ++p == pe )
958
+ goto _out48;
959
+ case 48:
960
+ switch( (*p) ) {
961
+ case 32: goto tr2;
962
+ case 36: goto st49;
963
+ case 95: goto st49;
964
+ }
965
+ if ( (*p) < 48 ) {
966
+ if ( 45 <= (*p) && (*p) <= 46 )
967
+ goto st49;
968
+ } else if ( (*p) > 57 ) {
969
+ if ( 65 <= (*p) && (*p) <= 90 )
970
+ goto st49;
971
+ } else
972
+ goto st49;
973
+ goto st0;
974
+ st49:
975
+ if ( ++p == pe )
976
+ goto _out49;
977
+ case 49:
978
+ switch( (*p) ) {
979
+ case 32: goto tr2;
980
+ case 36: goto st50;
981
+ case 95: goto st50;
982
+ }
983
+ if ( (*p) < 48 ) {
984
+ if ( 45 <= (*p) && (*p) <= 46 )
985
+ goto st50;
986
+ } else if ( (*p) > 57 ) {
987
+ if ( 65 <= (*p) && (*p) <= 90 )
988
+ goto st50;
989
+ } else
990
+ goto st50;
991
+ goto st0;
992
+ st50:
993
+ if ( ++p == pe )
994
+ goto _out50;
995
+ case 50:
996
+ switch( (*p) ) {
997
+ case 32: goto tr2;
998
+ case 36: goto st51;
999
+ case 95: goto st51;
1000
+ }
1001
+ if ( (*p) < 48 ) {
1002
+ if ( 45 <= (*p) && (*p) <= 46 )
1003
+ goto st51;
1004
+ } else if ( (*p) > 57 ) {
1005
+ if ( 65 <= (*p) && (*p) <= 90 )
1006
+ goto st51;
1007
+ } else
1008
+ goto st51;
1009
+ goto st0;
1010
+ st51:
1011
+ if ( ++p == pe )
1012
+ goto _out51;
1013
+ case 51:
1014
+ switch( (*p) ) {
1015
+ case 32: goto tr2;
1016
+ case 36: goto st52;
1017
+ case 95: goto st52;
1018
+ }
1019
+ if ( (*p) < 48 ) {
1020
+ if ( 45 <= (*p) && (*p) <= 46 )
1021
+ goto st52;
1022
+ } else if ( (*p) > 57 ) {
1023
+ if ( 65 <= (*p) && (*p) <= 90 )
1024
+ goto st52;
1025
+ } else
1026
+ goto st52;
1027
+ goto st0;
1028
+ st52:
1029
+ if ( ++p == pe )
1030
+ goto _out52;
1031
+ case 52:
1032
+ switch( (*p) ) {
1033
+ case 32: goto tr2;
1034
+ case 36: goto st53;
1035
+ case 95: goto st53;
1036
+ }
1037
+ if ( (*p) < 48 ) {
1038
+ if ( 45 <= (*p) && (*p) <= 46 )
1039
+ goto st53;
1040
+ } else if ( (*p) > 57 ) {
1041
+ if ( 65 <= (*p) && (*p) <= 90 )
1042
+ goto st53;
1043
+ } else
1044
+ goto st53;
1045
+ goto st0;
1046
+ st53:
1047
+ if ( ++p == pe )
1048
+ goto _out53;
1049
+ case 53:
1050
+ switch( (*p) ) {
1051
+ case 32: goto tr2;
1052
+ case 36: goto st54;
1053
+ case 95: goto st54;
1054
+ }
1055
+ if ( (*p) < 48 ) {
1056
+ if ( 45 <= (*p) && (*p) <= 46 )
1057
+ goto st54;
1058
+ } else if ( (*p) > 57 ) {
1059
+ if ( 65 <= (*p) && (*p) <= 90 )
1060
+ goto st54;
1061
+ } else
1062
+ goto st54;
1063
+ goto st0;
1064
+ st54:
1065
+ if ( ++p == pe )
1066
+ goto _out54;
1067
+ case 54:
1068
+ switch( (*p) ) {
1069
+ case 32: goto tr2;
1070
+ case 36: goto st55;
1071
+ case 95: goto st55;
1072
+ }
1073
+ if ( (*p) < 48 ) {
1074
+ if ( 45 <= (*p) && (*p) <= 46 )
1075
+ goto st55;
1076
+ } else if ( (*p) > 57 ) {
1077
+ if ( 65 <= (*p) && (*p) <= 90 )
1078
+ goto st55;
1079
+ } else
1080
+ goto st55;
1081
+ goto st0;
1082
+ st55:
1083
+ if ( ++p == pe )
1084
+ goto _out55;
1085
+ case 55:
1086
+ switch( (*p) ) {
1087
+ case 32: goto tr2;
1088
+ case 36: goto st56;
1089
+ case 95: goto st56;
1090
+ }
1091
+ if ( (*p) < 48 ) {
1092
+ if ( 45 <= (*p) && (*p) <= 46 )
1093
+ goto st56;
1094
+ } else if ( (*p) > 57 ) {
1095
+ if ( 65 <= (*p) && (*p) <= 90 )
1096
+ goto st56;
1097
+ } else
1098
+ goto st56;
1099
+ goto st0;
1100
+ st56:
1101
+ if ( ++p == pe )
1102
+ goto _out56;
1103
+ case 56:
1104
+ if ( (*p) == 32 )
1105
+ goto tr2;
1106
+ goto st0;
1107
+ }
1108
+ _out0: cs = 0; goto _out;
1109
+ _out2: cs = 2; goto _out;
1110
+ _out3: cs = 3; goto _out;
1111
+ _out4: cs = 4; goto _out;
1112
+ _out5: cs = 5; goto _out;
1113
+ _out6: cs = 6; goto _out;
1114
+ _out7: cs = 7; goto _out;
1115
+ _out8: cs = 8; goto _out;
1116
+ _out9: cs = 9; goto _out;
1117
+ _out10: cs = 10; goto _out;
1118
+ _out11: cs = 11; goto _out;
1119
+ _out12: cs = 12; goto _out;
1120
+ _out13: cs = 13; goto _out;
1121
+ _out14: cs = 14; goto _out;
1122
+ _out15: cs = 15; goto _out;
1123
+ _out16: cs = 16; goto _out;
1124
+ _out57: cs = 57; goto _out;
1125
+ _out17: cs = 17; goto _out;
1126
+ _out18: cs = 18; goto _out;
1127
+ _out19: cs = 19; goto _out;
1128
+ _out20: cs = 20; goto _out;
1129
+ _out21: cs = 21; goto _out;
1130
+ _out22: cs = 22; goto _out;
1131
+ _out23: cs = 23; goto _out;
1132
+ _out24: cs = 24; goto _out;
1133
+ _out25: cs = 25; goto _out;
1134
+ _out26: cs = 26; goto _out;
1135
+ _out27: cs = 27; goto _out;
1136
+ _out28: cs = 28; goto _out;
1137
+ _out29: cs = 29; goto _out;
1138
+ _out30: cs = 30; goto _out;
1139
+ _out31: cs = 31; goto _out;
1140
+ _out32: cs = 32; goto _out;
1141
+ _out33: cs = 33; goto _out;
1142
+ _out34: cs = 34; goto _out;
1143
+ _out35: cs = 35; goto _out;
1144
+ _out36: cs = 36; goto _out;
1145
+ _out37: cs = 37; goto _out;
1146
+ _out38: cs = 38; goto _out;
1147
+ _out39: cs = 39; goto _out;
1148
+ _out40: cs = 40; goto _out;
1149
+ _out41: cs = 41; goto _out;
1150
+ _out42: cs = 42; goto _out;
1151
+ _out43: cs = 43; goto _out;
1152
+ _out44: cs = 44; goto _out;
1153
+ _out45: cs = 45; goto _out;
1154
+ _out46: cs = 46; goto _out;
1155
+ _out47: cs = 47; goto _out;
1156
+ _out48: cs = 48; goto _out;
1157
+ _out49: cs = 49; goto _out;
1158
+ _out50: cs = 50; goto _out;
1159
+ _out51: cs = 51; goto _out;
1160
+ _out52: cs = 52; goto _out;
1161
+ _out53: cs = 53; goto _out;
1162
+ _out54: cs = 54; goto _out;
1163
+ _out55: cs = 55; goto _out;
1164
+ _out56: cs = 56; goto _out;
1165
+
1166
+ _out: {}
1167
+ }
1168
+ #line 122 "http11_parser.rl"
1169
+
1170
+ parser->cs = cs;
1171
+ parser->nread += p - (buffer + off);
1172
+
1173
+ assert(p <= pe && "buffer overflow after parsing execute");
1174
+ assert(parser->nread <= len && "nread longer than length");
1175
+ assert(parser->body_start <= len && "body starts after buffer end");
1176
+ assert(parser->mark < len && "mark is after buffer end");
1177
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1178
+ assert(parser->field_start < len && "field starts after buffer end");
1179
+
1180
+ if(parser->body_start) {
1181
+ /* final \r\n combo encountered so stop right here */
1182
+
1183
+ #line 1184 "http11_parser.c"
1184
+ #line 136 "http11_parser.rl"
1185
+ parser->nread++;
1186
+ }
1187
+
1188
+ return(parser->nread);
1189
+ }
1190
+
1191
+ int http_parser_finish(http_parser *parser)
1192
+ {
1193
+ int cs = parser->cs;
1194
+
1195
+
1196
+ #line 1197 "http11_parser.c"
1197
+ #line 147 "http11_parser.rl"
1198
+
1199
+ parser->cs = cs;
1200
+
1201
+ if (http_parser_has_error(parser) ) {
1202
+ return -1;
1203
+ } else if (http_parser_is_finished(parser) ) {
1204
+ return 1;
1205
+ } else {
1206
+ return 0;
1207
+ }
1208
+ }
1209
+
1210
+ int http_parser_has_error(http_parser *parser) {
1211
+ return parser->cs == http_parser_error;
1212
+ }
1213
+
1214
+ int http_parser_is_finished(http_parser *parser) {
1215
+ return parser->cs == http_parser_first_final;
1216
+ }