mongrel 1.2.0.pre2-x86-mswin32

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