mongrel 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/COPYING +504 -0
  2. data/LICENSE +504 -0
  3. data/README +117 -0
  4. data/Rakefile +30 -0
  5. data/doc/rdoc/classes/Mongrel.html +144 -0
  6. data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
  7. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000023.html +18 -0
  8. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000024.html +18 -0
  9. data/doc/rdoc/classes/Mongrel/HeaderOut.html +167 -0
  10. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000013.html +18 -0
  11. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000014.html +21 -0
  12. data/doc/rdoc/classes/Mongrel/HttpHandler.html +159 -0
  13. data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000019.html +17 -0
  14. data/doc/rdoc/classes/Mongrel/HttpParser.html +271 -0
  15. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000001.html +28 -0
  16. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000002.html +29 -0
  17. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000003.html +29 -0
  18. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html +41 -0
  19. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000005.html +27 -0
  20. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000006.html +27 -0
  21. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000007.html +28 -0
  22. data/doc/rdoc/classes/Mongrel/HttpRequest.html +177 -0
  23. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000025.html +30 -0
  24. data/doc/rdoc/classes/Mongrel/HttpResponse.html +202 -0
  25. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000020.html +21 -0
  26. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000021.html +20 -0
  27. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000022.html +25 -0
  28. data/doc/rdoc/classes/Mongrel/HttpServer.html +336 -0
  29. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +26 -0
  30. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000009.html +58 -0
  31. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000010.html +22 -0
  32. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000011.html +18 -0
  33. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +18 -0
  34. data/doc/rdoc/classes/Mongrel/URIClassifier.html +257 -0
  35. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000015.html +54 -0
  36. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000016.html +50 -0
  37. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000017.html +36 -0
  38. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000018.html +73 -0
  39. data/doc/rdoc/created.rid +1 -0
  40. data/doc/rdoc/files/COPYING.html +756 -0
  41. data/doc/rdoc/files/LICENSE.html +756 -0
  42. data/doc/rdoc/files/README.html +273 -0
  43. data/doc/rdoc/files/ext/http11/http11_c.html +101 -0
  44. data/doc/rdoc/files/lib/mongrel_rb.html +111 -0
  45. data/doc/rdoc/fr_class_index.html +35 -0
  46. data/doc/rdoc/fr_file_index.html +31 -0
  47. data/doc/rdoc/fr_method_index.html +51 -0
  48. data/doc/rdoc/index.html +24 -0
  49. data/doc/rdoc/rdoc-style.css +208 -0
  50. data/examples/camping/blog.rb +300 -0
  51. data/examples/camping/tepee.rb +168 -0
  52. data/examples/simpletest.rb +16 -0
  53. data/examples/webrick_compare.rb +20 -0
  54. data/ext/http11/MANIFEST +0 -0
  55. data/ext/http11/ext_help.h +14 -0
  56. data/ext/http11/extconf.rb +6 -0
  57. data/ext/http11/http11.c +436 -0
  58. data/ext/http11/http11_parser.c +918 -0
  59. data/ext/http11/http11_parser.h +37 -0
  60. data/ext/http11/tst.h +40 -0
  61. data/ext/http11/tst_cleanup.c +24 -0
  62. data/ext/http11/tst_delete.c +146 -0
  63. data/ext/http11/tst_grow_node_free_list.c +38 -0
  64. data/ext/http11/tst_init.c +41 -0
  65. data/ext/http11/tst_insert.c +192 -0
  66. data/ext/http11/tst_search.c +54 -0
  67. data/lib/mongrel.rb +298 -0
  68. data/setup.rb +1360 -0
  69. data/test/test_http11.rb +38 -0
  70. data/test/test_response.rb +44 -0
  71. data/test/test_uriclassifier.rb +104 -0
  72. data/test/test_ws.rb +33 -0
  73. data/tools/rakehelp.rb +99 -0
  74. metadata +132 -0
