mongrel 1.1.5-x86-mingw32

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