@@ -0,0 +1,918 @@
1
+ #line 1 "ext/http11/http11_parser.rl"
2
+ #include "http11_parser.h"
3
+ #include <stdio.h>
4
+ #include <assert.h>
5
+ #include <stdlib.h>
6
+ #include <ctype.h>
7
+ #include <string.h>
8
+
9
+ #define MARK(S,F) assert((F) - (S)->mark >= 0); (S)->mark = (F);
10
+
11
+ /** machine **/
12
+ #line 100 "ext/http11/http11_parser.rl"
13
+
14
+
15
+ /** Data **/
16
+
17
+ #line 18 "ext/http11/http11_parser.c"
18
+ static int http_parser_start = 0;
19
+
20
+ static int http_parser_first_final = 56;
21
+
22
+ static int http_parser_error = 1;
23
+
24
+ #line 104 "ext/http11/http11_parser.rl"
25
+
26
+ int http_parser_init(http_parser *parser) {
27
+ int cs = 0;
28
+
29
+ #line 30 "ext/http11/http11_parser.c"
30
+ {
31
+ cs = http_parser_start;
32
+ }
33
+ #line 108 "ext/http11/http11_parser.rl"
34
+ parser->cs = cs;
35
+ parser->body_start = NULL;
36
+ parser->content_len = 0;
37
+ parser->mark = NULL;
38
+ parser->nread = 0;
39
+
40
+ return(1);
41
+ }
42
+
43
+
44
+ /** exec **/
45
+ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len) {
46
+ const char *p, *pe;
47
+ int cs = parser->cs;
48
+
49
+ p = buffer;
50
+ pe = buffer+len;
51
+
52
+
53
+ #line 54 "ext/http11/http11_parser.c"
54
+ {
55
+ p -= 1;
56
+ if ( ++p == pe )
57
+ goto _out;
58
+ switch ( cs )
59
+ {
60
+ case 0:
61
+ switch( (*p) ) {
62
+ case 68: goto tr13;
63
+ case 71: goto tr14;
64
+ case 72: goto tr15;
65
+ case 79: goto tr16;
66
+ case 80: goto tr17;
67
+ case 84: goto tr18;
68
+ }
69
+ goto st1;
70
+ st1:
71
+ goto _out1;
72
+ tr13:
73
+ #line 14 "ext/http11/http11_parser.rl"
74
+ { MARK(parser, p); }
75
+ goto st2;
76
+ st2:
77
+ if ( ++p == pe )
78
+ goto _out2;
79
+ case 2:
80
+ #line 81 "ext/http11/http11_parser.c"
81
+ if ( (*p) == 69 )
82
+ goto st3;
83
+ goto st1;
84
+ st3:
85
+ if ( ++p == pe )
86
+ goto _out3;
87
+ case 3:
88
+ if ( (*p) == 76 )
89
+ goto st4;
90
+ goto st1;
91
+ st4:
92
+ if ( ++p == pe )
93
+ goto _out4;
94
+ case 4:
95
+ if ( (*p) == 69 )
96
+ goto st5;
97
+ goto st1;
98
+ st5:
99
+ if ( ++p == pe )
100
+ goto _out5;
101
+ case 5:
102
+ if ( (*p) == 84 )
103
+ goto st6;
104
+ goto st1;
105
+ st6:
106
+ if ( ++p == pe )
107
+ goto _out6;
108
+ case 6:
109
+ if ( (*p) == 69 )
110
+ goto st7;
111
+ goto st1;
112
+ st7:
113
+ if ( ++p == pe )
114
+ goto _out7;
115
+ case 7:
116
+ if ( (*p) == 32 )
117
+ goto tr33;
118
+ goto st1;
119
+ tr33:
120
+ #line 29 "ext/http11/http11_parser.rl"
121
+ {
122
+ if(parser->request_method != NULL)
123
+ parser->request_method(parser->data, parser->mark, p - parser->mark);
124
+ }
125
+ goto st8;
126
+ st8:
127
+ if ( ++p == pe )
128
+ goto _out8;
129
+ case 8:
130
+ #line 131 "ext/http11/http11_parser.c"
131
+ switch( (*p) ) {
132
+ case 42: goto tr27;
133
+ case 43: goto tr28;
134
+ case 47: goto tr29;
135
+ case 58: goto tr30;
136
+ }
137
+ if ( (*p) < 65 ) {
138
+ if ( 45 <= (*p) && (*p) <= 57 )
139
+ goto tr28;
140
+ } else if ( (*p) > 90 ) {
141
+ if ( 97 <= (*p) && (*p) <= 122 )
142
+ goto tr28;
143
+ } else
144
+ goto tr28;
145
+ goto st1;
146
+ tr27:
147
+ #line 14 "ext/http11/http11_parser.rl"
148
+ { MARK(parser, p); }
149
+ goto st9;
150
+ st9:
151
+ if ( ++p == pe )
152
+ goto _out9;
153
+ case 9:
154
+ #line 155 "ext/http11/http11_parser.c"
155
+ if ( (*p) == 32 )
156
+ goto tr34;
157
+ goto st1;
158
+ tr34:
159
+ #line 33 "ext/http11/http11_parser.rl"
160
+ {
161
+ if(parser->path_info != NULL)
162
+ parser->path_info(parser->data, parser->mark, p - parser->mark);
163
+ }
164
+ goto st10;
165
+ tr48:
166
+ #line 37 "ext/http11/http11_parser.rl"
167
+ {
168
+ if(parser->query_string != NULL)
169
+ parser->query_string(parser->data, parser->mark, p - parser->mark);
170
+ }
171
+ goto st10;
172
+ st10:
173
+ if ( ++p == pe )
174
+ goto _out10;
175
+ case 10:
176
+ #line 177 "ext/http11/http11_parser.c"
177
+ if ( (*p) == 72 )
178
+ goto tr11;
179
+ goto st1;
180
+ tr11:
181
+ #line 14 "ext/http11/http11_parser.rl"
182
+ { MARK(parser, p); }
183
+ goto st11;
184
+ st11:
185
+ if ( ++p == pe )
186
+ goto _out11;
187
+ case 11:
188
+ #line 189 "ext/http11/http11_parser.c"
189
+ if ( (*p) == 84 )
190
+ goto st12;
191
+ goto st1;
192
+ st12:
193
+ if ( ++p == pe )
194
+ goto _out12;
195
+ case 12:
196
+ if ( (*p) == 84 )
197
+ goto st13;
198
+ goto st1;
199
+ st13:
200
+ if ( ++p == pe )
201
+ goto _out13;
202
+ case 13:
203
+ if ( (*p) == 80 )
204
+ goto st14;
205
+ goto st1;
206
+ st14:
207
+ if ( ++p == pe )
208
+ goto _out14;
209
+ case 14:
210
+ if ( (*p) == 47 )
211
+ goto st15;
212
+ goto st1;
213
+ st15:
214
+ if ( ++p == pe )
215
+ goto _out15;
216
+ case 15:
217
+ if ( 48 <= (*p) && (*p) <= 57 )
218
+ goto st16;
219
+ goto st1;
220
+ st16:
221
+ if ( ++p == pe )
222
+ goto _out16;
223
+ case 16:
224
+ if ( (*p) == 46 )
225
+ goto st17;
226
+ if ( 48 <= (*p) && (*p) <= 57 )
227
+ goto st16;
228
+ goto st1;
229
+ st17:
230
+ if ( ++p == pe )
231
+ goto _out17;
232
+ case 17:
233
+ if ( 48 <= (*p) && (*p) <= 57 )
234
+ goto st18;
235
+ goto st1;
236
+ st18:
237
+ if ( ++p == pe )
238
+ goto _out18;
239
+ case 18:
240
+ if ( (*p) == 13 )
241
+ goto tr37;
242
+ if ( 48 <= (*p) && (*p) <= 57 )
243
+ goto st18;
244
+ goto st1;
245
+ tr37:
246
+ #line 42 "ext/http11/http11_parser.rl"
247
+ {
248
+ if(parser->http_version != NULL)
249
+ parser->http_version(parser->data, parser->mark, p - parser->mark);
250
+ }
251
+ goto st19;
252
+ st19:
253
+ if ( ++p == pe )
254
+ goto _out19;
255
+ case 19:
256
+ #line 257 "ext/http11/http11_parser.c"
257
+ if ( (*p) == 10 )
258
+ goto st20;
259
+ goto st1;
260
+ st20:
261
+ if ( ++p == pe )
262
+ goto _out20;
263
+ case 20:
264
+ switch( (*p) ) {
265
+ case 13: goto st21;
266
+ case 33: goto tr36;
267
+ case 124: goto tr36;
268
+ case 126: goto tr36;
269
+ }
270
+ if ( (*p) < 45 ) {
271
+ if ( (*p) > 39 ) {
272
+ if ( 42 <= (*p) && (*p) <= 43 )
273
+ goto tr36;
274
+ } else if ( (*p) >= 35 )
275
+ goto tr36;
276
+ } else if ( (*p) > 46 ) {
277
+ if ( (*p) < 65 ) {
278
+ if ( 48 <= (*p) && (*p) <= 57 )
279
+ goto tr36;
280
+ } else if ( (*p) > 90 ) {
281
+ if ( 94 <= (*p) && (*p) <= 122 )
282
+ goto tr36;
283
+ } else
284
+ goto tr36;
285
+ } else
286
+ goto tr36;
287
+ goto st1;
288
+ st21:
289
+ if ( ++p == pe )
290
+ goto _out21;
291
+ case 21:
292
+ if ( (*p) == 10 )
293
+ goto tr40;
294
+ goto st1;
295
+ tr40:
296
+ #line 46 "ext/http11/http11_parser.rl"
297
+ {
298
+ parser->body_start = p+1; goto _out56;
299
+ }
300
+ goto st56;
301
+ st56:
302
+ if ( ++p == pe )
303
+ goto _out56;
304
+ case 56:
305
+ #line 306 "ext/http11/http11_parser.c"
306
+ goto st1;
307
+ tr36:
308
+ #line 16 "ext/http11/http11_parser.rl"
309
+ { parser->field_start = p; }
310
+ goto st22;
311
+ st22:
312
+ if ( ++p == pe )
313
+ goto _out22;
314
+ case 22:
315
+ #line 316 "ext/http11/http11_parser.c"
316
+ switch( (*p) ) {
317
+ case 33: goto st22;
318
+ case 58: goto tr32;
319
+ case 124: goto st22;
320
+ case 126: goto st22;
321
+ }
322
+ if ( (*p) < 45 ) {
323
+ if ( (*p) > 39 ) {
324
+ if ( 42 <= (*p) && (*p) <= 43 )
325
+ goto st22;
326
+ } else if ( (*p) >= 35 )
327
+ goto st22;
328
+ } else if ( (*p) > 46 ) {
329
+ if ( (*p) < 65 ) {
330
+ if ( 48 <= (*p) && (*p) <= 57 )
331
+ goto st22;
332
+ } else if ( (*p) > 90 ) {
333
+ if ( 94 <= (*p) && (*p) <= 122 )
334
+ goto st22;
335
+ } else
336
+ goto st22;
337
+ } else
338
+ goto st22;
339
+ goto st1;
340
+ tr32:
341
+ #line 17 "ext/http11/http11_parser.rl"
342
+ {
343
+ parser->field_len = (p - parser->field_start);
344
+ }
345
+ goto st23;
346
+ st23:
347
+ if ( ++p == pe )
348
+ goto _out23;
349
+ case 23:
350
+ #line 351 "ext/http11/http11_parser.c"
351
+ if ( (*p) == 13 )
352
+ goto tr56;
353
+ goto tr55;
354
+ tr55:
355
+ #line 21 "ext/http11/http11_parser.rl"
356
+ { MARK(parser, p); }
357
+ goto st24;
358
+ st24:
359
+ if ( ++p == pe )
360
+ goto _out24;
361
+ case 24:
362
+ #line 363 "ext/http11/http11_parser.c"
363
+ if ( (*p) == 13 )
364
+ goto tr51;
365
+ goto st24;
366
+ tr51:
367
+ #line 22 "ext/http11/http11_parser.rl"
368
+ {
369
+ if(parser->http_field != NULL) {
370
+ parser->http_field(parser->data,
371
+ parser->field_start, parser->field_len,
372
+ parser->mark+1, p - (parser->mark +1));
373
+ }
374
+ }
375
+ goto st25;
376
+ tr56:
377
+ #line 21 "ext/http11/http11_parser.rl"
378
+ { MARK(parser, p); }
379
+ #line 22 "ext/http11/http11_parser.rl"
380
+ {
381
+ if(parser->http_field != NULL) {
382
+ parser->http_field(parser->data,
383
+ parser->field_start, parser->field_len,
384
+ parser->mark+1, p - (parser->mark +1));
385
+ }
386
+ }
387
+ goto st25;
388
+ st25:
389
+ if ( ++p == pe )
390
+ goto _out25;
391
+ case 25:
392
+ #line 393 "ext/http11/http11_parser.c"
393
+ switch( (*p) ) {
394
+ case 10: goto st26;
395
+ case 13: goto tr51;
396
+ }
397
+ goto st24;
398
+ st26:
399
+ if ( ++p == pe )
400
+ goto _out26;
401
+ case 26:
402
+ switch( (*p) ) {
403
+ case 13: goto st21;
404
+ case 33: goto tr42;
405
+ case 124: goto tr42;
406
+ case 126: goto tr42;
407
+ }
408
+ if ( (*p) < 45 ) {
409
+ if ( (*p) > 39 ) {
410
+ if ( 42 <= (*p) && (*p) <= 43 )
411
+ goto tr42;
412
+ } else if ( (*p) >= 35 )
413
+ goto tr42;
414
+ } else if ( (*p) > 46 ) {
415
+ if ( (*p) < 65 ) {
416
+ if ( 48 <= (*p) && (*p) <= 57 )
417
+ goto tr42;
418
+ } else if ( (*p) > 90 ) {
419
+ if ( 94 <= (*p) && (*p) <= 122 )
420
+ goto tr42;
421
+ } else
422
+ goto tr42;
423
+ } else
424
+ goto tr42;
425
+ goto st24;
426
+ tr42:
427
+ #line 16 "ext/http11/http11_parser.rl"
428
+ { parser->field_start = p; }
429
+ goto st27;
430
+ st27:
431
+ if ( ++p == pe )
432
+ goto _out27;
433
+ case 27:
434
+ #line 435 "ext/http11/http11_parser.c"
435
+ switch( (*p) ) {
436
+ case 13: goto tr51;
437
+ case 33: goto st27;
438
+ case 58: goto tr32;
439
+ case 124: goto st27;
440
+ case 126: goto st27;
441
+ }
442
+ if ( (*p) < 45 ) {
443
+ if ( (*p) > 39 ) {
444
+ if ( 42 <= (*p) && (*p) <= 43 )
445
+ goto st27;
446
+ } else if ( (*p) >= 35 )
447
+ goto st27;
448
+ } else if ( (*p) > 46 ) {
449
+ if ( (*p) < 65 ) {
450
+ if ( 48 <= (*p) && (*p) <= 57 )
451
+ goto st27;
452
+ } else if ( (*p) > 90 ) {
453
+ if ( 94 <= (*p) && (*p) <= 122 )
454
+ goto st27;
455
+ } else
456
+ goto st27;
457
+ } else
458
+ goto st27;
459
+ goto st24;
460
+ tr28:
461
+ #line 14 "ext/http11/http11_parser.rl"
462
+ { MARK(parser, p); }
463
+ goto st28;
464
+ st28:
465
+ if ( ++p == pe )
466
+ goto _out28;
467
+ case 28:
468
+ #line 469 "ext/http11/http11_parser.c"
469
+ switch( (*p) ) {
470
+ case 43: goto st28;
471
+ case 58: goto st29;
472
+ }
473
+ if ( (*p) < 48 ) {
474
+ if ( 45 <= (*p) && (*p) <= 46 )
475
+ goto st28;
476
+ } else if ( (*p) > 57 ) {
477
+ if ( (*p) > 90 ) {
478
+ if ( 97 <= (*p) && (*p) <= 122 )
479
+ goto st28;
480
+ } else if ( (*p) >= 65 )
481
+ goto st28;
482
+ } else
483
+ goto st28;
484
+ goto st1;
485
+ tr30:
486
+ #line 14 "ext/http11/http11_parser.rl"
487
+ { MARK(parser, p); }
488
+ goto st29;
489
+ st29:
490
+ if ( ++p == pe )
491
+ goto _out29;
492
+ case 29:
493
+ #line 494 "ext/http11/http11_parser.c"
494
+ switch( (*p) ) {
495
+ case 32: goto tr34;
496
+ case 37: goto st30;
497
+ case 60: goto st1;
498
+ case 62: goto st1;
499
+ case 127: goto st1;
500
+ }
501
+ if ( (*p) > 31 ) {
502
+ if ( 34 <= (*p) && (*p) <= 35 )
503
+ goto st1;
504
+ } else if ( (*p) >= 0 )
505
+ goto st1;
506
+ goto st29;
507
+ st30:
508
+ if ( ++p == pe )
509
+ goto _out30;
510
+ case 30:
511
+ if ( (*p) < 65 ) {
512
+ if ( 48 <= (*p) && (*p) <= 57 )
513
+ goto st31;
514
+ } else if ( (*p) > 70 ) {
515
+ if ( 97 <= (*p) && (*p) <= 102 )
516
+ goto st31;
517
+ } else
518
+ goto st31;
519
+ goto st1;
520
+ st31:
521
+ if ( ++p == pe )
522
+ goto _out31;
523
+ case 31:
524
+ if ( (*p) < 65 ) {
525
+ if ( 48 <= (*p) && (*p) <= 57 )
526
+ goto st29;
527
+ } else if ( (*p) > 70 ) {
528
+ if ( 97 <= (*p) && (*p) <= 102 )
529
+ goto st29;
530
+ } else
531
+ goto st29;
532
+ goto st1;
533
+ tr29:
534
+ #line 14 "ext/http11/http11_parser.rl"
535
+ { MARK(parser, p); }
536
+ goto st32;
537
+ st32:
538
+ if ( ++p == pe )
539
+ goto _out32;
540
+ case 32:
541
+ #line 542 "ext/http11/http11_parser.c"
542
+ switch( (*p) ) {
543
+ case 32: goto tr34;
544
+ case 37: goto st34;
545
+ case 47: goto st1;
546
+ case 60: goto st1;
547
+ case 62: goto st1;
548
+ case 63: goto tr46;
549
+ case 127: goto st1;
550
+ }
551
+ if ( (*p) > 31 ) {
552
+ if ( 34 <= (*p) && (*p) <= 35 )
553
+ goto st1;
554
+ } else if ( (*p) >= 0 )
555
+ goto st1;
556
+ goto st33;
557
+ st33:
558
+ if ( ++p == pe )
559
+ goto _out33;
560
+ case 33:
561
+ switch( (*p) ) {
562
+ case 32: goto tr34;
563
+ case 37: goto st34;
564
+ case 60: goto st1;
565
+ case 62: goto st1;
566
+ case 63: goto tr46;
567
+ case 127: goto st1;
568
+ }
569
+ if ( (*p) > 31 ) {
570
+ if ( 34 <= (*p) && (*p) <= 35 )
571
+ goto st1;
572
+ } else if ( (*p) >= 0 )
573
+ goto st1;
574
+ goto st33;
575
+ st34:
576
+ if ( ++p == pe )
577
+ goto _out34;
578
+ case 34:
579
+ if ( (*p) < 65 ) {
580
+ if ( 48 <= (*p) && (*p) <= 57 )
581
+ goto st35;
582
+ } else if ( (*p) > 70 ) {
583
+ if ( 97 <= (*p) && (*p) <= 102 )
584
+ goto st35;
585
+ } else
586
+ goto st35;
587
+ goto st1;
588
+ st35:
589
+ if ( ++p == pe )
590
+ goto _out35;
591
+ case 35:
592
+ if ( (*p) < 65 ) {
593
+ if ( 48 <= (*p) && (*p) <= 57 )
594
+ goto st33;
595
+ } else if ( (*p) > 70 ) {
596
+ if ( 97 <= (*p) && (*p) <= 102 )
597
+ goto st33;
598
+ } else
599
+ goto st33;
600
+ goto st1;
601
+ tr46:
602
+ #line 33 "ext/http11/http11_parser.rl"
603
+ {
604
+ if(parser->path_info != NULL)
605
+ parser->path_info(parser->data, parser->mark, p - parser->mark);
606
+ }
607
+ goto st36;
608
+ st36:
609
+ if ( ++p == pe )
610
+ goto _out36;
611
+ case 36:
612
+ #line 613 "ext/http11/http11_parser.c"
613
+ switch( (*p) ) {
614
+ case 32: goto tr48;
615
+ case 37: goto tr54;
616
+ case 60: goto st1;
617
+ case 62: goto st1;
618
+ case 127: goto st1;
619
+ }
620
+ if ( (*p) > 31 ) {
621
+ if ( 34 <= (*p) && (*p) <= 35 )
622
+ goto st1;
623
+ } else if ( (*p) >= 0 )
624
+ goto st1;
625
+ goto tr53;
626
+ tr53:
627
+ #line 14 "ext/http11/http11_parser.rl"
628
+ { MARK(parser, p); }
629
+ goto st37;
630
+ st37:
631
+ if ( ++p == pe )
632
+ goto _out37;
633
+ case 37:
634
+ #line 635 "ext/http11/http11_parser.c"
635
+ switch( (*p) ) {
636
+ case 32: goto tr48;
637
+ case 37: goto st38;
638
+ case 60: goto st1;
639
+ case 62: goto st1;
640
+ case 127: goto st1;
641
+ }
642
+ if ( (*p) > 31 ) {
643
+ if ( 34 <= (*p) && (*p) <= 35 )
644
+ goto st1;
645
+ } else if ( (*p) >= 0 )
646
+ goto st1;
647
+ goto st37;
648
+ tr54:
649
+ #line 14 "ext/http11/http11_parser.rl"
650
+ { MARK(parser, p); }
651
+ goto st38;
652
+ st38:
653
+ if ( ++p == pe )
654
+ goto _out38;
655
+ case 38:
656
+ #line 657 "ext/http11/http11_parser.c"
657
+ if ( (*p) < 65 ) {
658
+ if ( 48 <= (*p) && (*p) <= 57 )
659
+ goto st39;
660
+ } else if ( (*p) > 70 ) {
661
+ if ( 97 <= (*p) && (*p) <= 102 )
662
+ goto st39;
663
+ } else
664
+ goto st39;
665
+ goto st1;
666
+ st39:
667
+ if ( ++p == pe )
668
+ goto _out39;
669
+ case 39:
670
+ if ( (*p) < 65 ) {
671
+ if ( 48 <= (*p) && (*p) <= 57 )
672
+ goto st37;
673
+ } else if ( (*p) > 70 ) {
674
+ if ( 97 <= (*p) && (*p) <= 102 )
675
+ goto st37;
676
+ } else
677
+ goto st37;
678
+ goto st1;
679
+ tr14:
680
+ #line 14 "ext/http11/http11_parser.rl"
681
+ { MARK(parser, p); }
682
+ goto st40;
683
+ st40:
684
+ if ( ++p == pe )
685
+ goto _out40;
686
+ case 40:
687
+ #line 688 "ext/http11/http11_parser.c"
688
+ if ( (*p) == 69 )
689
+ goto st41;
690
+ goto st1;
691
+ st41:
692
+ if ( ++p == pe )
693
+ goto _out41;
694
+ case 41:
695
+ if ( (*p) == 84 )
696
+ goto st7;
697
+ goto st1;
698
+ tr15:
699
+ #line 14 "ext/http11/http11_parser.rl"
700
+ { MARK(parser, p); }
701
+ goto st42;
702
+ st42:
703
+ if ( ++p == pe )
704
+ goto _out42;
705
+ case 42:
706
+ #line 707 "ext/http11/http11_parser.c"
707
+ if ( (*p) == 69 )
708
+ goto st43;
709
+ goto st1;
710
+ st43:
711
+ if ( ++p == pe )
712
+ goto _out43;
713
+ case 43:
714
+ if ( (*p) == 65 )
715
+ goto st44;
716
+ goto st1;
717
+ st44:
718
+ if ( ++p == pe )
719
+ goto _out44;
720
+ case 44:
721
+ if ( (*p) == 68 )
722
+ goto st7;
723
+ goto st1;
724
+ tr16:
725
+ #line 14 "ext/http11/http11_parser.rl"
726
+ { MARK(parser, p); }
727
+ goto st45;
728
+ st45:
729
+ if ( ++p == pe )
730
+ goto _out45;
731
+ case 45:
732
+ #line 733 "ext/http11/http11_parser.c"
733
+ if ( (*p) == 80 )
734
+ goto st46;
735
+ goto st1;
736
+ st46:
737
+ if ( ++p == pe )
738
+ goto _out46;
739
+ case 46:
740
+ if ( (*p) == 84 )
741
+ goto st47;
742
+ goto st1;
743
+ st47:
744
+ if ( ++p == pe )
745
+ goto _out47;
746
+ case 47:
747
+ if ( (*p) == 73 )
748
+ goto st48;
749
+ goto st1;
750
+ st48:
751
+ if ( ++p == pe )
752
+ goto _out48;
753
+ case 48:
754
+ if ( (*p) == 79 )
755
+ goto st49;
756
+ goto st1;
757
+ st49:
758
+ if ( ++p == pe )
759
+ goto _out49;
760
+ case 49:
761
+ if ( (*p) == 78 )
762
+ goto st50;
763
+ goto st1;
764
+ st50:
765
+ if ( ++p == pe )
766
+ goto _out50;
767
+ case 50:
768
+ if ( (*p) == 83 )
769
+ goto st7;
770
+ goto st1;
771
+ tr17:
772
+ #line 14 "ext/http11/http11_parser.rl"
773
+ { MARK(parser, p); }
774
+ goto st51;
775
+ st51:
776
+ if ( ++p == pe )
777
+ goto _out51;
778
+ case 51:
779
+ #line 780 "ext/http11/http11_parser.c"
780
+ switch( (*p) ) {
781
+ case 79: goto st52;
782
+ case 85: goto st41;
783
+ }
784
+ goto st1;
785
+ st52:
786
+ if ( ++p == pe )
787
+ goto _out52;
788
+ case 52:
789
+ if ( (*p) == 83 )
790
+ goto st41;
791
+ goto st1;
792
+ tr18:
793
+ #line 14 "ext/http11/http11_parser.rl"
794
+ { MARK(parser, p); }
795
+ goto st53;
796
+ st53:
797
+ if ( ++p == pe )
798
+ goto _out53;
799
+ case 53:
800
+ #line 801 "ext/http11/http11_parser.c"
801
+ if ( (*p) == 82 )
802
+ goto st54;
803
+ goto st1;
804
+ st54:
805
+ if ( ++p == pe )
806
+ goto _out54;
807
+ case 54:
808
+ if ( (*p) == 65 )
809
+ goto st55;
810
+ goto st1;
811
+ st55:
812
+ if ( ++p == pe )
813
+ goto _out55;
814
+ case 55:
815
+ if ( (*p) == 67 )
816
+ goto st6;
817
+ goto st1;
818
+ }
819
+ _out1: cs = 1; goto _out;
820
+ _out2: cs = 2; goto _out;
821
+ _out3: cs = 3; goto _out;
822
+ _out4: cs = 4; goto _out;
823
+ _out5: cs = 5; goto _out;
824
+ _out6: cs = 6; goto _out;
825
+ _out7: cs = 7; goto _out;
826
+ _out8: cs = 8; goto _out;
827
+ _out9: cs = 9; goto _out;
828
+ _out10: cs = 10; goto _out;
829
+ _out11: cs = 11; goto _out;
830
+ _out12: cs = 12; goto _out;
831
+ _out13: cs = 13; goto _out;
832
+ _out14: cs = 14; goto _out;
833
+ _out15: cs = 15; goto _out;
834
+ _out16: cs = 16; goto _out;
835
+ _out17: cs = 17; goto _out;
836
+ _out18: cs = 18; goto _out;
837
+ _out19: cs = 19; goto _out;
838
+ _out20: cs = 20; goto _out;
839
+ _out21: cs = 21; goto _out;
840
+ _out56: cs = 56; goto _out;
841
+ _out22: cs = 22; goto _out;
842
+ _out23: cs = 23; goto _out;
843
+ _out24: cs = 24; goto _out;
844
+ _out25: cs = 25; goto _out;
845
+ _out26: cs = 26; goto _out;
846
+ _out27: cs = 27; goto _out;
847
+ _out28: cs = 28; goto _out;
848
+ _out29: cs = 29; goto _out;
849
+ _out30: cs = 30; goto _out;
850
+ _out31: cs = 31; goto _out;
851
+ _out32: cs = 32; goto _out;
852
+ _out33: cs = 33; goto _out;
853
+ _out34: cs = 34; goto _out;
854
+ _out35: cs = 35; goto _out;
855
+ _out36: cs = 36; goto _out;
856
+ _out37: cs = 37; goto _out;
857
+ _out38: cs = 38; goto _out;
858
+ _out39: cs = 39; goto _out;
859
+ _out40: cs = 40; goto _out;
860
+ _out41: cs = 41; goto _out;
861
+ _out42: cs = 42; goto _out;
862
+ _out43: cs = 43; goto _out;
863
+ _out44: cs = 44; goto _out;
864
+ _out45: cs = 45; goto _out;
865
+ _out46: cs = 46; goto _out;
866
+ _out47: cs = 47; goto _out;
867
+ _out48: cs = 48; goto _out;
868
+ _out49: cs = 49; goto _out;
869
+ _out50: cs = 50; goto _out;
870
+ _out51: cs = 51; goto _out;
871
+ _out52: cs = 52; goto _out;
872
+ _out53: cs = 53; goto _out;
873
+ _out54: cs = 54; goto _out;
874
+ _out55: cs = 55; goto _out;
875
+
876
+ _out: {}
877
+ }
878
+ #line 127 "ext/http11/http11_parser.rl"
879
+
880
+ parser->cs = cs;
881
+ parser->nread = p - buffer;
882
+ if(parser->body_start) {
883
+ /* final \r\n combo encountered so stop right here */
884
+
885
+ #line 886 "ext/http11/http11_parser.c"
886
+ #line 133 "ext/http11/http11_parser.rl"
887
+ parser->nread++;
888
+ }
889
+
890
+ return(parser->nread);
891
+ }
892
+
893
+ int http_parser_finish(http_parser *parser)
894
+ {
895
+ int cs = parser->cs;
896
+
897
+
898
+ #line 899 "ext/http11/http11_parser.c"
899
+ #line 144 "ext/http11/http11_parser.rl"
900
+
901
+ parser->cs = cs;
902
+
903
+ if (http_parser_has_error(parser) ) {
904
+ return -1;
905
+ } else if (http_parser_is_finished(parser) ) {
906
+ return 1;
907
+ } else {
908
+ return 0;
909
+ }
910
+ }
911
+
912
+ int http_parser_has_error(http_parser *parser) {
913
+ return parser->cs == http_parser_error;
914
+ }
915
+
916
+ int http_parser_is_finished(http_parser *parser) {
917
+ return parser->cs == http_parser_first_final;
918
+ }