pitchfork 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,12 +38,6 @@ void init_pitchfork_memory_page(VALUE);
38
38
 
39
39
  static unsigned int MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */
40
40
 
41
- /* this is only intended for use with Rainbows! */
42
- static VALUE set_maxhdrlen(VALUE self, VALUE len)
43
- {
44
- return UINT2NUM(MAX_HEADER_LEN = NUM2UINT(len));
45
- }
46
-
47
41
  /* keep this small for other servers (e.g. yahns) since every client has one */
48
42
  struct http_parser {
49
43
  int cs; /* Ragel internal state */
@@ -97,7 +91,7 @@ static inline unsigned int ulong2uint(unsigned long n)
97
91
  #define LEN(AT, FPC) (ulong2uint(FPC - buffer) - hp->AT)
98
92
  #define MARK(M,FPC) (hp->M = ulong2uint((FPC) - buffer))
99
93
  #define PTR_TO(F) (buffer + hp->F)
100
- #define STR_NEW(M,FPC) rb_str_new(PTR_TO(M), LEN(M, FPC))
94
+ #define STR_NEW(M,FPC) str_new(PTR_TO(M), LEN(M, FPC))
101
95
  #define STRIPPED_STR_NEW(M,FPC) stripped_str_new(PTR_TO(M), LEN(M, FPC))
102
96
 
103
97
  #define HP_FL_TEST(hp,fl) ((hp)->flags & (UH_FL_##fl))
@@ -110,13 +104,29 @@ static int is_lws(char c)
110
104
  return (c == ' ' || c == '\t');
111
105
  }
112
106
 
113
- static VALUE stripped_str_new(const char *str, long len)
107
+ static inline VALUE str_new(const char *str, long len)
108
+ {
109
+ VALUE rb_str = rb_str_new(str, len);
110
+ /* The Rack spec states:
111
+ > If the string values for CGI keys contain non-ASCII characters, they should use ASCII-8BIT encoding.
112
+ If they are ASCII, only the server is free to encode them as it wishes.
113
+ We chose to encode them as UTF-8 as any reasonable application would expect that today, and having the
114
+ same encoding as literal strings makes for slightly faster comparisons.
115
+ We'd like to also encode other strings that would be valid UTF-8 into UTF-8, but that would
116
+ violate the spec, so we leave them in BINARY aka ASCII-8BIT. */
117
+ if (rb_enc_str_asciionly_p(rb_str)) {
118
+ RB_ENCODING_SET_INLINED(rb_str, rb_utf8_encindex());
119
+ }
120
+ return rb_str;
121
+ }
122
+
123
+ static inline VALUE stripped_str_new(const char *str, long len)
114
124
  {
115
125
  long end;
116
126
 
117
127
  for (end = len - 1; end >= 0 && is_lws(str[end]); end--);
118
128
 
119
- return rb_str_new(str, end + 1);
129
+ return str_new(str, end + 1);
120
130
  }
121
131
 
122
132
  /*
@@ -315,12 +325,12 @@ static void write_value(VALUE self, struct http_parser *hp,
315
325
  /** Machine **/
316
326
 
317
327
 
318
- #line 422 "pitchfork_http.rl"
328
+ #line 426 "pitchfork_http.rl"
319
329
 
320
330
 
321
331
  /** Data **/
322
332
 
323
- #line 324 "pitchfork_http.c"
333
+ #line 334 "pitchfork_http.c"
324
334
  static const int http_parser_start = 1;
325
335
  static const int http_parser_first_final = 122;
326
336
  static const int http_parser_error = 0;
@@ -331,7 +341,7 @@ static const int http_parser_en_Trailers = 114;
331
341
  static const int http_parser_en_main = 1;
332
342
 
333
343
 
334
- #line 426 "pitchfork_http.rl"
344
+ #line 430 "pitchfork_http.rl"
335
345
 
336
346
  static void http_parser_init(struct http_parser *hp)
337
347
  {
@@ -344,12 +354,12 @@ static void http_parser_init(struct http_parser *hp)
344
354
  hp->len.content = 0;
345
355
  hp->cont = Qfalse; /* zero on MRI, should be optimized away by above */
346
356
 
347
- #line 348 "pitchfork_http.c"
357
+ #line 358 "pitchfork_http.c"
348
358
  {
349
359
  cs = http_parser_start;
350
360
  }
351
361
 
352
- #line 438 "pitchfork_http.rl"
362
+ #line 442 "pitchfork_http.rl"
353
363
  hp->cs = cs;
354
364
  }
355
365
 
@@ -377,7 +387,7 @@ http_parser_execute(VALUE self, struct http_parser *hp, char *buffer, size_t len
377
387
  goto skip_chunk_data_hack;
378
388
  }
379
389
 
380
- #line 381 "pitchfork_http.c"
390
+ #line 391 "pitchfork_http.c"
381
391
  {
382
392
  if ( p == pe )
383
393
  goto _test_eof;
@@ -412,14 +422,14 @@ st0:
412
422
  cs = 0;
413
423
  goto _out;
414
424
  tr0:
415
- #line 318 "pitchfork_http.rl"
425
+ #line 328 "pitchfork_http.rl"
416
426
  {MARK(mark, p); }
417
427
  goto st2;
418
428
  st2:
419
429
  if ( ++p == pe )
420
430
  goto _test_eof2;
421
431
  case 2:
422
- #line 423 "pitchfork_http.c"
432
+ #line 433 "pitchfork_http.c"
423
433
  switch( (*p) ) {
424
434
  case 32: goto tr3;
425
435
  case 33: goto st49;
@@ -445,14 +455,14 @@ case 2:
445
455
  goto st49;
446
456
  goto st0;
447
457
  tr3:
448
- #line 327 "pitchfork_http.rl"
458
+ #line 337 "pitchfork_http.rl"
449
459
  { request_method(hp, PTR_TO(mark), LEN(mark, p)); }
450
460
  goto st3;
451
461
  st3:
452
462
  if ( ++p == pe )
453
463
  goto _test_eof3;
454
464
  case 3:
455
- #line 456 "pitchfork_http.c"
465
+ #line 466 "pitchfork_http.c"
456
466
  switch( (*p) ) {
457
467
  case 42: goto tr5;
458
468
  case 47: goto tr6;
@@ -461,55 +471,54 @@ case 3:
461
471
  }
462
472
  goto st0;
463
473
  tr5:
464
- #line 318 "pitchfork_http.rl"
474
+ #line 328 "pitchfork_http.rl"
465
475
  {MARK(mark, p); }
466
476
  goto st4;
467
477
  st4:
468
478
  if ( ++p == pe )
469
479
  goto _test_eof4;
470
480
  case 4:
471
- #line 472 "pitchfork_http.c"
481
+ #line 482 "pitchfork_http.c"
472
482
  switch( (*p) ) {
473
483
  case 32: goto tr8;
474
484
  case 35: goto tr9;
475
485
  }
476
486
  goto st0;
477
487
  tr8:
478
- #line 332 "pitchfork_http.rl"
488
+ #line 342 "pitchfork_http.rl"
479
489
  {
480
- VALUE str;
481
-
482
490
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
483
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
484
- /*
485
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
486
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
487
- */
488
- if (STR_CSTR_EQ(str, "*")) {
489
- str = rb_str_new(NULL, 0);
490
- rb_hash_aset(hp->env, g_path_info, str);
491
- rb_hash_aset(hp->env, g_request_path, str);
492
- }
491
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
493
492
  }
494
493
  goto st5;
495
494
  tr42:
496
- #line 318 "pitchfork_http.rl"
495
+ #line 328 "pitchfork_http.rl"
497
496
  {MARK(mark, p); }
498
- #line 347 "pitchfork_http.rl"
497
+ #line 346 "pitchfork_http.rl"
499
498
  {
500
499
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
501
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
500
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
501
+ if (STR_CSTR_EQ(str, "*")) {
502
+ VALUE str = rb_str_new("*", 1);
503
+ rb_hash_aset(hp->env, g_path_info, str);
504
+ rb_hash_aset(hp->env, g_request_path, str);
505
+ }
502
506
  }
503
507
  goto st5;
504
508
  tr45:
505
- #line 347 "pitchfork_http.rl"
509
+ #line 346 "pitchfork_http.rl"
506
510
  {
507
511
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
508
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
512
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
513
+ if (STR_CSTR_EQ(str, "*")) {
514
+ VALUE str = rb_str_new("*", 1);
515
+ rb_hash_aset(hp->env, g_path_info, str);
516
+ rb_hash_aset(hp->env, g_request_path, str);
517
+ }
509
518
  }
510
519
  goto st5;
511
520
  tr49:
512
- #line 357 "pitchfork_http.rl"
521
+ #line 361 "pitchfork_http.rl"
513
522
  {
514
523
  VALUE val;
515
524
 
@@ -520,88 +529,55 @@ tr49:
520
529
  if (!STR_CSTR_EQ(val, "*"))
521
530
  rb_hash_aset(hp->env, g_path_info, val);
522
531
  }
523
- #line 332 "pitchfork_http.rl"
532
+ #line 342 "pitchfork_http.rl"
524
533
  {
525
- VALUE str;
526
-
527
534
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
528
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
529
- /*
530
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
531
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
532
- */
533
- if (STR_CSTR_EQ(str, "*")) {
534
- str = rb_str_new(NULL, 0);
535
- rb_hash_aset(hp->env, g_path_info, str);
536
- rb_hash_aset(hp->env, g_request_path, str);
537
- }
535
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
538
536
  }
539
537
  goto st5;
540
538
  tr55:
541
- #line 351 "pitchfork_http.rl"
539
+ #line 355 "pitchfork_http.rl"
542
540
  {MARK(start.query, p); }
543
- #line 352 "pitchfork_http.rl"
541
+ #line 356 "pitchfork_http.rl"
544
542
  {
545
543
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
546
544
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
547
545
  }
548
- #line 332 "pitchfork_http.rl"
546
+ #line 342 "pitchfork_http.rl"
549
547
  {
550
- VALUE str;
551
-
552
548
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
553
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
554
- /*
555
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
556
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
557
- */
558
- if (STR_CSTR_EQ(str, "*")) {
559
- str = rb_str_new(NULL, 0);
560
- rb_hash_aset(hp->env, g_path_info, str);
561
- rb_hash_aset(hp->env, g_request_path, str);
562
- }
549
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
563
550
  }
564
551
  goto st5;
565
552
  tr59:
566
- #line 352 "pitchfork_http.rl"
553
+ #line 356 "pitchfork_http.rl"
567
554
  {
568
555
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
569
556
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
570
557
  }
571
- #line 332 "pitchfork_http.rl"
558
+ #line 342 "pitchfork_http.rl"
572
559
  {
573
- VALUE str;
574
-
575
560
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
576
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
577
- /*
578
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
579
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
580
- */
581
- if (STR_CSTR_EQ(str, "*")) {
582
- str = rb_str_new(NULL, 0);
583
- rb_hash_aset(hp->env, g_path_info, str);
584
- rb_hash_aset(hp->env, g_request_path, str);
585
- }
561
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
586
562
  }
587
563
  goto st5;
588
564
  st5:
589
565
  if ( ++p == pe )
590
566
  goto _test_eof5;
591
567
  case 5:
592
- #line 593 "pitchfork_http.c"
568
+ #line 569 "pitchfork_http.c"
593
569
  if ( (*p) == 72 )
594
570
  goto tr10;
595
571
  goto st0;
596
572
  tr10:
597
- #line 318 "pitchfork_http.rl"
573
+ #line 328 "pitchfork_http.rl"
598
574
  {MARK(mark, p); }
599
575
  goto st6;
600
576
  st6:
601
577
  if ( ++p == pe )
602
578
  goto _test_eof6;
603
579
  case 6:
604
- #line 605 "pitchfork_http.c"
580
+ #line 581 "pitchfork_http.c"
605
581
  if ( (*p) == 84 )
606
582
  goto st7;
607
583
  goto st0;
@@ -661,34 +637,34 @@ case 13:
661
637
  goto st13;
662
638
  goto st0;
663
639
  tr18:
664
- #line 356 "pitchfork_http.rl"
640
+ #line 360 "pitchfork_http.rl"
665
641
  { http_version(hp, PTR_TO(mark), LEN(mark, p)); }
666
642
  goto st14;
667
643
  tr26:
668
- #line 324 "pitchfork_http.rl"
644
+ #line 334 "pitchfork_http.rl"
669
645
  { MARK(mark, p); }
670
- #line 326 "pitchfork_http.rl"
646
+ #line 336 "pitchfork_http.rl"
671
647
  { write_cont_value(hp, buffer, p); }
672
648
  goto st14;
673
649
  tr29:
674
- #line 326 "pitchfork_http.rl"
650
+ #line 336 "pitchfork_http.rl"
675
651
  { write_cont_value(hp, buffer, p); }
676
652
  goto st14;
677
653
  tr36:
678
- #line 324 "pitchfork_http.rl"
654
+ #line 334 "pitchfork_http.rl"
679
655
  { MARK(mark, p); }
680
- #line 325 "pitchfork_http.rl"
656
+ #line 335 "pitchfork_http.rl"
681
657
  { write_value(self, hp, buffer, p); }
682
658
  goto st14;
683
659
  tr39:
684
- #line 325 "pitchfork_http.rl"
660
+ #line 335 "pitchfork_http.rl"
685
661
  { write_value(self, hp, buffer, p); }
686
662
  goto st14;
687
663
  st14:
688
664
  if ( ++p == pe )
689
665
  goto _test_eof14;
690
666
  case 14:
691
- #line 692 "pitchfork_http.c"
667
+ #line 668 "pitchfork_http.c"
692
668
  switch( (*p) ) {
693
669
  case 9: goto st15;
694
670
  case 10: goto tr21;
@@ -717,14 +693,14 @@ case 14:
717
693
  goto tr23;
718
694
  goto st0;
719
695
  tr25:
720
- #line 324 "pitchfork_http.rl"
696
+ #line 334 "pitchfork_http.rl"
721
697
  { MARK(mark, p); }
722
698
  goto st15;
723
699
  st15:
724
700
  if ( ++p == pe )
725
701
  goto _test_eof15;
726
702
  case 15:
727
- #line 728 "pitchfork_http.c"
703
+ #line 704 "pitchfork_http.c"
728
704
  switch( (*p) ) {
729
705
  case 9: goto tr25;
730
706
  case 10: goto tr26;
@@ -736,14 +712,14 @@ case 15:
736
712
  goto st0;
737
713
  goto tr24;
738
714
  tr24:
739
- #line 324 "pitchfork_http.rl"
715
+ #line 334 "pitchfork_http.rl"
740
716
  { MARK(mark, p); }
741
717
  goto st16;
742
718
  st16:
743
719
  if ( ++p == pe )
744
720
  goto _test_eof16;
745
721
  case 16:
746
- #line 747 "pitchfork_http.c"
722
+ #line 723 "pitchfork_http.c"
747
723
  switch( (*p) ) {
748
724
  case 10: goto tr29;
749
725
  case 13: goto tr30;
@@ -756,39 +732,39 @@ case 16:
756
732
  goto st0;
757
733
  goto st16;
758
734
  tr19:
759
- #line 356 "pitchfork_http.rl"
735
+ #line 360 "pitchfork_http.rl"
760
736
  { http_version(hp, PTR_TO(mark), LEN(mark, p)); }
761
737
  goto st17;
762
738
  tr27:
763
- #line 324 "pitchfork_http.rl"
739
+ #line 334 "pitchfork_http.rl"
764
740
  { MARK(mark, p); }
765
- #line 326 "pitchfork_http.rl"
741
+ #line 336 "pitchfork_http.rl"
766
742
  { write_cont_value(hp, buffer, p); }
767
743
  goto st17;
768
744
  tr30:
769
- #line 326 "pitchfork_http.rl"
745
+ #line 336 "pitchfork_http.rl"
770
746
  { write_cont_value(hp, buffer, p); }
771
747
  goto st17;
772
748
  tr37:
773
- #line 324 "pitchfork_http.rl"
749
+ #line 334 "pitchfork_http.rl"
774
750
  { MARK(mark, p); }
775
- #line 325 "pitchfork_http.rl"
751
+ #line 335 "pitchfork_http.rl"
776
752
  { write_value(self, hp, buffer, p); }
777
753
  goto st17;
778
754
  tr40:
779
- #line 325 "pitchfork_http.rl"
755
+ #line 335 "pitchfork_http.rl"
780
756
  { write_value(self, hp, buffer, p); }
781
757
  goto st17;
782
758
  st17:
783
759
  if ( ++p == pe )
784
760
  goto _test_eof17;
785
761
  case 17:
786
- #line 787 "pitchfork_http.c"
762
+ #line 763 "pitchfork_http.c"
787
763
  if ( (*p) == 10 )
788
764
  goto st14;
789
765
  goto st0;
790
766
  tr21:
791
- #line 372 "pitchfork_http.rl"
767
+ #line 376 "pitchfork_http.rl"
792
768
  {
793
769
  finalize_header(hp);
794
770
 
@@ -809,23 +785,12 @@ tr21:
809
785
  }
810
786
  goto st122;
811
787
  tr104:
812
- #line 332 "pitchfork_http.rl"
788
+ #line 342 "pitchfork_http.rl"
813
789
  {
814
- VALUE str;
815
-
816
790
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
817
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
818
- /*
819
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
820
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
821
- */
822
- if (STR_CSTR_EQ(str, "*")) {
823
- str = rb_str_new(NULL, 0);
824
- rb_hash_aset(hp->env, g_path_info, str);
825
- rb_hash_aset(hp->env, g_request_path, str);
826
- }
791
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
827
792
  }
828
- #line 372 "pitchfork_http.rl"
793
+ #line 376 "pitchfork_http.rl"
829
794
  {
830
795
  finalize_header(hp);
831
796
 
@@ -846,14 +811,19 @@ tr104:
846
811
  }
847
812
  goto st122;
848
813
  tr108:
849
- #line 318 "pitchfork_http.rl"
814
+ #line 328 "pitchfork_http.rl"
850
815
  {MARK(mark, p); }
851
- #line 347 "pitchfork_http.rl"
816
+ #line 346 "pitchfork_http.rl"
852
817
  {
853
818
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
854
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
819
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
820
+ if (STR_CSTR_EQ(str, "*")) {
821
+ VALUE str = rb_str_new("*", 1);
822
+ rb_hash_aset(hp->env, g_path_info, str);
823
+ rb_hash_aset(hp->env, g_request_path, str);
824
+ }
855
825
  }
856
- #line 372 "pitchfork_http.rl"
826
+ #line 376 "pitchfork_http.rl"
857
827
  {
858
828
  finalize_header(hp);
859
829
 
@@ -874,12 +844,17 @@ tr108:
874
844
  }
875
845
  goto st122;
876
846
  tr112:
877
- #line 347 "pitchfork_http.rl"
847
+ #line 346 "pitchfork_http.rl"
878
848
  {
879
849
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
880
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
850
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
851
+ if (STR_CSTR_EQ(str, "*")) {
852
+ VALUE str = rb_str_new("*", 1);
853
+ rb_hash_aset(hp->env, g_path_info, str);
854
+ rb_hash_aset(hp->env, g_request_path, str);
855
+ }
881
856
  }
882
- #line 372 "pitchfork_http.rl"
857
+ #line 376 "pitchfork_http.rl"
883
858
  {
884
859
  finalize_header(hp);
885
860
 
@@ -900,7 +875,7 @@ tr112:
900
875
  }
901
876
  goto st122;
902
877
  tr117:
903
- #line 357 "pitchfork_http.rl"
878
+ #line 361 "pitchfork_http.rl"
904
879
  {
905
880
  VALUE val;
906
881
 
@@ -911,23 +886,12 @@ tr117:
911
886
  if (!STR_CSTR_EQ(val, "*"))
912
887
  rb_hash_aset(hp->env, g_path_info, val);
913
888
  }
914
- #line 332 "pitchfork_http.rl"
889
+ #line 342 "pitchfork_http.rl"
915
890
  {
916
- VALUE str;
917
-
918
891
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
919
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
920
- /*
921
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
922
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
923
- */
924
- if (STR_CSTR_EQ(str, "*")) {
925
- str = rb_str_new(NULL, 0);
926
- rb_hash_aset(hp->env, g_path_info, str);
927
- rb_hash_aset(hp->env, g_request_path, str);
928
- }
892
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
929
893
  }
930
- #line 372 "pitchfork_http.rl"
894
+ #line 376 "pitchfork_http.rl"
931
895
  {
932
896
  finalize_header(hp);
933
897
 
@@ -948,30 +912,19 @@ tr117:
948
912
  }
949
913
  goto st122;
950
914
  tr124:
951
- #line 351 "pitchfork_http.rl"
915
+ #line 355 "pitchfork_http.rl"
952
916
  {MARK(start.query, p); }
953
- #line 352 "pitchfork_http.rl"
917
+ #line 356 "pitchfork_http.rl"
954
918
  {
955
919
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
956
920
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
957
921
  }
958
- #line 332 "pitchfork_http.rl"
922
+ #line 342 "pitchfork_http.rl"
959
923
  {
960
- VALUE str;
961
-
962
924
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
963
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
964
- /*
965
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
966
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
967
- */
968
- if (STR_CSTR_EQ(str, "*")) {
969
- str = rb_str_new(NULL, 0);
970
- rb_hash_aset(hp->env, g_path_info, str);
971
- rb_hash_aset(hp->env, g_request_path, str);
972
- }
925
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
973
926
  }
974
- #line 372 "pitchfork_http.rl"
927
+ #line 376 "pitchfork_http.rl"
975
928
  {
976
929
  finalize_header(hp);
977
930
 
@@ -992,28 +945,17 @@ tr124:
992
945
  }
993
946
  goto st122;
994
947
  tr129:
995
- #line 352 "pitchfork_http.rl"
948
+ #line 356 "pitchfork_http.rl"
996
949
  {
997
950
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
998
951
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
999
952
  }
1000
- #line 332 "pitchfork_http.rl"
953
+ #line 342 "pitchfork_http.rl"
1001
954
  {
1002
- VALUE str;
1003
-
1004
955
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1005
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1006
- /*
1007
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1008
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1009
- */
1010
- if (STR_CSTR_EQ(str, "*")) {
1011
- str = rb_str_new(NULL, 0);
1012
- rb_hash_aset(hp->env, g_path_info, str);
1013
- rb_hash_aset(hp->env, g_request_path, str);
1014
- }
956
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1015
957
  }
1016
- #line 372 "pitchfork_http.rl"
958
+ #line 376 "pitchfork_http.rl"
1017
959
  {
1018
960
  finalize_header(hp);
1019
961
 
@@ -1037,44 +979,43 @@ st122:
1037
979
  if ( ++p == pe )
1038
980
  goto _test_eof122;
1039
981
  case 122:
1040
- #line 1041 "pitchfork_http.c"
982
+ #line 983 "pitchfork_http.c"
1041
983
  goto st0;
1042
984
  tr105:
1043
- #line 332 "pitchfork_http.rl"
985
+ #line 342 "pitchfork_http.rl"
1044
986
  {
1045
- VALUE str;
1046
-
1047
987
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1048
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1049
- /*
1050
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1051
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1052
- */
1053
- if (STR_CSTR_EQ(str, "*")) {
1054
- str = rb_str_new(NULL, 0);
1055
- rb_hash_aset(hp->env, g_path_info, str);
1056
- rb_hash_aset(hp->env, g_request_path, str);
1057
- }
988
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1058
989
  }
1059
990
  goto st18;
1060
991
  tr109:
1061
- #line 318 "pitchfork_http.rl"
992
+ #line 328 "pitchfork_http.rl"
1062
993
  {MARK(mark, p); }
1063
- #line 347 "pitchfork_http.rl"
994
+ #line 346 "pitchfork_http.rl"
1064
995
  {
1065
996
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
1066
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
997
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
998
+ if (STR_CSTR_EQ(str, "*")) {
999
+ VALUE str = rb_str_new("*", 1);
1000
+ rb_hash_aset(hp->env, g_path_info, str);
1001
+ rb_hash_aset(hp->env, g_request_path, str);
1002
+ }
1067
1003
  }
1068
1004
  goto st18;
1069
1005
  tr113:
1070
- #line 347 "pitchfork_http.rl"
1006
+ #line 346 "pitchfork_http.rl"
1071
1007
  {
1072
1008
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
1073
- rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
1009
+ VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
1010
+ if (STR_CSTR_EQ(str, "*")) {
1011
+ VALUE str = rb_str_new("*", 1);
1012
+ rb_hash_aset(hp->env, g_path_info, str);
1013
+ rb_hash_aset(hp->env, g_request_path, str);
1014
+ }
1074
1015
  }
1075
1016
  goto st18;
1076
1017
  tr118:
1077
- #line 357 "pitchfork_http.rl"
1018
+ #line 361 "pitchfork_http.rl"
1078
1019
  {
1079
1020
  VALUE val;
1080
1021
 
@@ -1085,94 +1026,61 @@ tr118:
1085
1026
  if (!STR_CSTR_EQ(val, "*"))
1086
1027
  rb_hash_aset(hp->env, g_path_info, val);
1087
1028
  }
1088
- #line 332 "pitchfork_http.rl"
1029
+ #line 342 "pitchfork_http.rl"
1089
1030
  {
1090
- VALUE str;
1091
-
1092
1031
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1093
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1094
- /*
1095
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1096
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1097
- */
1098
- if (STR_CSTR_EQ(str, "*")) {
1099
- str = rb_str_new(NULL, 0);
1100
- rb_hash_aset(hp->env, g_path_info, str);
1101
- rb_hash_aset(hp->env, g_request_path, str);
1102
- }
1032
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1103
1033
  }
1104
1034
  goto st18;
1105
1035
  tr125:
1106
- #line 351 "pitchfork_http.rl"
1036
+ #line 355 "pitchfork_http.rl"
1107
1037
  {MARK(start.query, p); }
1108
- #line 352 "pitchfork_http.rl"
1038
+ #line 356 "pitchfork_http.rl"
1109
1039
  {
1110
1040
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1111
1041
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1112
1042
  }
1113
- #line 332 "pitchfork_http.rl"
1043
+ #line 342 "pitchfork_http.rl"
1114
1044
  {
1115
- VALUE str;
1116
-
1117
1045
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1118
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1119
- /*
1120
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1121
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1122
- */
1123
- if (STR_CSTR_EQ(str, "*")) {
1124
- str = rb_str_new(NULL, 0);
1125
- rb_hash_aset(hp->env, g_path_info, str);
1126
- rb_hash_aset(hp->env, g_request_path, str);
1127
- }
1046
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1128
1047
  }
1129
1048
  goto st18;
1130
1049
  tr130:
1131
- #line 352 "pitchfork_http.rl"
1050
+ #line 356 "pitchfork_http.rl"
1132
1051
  {
1133
1052
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1134
1053
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1135
1054
  }
1136
- #line 332 "pitchfork_http.rl"
1055
+ #line 342 "pitchfork_http.rl"
1137
1056
  {
1138
- VALUE str;
1139
-
1140
1057
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1141
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1142
- /*
1143
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1144
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1145
- */
1146
- if (STR_CSTR_EQ(str, "*")) {
1147
- str = rb_str_new(NULL, 0);
1148
- rb_hash_aset(hp->env, g_path_info, str);
1149
- rb_hash_aset(hp->env, g_request_path, str);
1150
- }
1058
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1151
1059
  }
1152
1060
  goto st18;
1153
1061
  st18:
1154
1062
  if ( ++p == pe )
1155
1063
  goto _test_eof18;
1156
1064
  case 18:
1157
- #line 1158 "pitchfork_http.c"
1065
+ #line 1066 "pitchfork_http.c"
1158
1066
  if ( (*p) == 10 )
1159
1067
  goto tr21;
1160
1068
  goto st0;
1161
1069
  tr23:
1162
- #line 320 "pitchfork_http.rl"
1070
+ #line 330 "pitchfork_http.rl"
1163
1071
  { MARK(start.field, p); }
1164
- #line 321 "pitchfork_http.rl"
1072
+ #line 331 "pitchfork_http.rl"
1165
1073
  { snake_upcase_char(deconst(p)); }
1166
1074
  goto st19;
1167
1075
  tr32:
1168
- #line 321 "pitchfork_http.rl"
1076
+ #line 331 "pitchfork_http.rl"
1169
1077
  { snake_upcase_char(deconst(p)); }
1170
1078
  goto st19;
1171
1079
  st19:
1172
1080
  if ( ++p == pe )
1173
1081
  goto _test_eof19;
1174
1082
  case 19:
1175
- #line 1176 "pitchfork_http.c"
1083
+ #line 1084 "pitchfork_http.c"
1176
1084
  switch( (*p) ) {
1177
1085
  case 33: goto tr32;
1178
1086
  case 58: goto tr33;
@@ -1198,18 +1106,18 @@ case 19:
1198
1106
  goto tr32;
1199
1107
  goto st0;
1200
1108
  tr35:
1201
- #line 324 "pitchfork_http.rl"
1109
+ #line 334 "pitchfork_http.rl"
1202
1110
  { MARK(mark, p); }
1203
1111
  goto st20;
1204
1112
  tr33:
1205
- #line 323 "pitchfork_http.rl"
1113
+ #line 333 "pitchfork_http.rl"
1206
1114
  { hp->s.field_len = LEN(start.field, p); }
1207
1115
  goto st20;
1208
1116
  st20:
1209
1117
  if ( ++p == pe )
1210
1118
  goto _test_eof20;
1211
1119
  case 20:
1212
- #line 1213 "pitchfork_http.c"
1120
+ #line 1121 "pitchfork_http.c"
1213
1121
  switch( (*p) ) {
1214
1122
  case 9: goto tr35;
1215
1123
  case 10: goto tr36;
@@ -1221,14 +1129,14 @@ case 20:
1221
1129
  goto st0;
1222
1130
  goto tr34;
1223
1131
  tr34:
1224
- #line 324 "pitchfork_http.rl"
1132
+ #line 334 "pitchfork_http.rl"
1225
1133
  { MARK(mark, p); }
1226
1134
  goto st21;
1227
1135
  st21:
1228
1136
  if ( ++p == pe )
1229
1137
  goto _test_eof21;
1230
1138
  case 21:
1231
- #line 1232 "pitchfork_http.c"
1139
+ #line 1140 "pitchfork_http.c"
1232
1140
  switch( (*p) ) {
1233
1141
  case 10: goto tr39;
1234
1142
  case 13: goto tr40;
@@ -1241,25 +1149,14 @@ case 21:
1241
1149
  goto st0;
1242
1150
  goto st21;
1243
1151
  tr9:
1244
- #line 332 "pitchfork_http.rl"
1152
+ #line 342 "pitchfork_http.rl"
1245
1153
  {
1246
- VALUE str;
1247
-
1248
1154
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1249
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1250
- /*
1251
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1252
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1253
- */
1254
- if (STR_CSTR_EQ(str, "*")) {
1255
- str = rb_str_new(NULL, 0);
1256
- rb_hash_aset(hp->env, g_path_info, str);
1257
- rb_hash_aset(hp->env, g_request_path, str);
1258
- }
1155
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1259
1156
  }
1260
1157
  goto st22;
1261
1158
  tr50:
1262
- #line 357 "pitchfork_http.rl"
1159
+ #line 361 "pitchfork_http.rl"
1263
1160
  {
1264
1161
  VALUE val;
1265
1162
 
@@ -1270,76 +1167,43 @@ tr50:
1270
1167
  if (!STR_CSTR_EQ(val, "*"))
1271
1168
  rb_hash_aset(hp->env, g_path_info, val);
1272
1169
  }
1273
- #line 332 "pitchfork_http.rl"
1170
+ #line 342 "pitchfork_http.rl"
1274
1171
  {
1275
- VALUE str;
1276
-
1277
1172
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1278
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1279
- /*
1280
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1281
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1282
- */
1283
- if (STR_CSTR_EQ(str, "*")) {
1284
- str = rb_str_new(NULL, 0);
1285
- rb_hash_aset(hp->env, g_path_info, str);
1286
- rb_hash_aset(hp->env, g_request_path, str);
1287
- }
1173
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1288
1174
  }
1289
1175
  goto st22;
1290
1176
  tr56:
1291
- #line 351 "pitchfork_http.rl"
1177
+ #line 355 "pitchfork_http.rl"
1292
1178
  {MARK(start.query, p); }
1293
- #line 352 "pitchfork_http.rl"
1179
+ #line 356 "pitchfork_http.rl"
1294
1180
  {
1295
1181
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1296
1182
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1297
1183
  }
1298
- #line 332 "pitchfork_http.rl"
1184
+ #line 342 "pitchfork_http.rl"
1299
1185
  {
1300
- VALUE str;
1301
-
1302
1186
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1303
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1304
- /*
1305
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1306
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1307
- */
1308
- if (STR_CSTR_EQ(str, "*")) {
1309
- str = rb_str_new(NULL, 0);
1310
- rb_hash_aset(hp->env, g_path_info, str);
1311
- rb_hash_aset(hp->env, g_request_path, str);
1312
- }
1187
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1313
1188
  }
1314
1189
  goto st22;
1315
1190
  tr60:
1316
- #line 352 "pitchfork_http.rl"
1191
+ #line 356 "pitchfork_http.rl"
1317
1192
  {
1318
1193
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1319
1194
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1320
1195
  }
1321
- #line 332 "pitchfork_http.rl"
1196
+ #line 342 "pitchfork_http.rl"
1322
1197
  {
1323
- VALUE str;
1324
-
1325
1198
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
1326
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1327
- /*
1328
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
1329
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
1330
- */
1331
- if (STR_CSTR_EQ(str, "*")) {
1332
- str = rb_str_new(NULL, 0);
1333
- rb_hash_aset(hp->env, g_path_info, str);
1334
- rb_hash_aset(hp->env, g_request_path, str);
1335
- }
1199
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
1336
1200
  }
1337
1201
  goto st22;
1338
1202
  st22:
1339
1203
  if ( ++p == pe )
1340
1204
  goto _test_eof22;
1341
1205
  case 22:
1342
- #line 1343 "pitchfork_http.c"
1206
+ #line 1207 "pitchfork_http.c"
1343
1207
  switch( (*p) ) {
1344
1208
  case 32: goto tr42;
1345
1209
  case 35: goto st0;
@@ -1350,14 +1214,14 @@ case 22:
1350
1214
  goto st0;
1351
1215
  goto tr41;
1352
1216
  tr41:
1353
- #line 318 "pitchfork_http.rl"
1217
+ #line 328 "pitchfork_http.rl"
1354
1218
  {MARK(mark, p); }
1355
1219
  goto st23;
1356
1220
  st23:
1357
1221
  if ( ++p == pe )
1358
1222
  goto _test_eof23;
1359
1223
  case 23:
1360
- #line 1361 "pitchfork_http.c"
1224
+ #line 1225 "pitchfork_http.c"
1361
1225
  switch( (*p) ) {
1362
1226
  case 32: goto tr45;
1363
1227
  case 35: goto st0;
@@ -1368,14 +1232,14 @@ case 23:
1368
1232
  goto st0;
1369
1233
  goto st23;
1370
1234
  tr43:
1371
- #line 318 "pitchfork_http.rl"
1235
+ #line 328 "pitchfork_http.rl"
1372
1236
  {MARK(mark, p); }
1373
1237
  goto st24;
1374
1238
  st24:
1375
1239
  if ( ++p == pe )
1376
1240
  goto _test_eof24;
1377
1241
  case 24:
1378
- #line 1379 "pitchfork_http.c"
1242
+ #line 1243 "pitchfork_http.c"
1379
1243
  if ( (*p) < 65 ) {
1380
1244
  if ( 48 <= (*p) && (*p) <= 57 )
1381
1245
  goto st25;
@@ -1399,20 +1263,20 @@ case 25:
1399
1263
  goto st23;
1400
1264
  goto st0;
1401
1265
  tr6:
1402
- #line 318 "pitchfork_http.rl"
1266
+ #line 328 "pitchfork_http.rl"
1403
1267
  {MARK(mark, p); }
1404
1268
  goto st26;
1405
1269
  tr76:
1406
- #line 331 "pitchfork_http.rl"
1270
+ #line 341 "pitchfork_http.rl"
1407
1271
  { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
1408
- #line 318 "pitchfork_http.rl"
1272
+ #line 328 "pitchfork_http.rl"
1409
1273
  {MARK(mark, p); }
1410
1274
  goto st26;
1411
1275
  st26:
1412
1276
  if ( ++p == pe )
1413
1277
  goto _test_eof26;
1414
1278
  case 26:
1415
- #line 1416 "pitchfork_http.c"
1279
+ #line 1280 "pitchfork_http.c"
1416
1280
  switch( (*p) ) {
1417
1281
  case 32: goto tr49;
1418
1282
  case 35: goto tr50;
@@ -1450,7 +1314,7 @@ case 28:
1450
1314
  goto st26;
1451
1315
  goto st0;
1452
1316
  tr52:
1453
- #line 357 "pitchfork_http.rl"
1317
+ #line 361 "pitchfork_http.rl"
1454
1318
  {
1455
1319
  VALUE val;
1456
1320
 
@@ -1466,7 +1330,7 @@ st29:
1466
1330
  if ( ++p == pe )
1467
1331
  goto _test_eof29;
1468
1332
  case 29:
1469
- #line 1470 "pitchfork_http.c"
1333
+ #line 1334 "pitchfork_http.c"
1470
1334
  switch( (*p) ) {
1471
1335
  case 32: goto tr55;
1472
1336
  case 35: goto tr56;
@@ -1477,14 +1341,14 @@ case 29:
1477
1341
  goto st0;
1478
1342
  goto tr54;
1479
1343
  tr54:
1480
- #line 351 "pitchfork_http.rl"
1344
+ #line 355 "pitchfork_http.rl"
1481
1345
  {MARK(start.query, p); }
1482
1346
  goto st30;
1483
1347
  st30:
1484
1348
  if ( ++p == pe )
1485
1349
  goto _test_eof30;
1486
1350
  case 30:
1487
- #line 1488 "pitchfork_http.c"
1351
+ #line 1352 "pitchfork_http.c"
1488
1352
  switch( (*p) ) {
1489
1353
  case 32: goto tr59;
1490
1354
  case 35: goto tr60;
@@ -1495,14 +1359,14 @@ case 30:
1495
1359
  goto st0;
1496
1360
  goto st30;
1497
1361
  tr57:
1498
- #line 351 "pitchfork_http.rl"
1362
+ #line 355 "pitchfork_http.rl"
1499
1363
  {MARK(start.query, p); }
1500
1364
  goto st31;
1501
1365
  st31:
1502
1366
  if ( ++p == pe )
1503
1367
  goto _test_eof31;
1504
1368
  case 31:
1505
- #line 1506 "pitchfork_http.c"
1369
+ #line 1370 "pitchfork_http.c"
1506
1370
  if ( (*p) < 65 ) {
1507
1371
  if ( 48 <= (*p) && (*p) <= 57 )
1508
1372
  goto st32;
@@ -1526,58 +1390,58 @@ case 32:
1526
1390
  goto st30;
1527
1391
  goto st0;
1528
1392
  tr7:
1529
- #line 318 "pitchfork_http.rl"
1393
+ #line 328 "pitchfork_http.rl"
1530
1394
  {MARK(mark, p); }
1531
- #line 322 "pitchfork_http.rl"
1395
+ #line 332 "pitchfork_http.rl"
1532
1396
  { downcase_char(deconst(p)); }
1533
1397
  goto st33;
1534
1398
  st33:
1535
1399
  if ( ++p == pe )
1536
1400
  goto _test_eof33;
1537
1401
  case 33:
1538
- #line 1539 "pitchfork_http.c"
1402
+ #line 1403 "pitchfork_http.c"
1539
1403
  switch( (*p) ) {
1540
1404
  case 84: goto tr63;
1541
1405
  case 116: goto tr63;
1542
1406
  }
1543
1407
  goto st0;
1544
1408
  tr63:
1545
- #line 322 "pitchfork_http.rl"
1409
+ #line 332 "pitchfork_http.rl"
1546
1410
  { downcase_char(deconst(p)); }
1547
1411
  goto st34;
1548
1412
  st34:
1549
1413
  if ( ++p == pe )
1550
1414
  goto _test_eof34;
1551
1415
  case 34:
1552
- #line 1553 "pitchfork_http.c"
1416
+ #line 1417 "pitchfork_http.c"
1553
1417
  switch( (*p) ) {
1554
1418
  case 84: goto tr64;
1555
1419
  case 116: goto tr64;
1556
1420
  }
1557
1421
  goto st0;
1558
1422
  tr64:
1559
- #line 322 "pitchfork_http.rl"
1423
+ #line 332 "pitchfork_http.rl"
1560
1424
  { downcase_char(deconst(p)); }
1561
1425
  goto st35;
1562
1426
  st35:
1563
1427
  if ( ++p == pe )
1564
1428
  goto _test_eof35;
1565
1429
  case 35:
1566
- #line 1567 "pitchfork_http.c"
1430
+ #line 1431 "pitchfork_http.c"
1567
1431
  switch( (*p) ) {
1568
1432
  case 80: goto tr65;
1569
1433
  case 112: goto tr65;
1570
1434
  }
1571
1435
  goto st0;
1572
1436
  tr65:
1573
- #line 322 "pitchfork_http.rl"
1437
+ #line 332 "pitchfork_http.rl"
1574
1438
  { downcase_char(deconst(p)); }
1575
1439
  goto st36;
1576
1440
  st36:
1577
1441
  if ( ++p == pe )
1578
1442
  goto _test_eof36;
1579
1443
  case 36:
1580
- #line 1581 "pitchfork_http.c"
1444
+ #line 1445 "pitchfork_http.c"
1581
1445
  switch( (*p) ) {
1582
1446
  case 58: goto tr66;
1583
1447
  case 83: goto tr67;
@@ -1585,7 +1449,7 @@ case 36:
1585
1449
  }
1586
1450
  goto st0;
1587
1451
  tr66:
1588
- #line 328 "pitchfork_http.rl"
1452
+ #line 338 "pitchfork_http.rl"
1589
1453
  {
1590
1454
  rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
1591
1455
  }
@@ -1594,7 +1458,7 @@ st37:
1594
1458
  if ( ++p == pe )
1595
1459
  goto _test_eof37;
1596
1460
  case 37:
1597
- #line 1598 "pitchfork_http.c"
1461
+ #line 1462 "pitchfork_http.c"
1598
1462
  if ( (*p) == 47 )
1599
1463
  goto st38;
1600
1464
  goto st0;
@@ -1682,14 +1546,14 @@ case 42:
1682
1546
  goto st40;
1683
1547
  goto st0;
1684
1548
  tr72:
1685
- #line 318 "pitchfork_http.rl"
1549
+ #line 328 "pitchfork_http.rl"
1686
1550
  {MARK(mark, p); }
1687
1551
  goto st43;
1688
1552
  st43:
1689
1553
  if ( ++p == pe )
1690
1554
  goto _test_eof43;
1691
1555
  case 43:
1692
- #line 1693 "pitchfork_http.c"
1556
+ #line 1557 "pitchfork_http.c"
1693
1557
  switch( (*p) ) {
1694
1558
  case 37: goto st41;
1695
1559
  case 47: goto tr76;
@@ -1741,14 +1605,14 @@ case 44:
1741
1605
  goto st0;
1742
1606
  goto st40;
1743
1607
  tr73:
1744
- #line 318 "pitchfork_http.rl"
1608
+ #line 328 "pitchfork_http.rl"
1745
1609
  {MARK(mark, p); }
1746
1610
  goto st45;
1747
1611
  st45:
1748
1612
  if ( ++p == pe )
1749
1613
  goto _test_eof45;
1750
1614
  case 45:
1751
- #line 1752 "pitchfork_http.c"
1615
+ #line 1616 "pitchfork_http.c"
1752
1616
  switch( (*p) ) {
1753
1617
  case 37: goto st41;
1754
1618
  case 47: goto st0;
@@ -1826,14 +1690,14 @@ case 47:
1826
1690
  goto st0;
1827
1691
  goto st40;
1828
1692
  tr67:
1829
- #line 322 "pitchfork_http.rl"
1693
+ #line 332 "pitchfork_http.rl"
1830
1694
  { downcase_char(deconst(p)); }
1831
1695
  goto st48;
1832
1696
  st48:
1833
1697
  if ( ++p == pe )
1834
1698
  goto _test_eof48;
1835
1699
  case 48:
1836
- #line 1837 "pitchfork_http.c"
1700
+ #line 1701 "pitchfork_http.c"
1837
1701
  if ( (*p) == 58 )
1838
1702
  goto tr66;
1839
1703
  goto st0;
@@ -2349,14 +2213,14 @@ case 67:
2349
2213
  goto tr3;
2350
2214
  goto st0;
2351
2215
  tr2:
2352
- #line 318 "pitchfork_http.rl"
2216
+ #line 328 "pitchfork_http.rl"
2353
2217
  {MARK(mark, p); }
2354
2218
  goto st68;
2355
2219
  st68:
2356
2220
  if ( ++p == pe )
2357
2221
  goto _test_eof68;
2358
2222
  case 68:
2359
- #line 2360 "pitchfork_http.c"
2223
+ #line 2224 "pitchfork_http.c"
2360
2224
  switch( (*p) ) {
2361
2225
  case 32: goto tr3;
2362
2226
  case 33: goto st49;
@@ -2440,14 +2304,14 @@ case 70:
2440
2304
  goto st51;
2441
2305
  goto st0;
2442
2306
  tr100:
2443
- #line 327 "pitchfork_http.rl"
2307
+ #line 337 "pitchfork_http.rl"
2444
2308
  { request_method(hp, PTR_TO(mark), LEN(mark, p)); }
2445
2309
  goto st71;
2446
2310
  st71:
2447
2311
  if ( ++p == pe )
2448
2312
  goto _test_eof71;
2449
2313
  case 71:
2450
- #line 2451 "pitchfork_http.c"
2314
+ #line 2315 "pitchfork_http.c"
2451
2315
  switch( (*p) ) {
2452
2316
  case 42: goto tr101;
2453
2317
  case 47: goto tr102;
@@ -2456,14 +2320,14 @@ case 71:
2456
2320
  }
2457
2321
  goto st0;
2458
2322
  tr101:
2459
- #line 318 "pitchfork_http.rl"
2323
+ #line 328 "pitchfork_http.rl"
2460
2324
  {MARK(mark, p); }
2461
2325
  goto st72;
2462
2326
  st72:
2463
2327
  if ( ++p == pe )
2464
2328
  goto _test_eof72;
2465
2329
  case 72:
2466
- #line 2467 "pitchfork_http.c"
2330
+ #line 2331 "pitchfork_http.c"
2467
2331
  switch( (*p) ) {
2468
2332
  case 10: goto tr104;
2469
2333
  case 13: goto tr105;
@@ -2472,25 +2336,14 @@ case 72:
2472
2336
  }
2473
2337
  goto st0;
2474
2338
  tr106:
2475
- #line 332 "pitchfork_http.rl"
2339
+ #line 342 "pitchfork_http.rl"
2476
2340
  {
2477
- VALUE str;
2478
-
2479
2341
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
2480
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2481
- /*
2482
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
2483
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
2484
- */
2485
- if (STR_CSTR_EQ(str, "*")) {
2486
- str = rb_str_new(NULL, 0);
2487
- rb_hash_aset(hp->env, g_path_info, str);
2488
- rb_hash_aset(hp->env, g_request_path, str);
2489
- }
2342
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2490
2343
  }
2491
2344
  goto st73;
2492
2345
  tr119:
2493
- #line 357 "pitchfork_http.rl"
2346
+ #line 361 "pitchfork_http.rl"
2494
2347
  {
2495
2348
  VALUE val;
2496
2349
 
@@ -2501,76 +2354,43 @@ tr119:
2501
2354
  if (!STR_CSTR_EQ(val, "*"))
2502
2355
  rb_hash_aset(hp->env, g_path_info, val);
2503
2356
  }
2504
- #line 332 "pitchfork_http.rl"
2357
+ #line 342 "pitchfork_http.rl"
2505
2358
  {
2506
- VALUE str;
2507
-
2508
2359
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
2509
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2510
- /*
2511
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
2512
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
2513
- */
2514
- if (STR_CSTR_EQ(str, "*")) {
2515
- str = rb_str_new(NULL, 0);
2516
- rb_hash_aset(hp->env, g_path_info, str);
2517
- rb_hash_aset(hp->env, g_request_path, str);
2518
- }
2360
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2519
2361
  }
2520
2362
  goto st73;
2521
2363
  tr126:
2522
- #line 351 "pitchfork_http.rl"
2364
+ #line 355 "pitchfork_http.rl"
2523
2365
  {MARK(start.query, p); }
2524
- #line 352 "pitchfork_http.rl"
2366
+ #line 356 "pitchfork_http.rl"
2525
2367
  {
2526
2368
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
2527
2369
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
2528
2370
  }
2529
- #line 332 "pitchfork_http.rl"
2371
+ #line 342 "pitchfork_http.rl"
2530
2372
  {
2531
- VALUE str;
2532
-
2533
2373
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
2534
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2535
- /*
2536
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
2537
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
2538
- */
2539
- if (STR_CSTR_EQ(str, "*")) {
2540
- str = rb_str_new(NULL, 0);
2541
- rb_hash_aset(hp->env, g_path_info, str);
2542
- rb_hash_aset(hp->env, g_request_path, str);
2543
- }
2374
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2544
2375
  }
2545
2376
  goto st73;
2546
2377
  tr131:
2547
- #line 352 "pitchfork_http.rl"
2378
+ #line 356 "pitchfork_http.rl"
2548
2379
  {
2549
2380
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
2550
2381
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
2551
2382
  }
2552
- #line 332 "pitchfork_http.rl"
2383
+ #line 342 "pitchfork_http.rl"
2553
2384
  {
2554
- VALUE str;
2555
-
2556
2385
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
2557
- str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2558
- /*
2559
- * "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
2560
- * in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
2561
- */
2562
- if (STR_CSTR_EQ(str, "*")) {
2563
- str = rb_str_new(NULL, 0);
2564
- rb_hash_aset(hp->env, g_path_info, str);
2565
- rb_hash_aset(hp->env, g_request_path, str);
2566
- }
2386
+ rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
2567
2387
  }
2568
2388
  goto st73;
2569
2389
  st73:
2570
2390
  if ( ++p == pe )
2571
2391
  goto _test_eof73;
2572
2392
  case 73:
2573
- #line 2574 "pitchfork_http.c"
2393
+ #line 2394 "pitchfork_http.c"
2574
2394
  switch( (*p) ) {
2575
2395
  case 10: goto tr108;
2576
2396
  case 13: goto tr109;
@@ -2583,14 +2403,14 @@ case 73:
2583
2403
  goto st0;
2584
2404
  goto tr107;
2585
2405
  tr107:
2586
- #line 318 "pitchfork_http.rl"
2406
+ #line 328 "pitchfork_http.rl"
2587
2407
  {MARK(mark, p); }
2588
2408
  goto st74;
2589
2409
  st74:
2590
2410
  if ( ++p == pe )
2591
2411
  goto _test_eof74;
2592
2412
  case 74:
2593
- #line 2594 "pitchfork_http.c"
2413
+ #line 2414 "pitchfork_http.c"
2594
2414
  switch( (*p) ) {
2595
2415
  case 10: goto tr112;
2596
2416
  case 13: goto tr113;
@@ -2603,14 +2423,14 @@ case 74:
2603
2423
  goto st0;
2604
2424
  goto st74;
2605
2425
  tr110:
2606
- #line 318 "pitchfork_http.rl"
2426
+ #line 328 "pitchfork_http.rl"
2607
2427
  {MARK(mark, p); }
2608
2428
  goto st75;
2609
2429
  st75:
2610
2430
  if ( ++p == pe )
2611
2431
  goto _test_eof75;
2612
2432
  case 75:
2613
- #line 2614 "pitchfork_http.c"
2433
+ #line 2434 "pitchfork_http.c"
2614
2434
  if ( (*p) < 65 ) {
2615
2435
  if ( 48 <= (*p) && (*p) <= 57 )
2616
2436
  goto st76;
@@ -2634,20 +2454,20 @@ case 76:
2634
2454
  goto st74;
2635
2455
  goto st0;
2636
2456
  tr102:
2637
- #line 318 "pitchfork_http.rl"
2457
+ #line 328 "pitchfork_http.rl"
2638
2458
  {MARK(mark, p); }
2639
2459
  goto st77;
2640
2460
  tr147:
2641
- #line 331 "pitchfork_http.rl"
2461
+ #line 341 "pitchfork_http.rl"
2642
2462
  { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
2643
- #line 318 "pitchfork_http.rl"
2463
+ #line 328 "pitchfork_http.rl"
2644
2464
  {MARK(mark, p); }
2645
2465
  goto st77;
2646
2466
  st77:
2647
2467
  if ( ++p == pe )
2648
2468
  goto _test_eof77;
2649
2469
  case 77:
2650
- #line 2651 "pitchfork_http.c"
2470
+ #line 2471 "pitchfork_http.c"
2651
2471
  switch( (*p) ) {
2652
2472
  case 10: goto tr117;
2653
2473
  case 13: goto tr118;
@@ -2687,7 +2507,7 @@ case 79:
2687
2507
  goto st77;
2688
2508
  goto st0;
2689
2509
  tr121:
2690
- #line 357 "pitchfork_http.rl"
2510
+ #line 361 "pitchfork_http.rl"
2691
2511
  {
2692
2512
  VALUE val;
2693
2513
 
@@ -2703,7 +2523,7 @@ st80:
2703
2523
  if ( ++p == pe )
2704
2524
  goto _test_eof80;
2705
2525
  case 80:
2706
- #line 2707 "pitchfork_http.c"
2526
+ #line 2527 "pitchfork_http.c"
2707
2527
  switch( (*p) ) {
2708
2528
  case 10: goto tr124;
2709
2529
  case 13: goto tr125;
@@ -2716,14 +2536,14 @@ case 80:
2716
2536
  goto st0;
2717
2537
  goto tr123;
2718
2538
  tr123:
2719
- #line 351 "pitchfork_http.rl"
2539
+ #line 355 "pitchfork_http.rl"
2720
2540
  {MARK(start.query, p); }
2721
2541
  goto st81;
2722
2542
  st81:
2723
2543
  if ( ++p == pe )
2724
2544
  goto _test_eof81;
2725
2545
  case 81:
2726
- #line 2727 "pitchfork_http.c"
2546
+ #line 2547 "pitchfork_http.c"
2727
2547
  switch( (*p) ) {
2728
2548
  case 10: goto tr129;
2729
2549
  case 13: goto tr130;
@@ -2736,14 +2556,14 @@ case 81:
2736
2556
  goto st0;
2737
2557
  goto st81;
2738
2558
  tr127:
2739
- #line 351 "pitchfork_http.rl"
2559
+ #line 355 "pitchfork_http.rl"
2740
2560
  {MARK(start.query, p); }
2741
2561
  goto st82;
2742
2562
  st82:
2743
2563
  if ( ++p == pe )
2744
2564
  goto _test_eof82;
2745
2565
  case 82:
2746
- #line 2747 "pitchfork_http.c"
2566
+ #line 2567 "pitchfork_http.c"
2747
2567
  if ( (*p) < 65 ) {
2748
2568
  if ( 48 <= (*p) && (*p) <= 57 )
2749
2569
  goto st83;
@@ -2767,58 +2587,58 @@ case 83:
2767
2587
  goto st81;
2768
2588
  goto st0;
2769
2589
  tr103:
2770
- #line 318 "pitchfork_http.rl"
2590
+ #line 328 "pitchfork_http.rl"
2771
2591
  {MARK(mark, p); }
2772
- #line 322 "pitchfork_http.rl"
2592
+ #line 332 "pitchfork_http.rl"
2773
2593
  { downcase_char(deconst(p)); }
2774
2594
  goto st84;
2775
2595
  st84:
2776
2596
  if ( ++p == pe )
2777
2597
  goto _test_eof84;
2778
2598
  case 84:
2779
- #line 2780 "pitchfork_http.c"
2599
+ #line 2600 "pitchfork_http.c"
2780
2600
  switch( (*p) ) {
2781
2601
  case 84: goto tr134;
2782
2602
  case 116: goto tr134;
2783
2603
  }
2784
2604
  goto st0;
2785
2605
  tr134:
2786
- #line 322 "pitchfork_http.rl"
2606
+ #line 332 "pitchfork_http.rl"
2787
2607
  { downcase_char(deconst(p)); }
2788
2608
  goto st85;
2789
2609
  st85:
2790
2610
  if ( ++p == pe )
2791
2611
  goto _test_eof85;
2792
2612
  case 85:
2793
- #line 2794 "pitchfork_http.c"
2613
+ #line 2614 "pitchfork_http.c"
2794
2614
  switch( (*p) ) {
2795
2615
  case 84: goto tr135;
2796
2616
  case 116: goto tr135;
2797
2617
  }
2798
2618
  goto st0;
2799
2619
  tr135:
2800
- #line 322 "pitchfork_http.rl"
2620
+ #line 332 "pitchfork_http.rl"
2801
2621
  { downcase_char(deconst(p)); }
2802
2622
  goto st86;
2803
2623
  st86:
2804
2624
  if ( ++p == pe )
2805
2625
  goto _test_eof86;
2806
2626
  case 86:
2807
- #line 2808 "pitchfork_http.c"
2627
+ #line 2628 "pitchfork_http.c"
2808
2628
  switch( (*p) ) {
2809
2629
  case 80: goto tr136;
2810
2630
  case 112: goto tr136;
2811
2631
  }
2812
2632
  goto st0;
2813
2633
  tr136:
2814
- #line 322 "pitchfork_http.rl"
2634
+ #line 332 "pitchfork_http.rl"
2815
2635
  { downcase_char(deconst(p)); }
2816
2636
  goto st87;
2817
2637
  st87:
2818
2638
  if ( ++p == pe )
2819
2639
  goto _test_eof87;
2820
2640
  case 87:
2821
- #line 2822 "pitchfork_http.c"
2641
+ #line 2642 "pitchfork_http.c"
2822
2642
  switch( (*p) ) {
2823
2643
  case 58: goto tr137;
2824
2644
  case 83: goto tr138;
@@ -2826,7 +2646,7 @@ case 87:
2826
2646
  }
2827
2647
  goto st0;
2828
2648
  tr137:
2829
- #line 328 "pitchfork_http.rl"
2649
+ #line 338 "pitchfork_http.rl"
2830
2650
  {
2831
2651
  rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
2832
2652
  }
@@ -2835,7 +2655,7 @@ st88:
2835
2655
  if ( ++p == pe )
2836
2656
  goto _test_eof88;
2837
2657
  case 88:
2838
- #line 2839 "pitchfork_http.c"
2658
+ #line 2659 "pitchfork_http.c"
2839
2659
  if ( (*p) == 47 )
2840
2660
  goto st89;
2841
2661
  goto st0;
@@ -2923,14 +2743,14 @@ case 93:
2923
2743
  goto st91;
2924
2744
  goto st0;
2925
2745
  tr143:
2926
- #line 318 "pitchfork_http.rl"
2746
+ #line 328 "pitchfork_http.rl"
2927
2747
  {MARK(mark, p); }
2928
2748
  goto st94;
2929
2749
  st94:
2930
2750
  if ( ++p == pe )
2931
2751
  goto _test_eof94;
2932
2752
  case 94:
2933
- #line 2934 "pitchfork_http.c"
2753
+ #line 2754 "pitchfork_http.c"
2934
2754
  switch( (*p) ) {
2935
2755
  case 37: goto st92;
2936
2756
  case 47: goto tr147;
@@ -2982,14 +2802,14 @@ case 95:
2982
2802
  goto st0;
2983
2803
  goto st91;
2984
2804
  tr144:
2985
- #line 318 "pitchfork_http.rl"
2805
+ #line 328 "pitchfork_http.rl"
2986
2806
  {MARK(mark, p); }
2987
2807
  goto st96;
2988
2808
  st96:
2989
2809
  if ( ++p == pe )
2990
2810
  goto _test_eof96;
2991
2811
  case 96:
2992
- #line 2993 "pitchfork_http.c"
2812
+ #line 2813 "pitchfork_http.c"
2993
2813
  switch( (*p) ) {
2994
2814
  case 37: goto st92;
2995
2815
  case 47: goto st0;
@@ -3067,14 +2887,14 @@ case 98:
3067
2887
  goto st0;
3068
2888
  goto st91;
3069
2889
  tr138:
3070
- #line 322 "pitchfork_http.rl"
2890
+ #line 332 "pitchfork_http.rl"
3071
2891
  { downcase_char(deconst(p)); }
3072
2892
  goto st99;
3073
2893
  st99:
3074
2894
  if ( ++p == pe )
3075
2895
  goto _test_eof99;
3076
2896
  case 99:
3077
- #line 3078 "pitchfork_http.c"
2897
+ #line 2898 "pitchfork_http.c"
3078
2898
  if ( (*p) == 58 )
3079
2899
  goto tr137;
3080
2900
  goto st0;
@@ -3094,7 +2914,7 @@ case 100:
3094
2914
  goto tr152;
3095
2915
  goto st0;
3096
2916
  tr151:
3097
- #line 367 "pitchfork_http.rl"
2917
+ #line 371 "pitchfork_http.rl"
3098
2918
  {
3099
2919
  hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
3100
2920
  if (hp->len.chunk < 0)
@@ -3105,7 +2925,7 @@ st101:
3105
2925
  if ( ++p == pe )
3106
2926
  goto _test_eof101;
3107
2927
  case 101:
3108
- #line 3109 "pitchfork_http.c"
2928
+ #line 2929 "pitchfork_http.c"
3109
2929
  switch( (*p) ) {
3110
2930
  case 10: goto tr153;
3111
2931
  case 13: goto st102;
@@ -3122,7 +2942,7 @@ case 101:
3122
2942
  goto tr152;
3123
2943
  goto st0;
3124
2944
  tr153:
3125
- #line 396 "pitchfork_http.rl"
2945
+ #line 400 "pitchfork_http.rl"
3126
2946
  {
3127
2947
  HP_FL_SET(hp, INTRAILER);
3128
2948
  cs = http_parser_en_Trailers;
@@ -3135,7 +2955,7 @@ st123:
3135
2955
  if ( ++p == pe )
3136
2956
  goto _test_eof123;
3137
2957
  case 123:
3138
- #line 3139 "pitchfork_http.c"
2958
+ #line 2959 "pitchfork_http.c"
3139
2959
  goto st0;
3140
2960
  st102:
3141
2961
  if ( ++p == pe )
@@ -3145,7 +2965,7 @@ case 102:
3145
2965
  goto tr153;
3146
2966
  goto st0;
3147
2967
  tr152:
3148
- #line 367 "pitchfork_http.rl"
2968
+ #line 371 "pitchfork_http.rl"
3149
2969
  {
3150
2970
  hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
3151
2971
  if (hp->len.chunk < 0)
@@ -3156,7 +2976,7 @@ st103:
3156
2976
  if ( ++p == pe )
3157
2977
  goto _test_eof103;
3158
2978
  case 103:
3159
- #line 3160 "pitchfork_http.c"
2979
+ #line 2980 "pitchfork_http.c"
3160
2980
  switch( (*p) ) {
3161
2981
  case 10: goto st104;
3162
2982
  case 13: goto st107;
@@ -3177,7 +2997,7 @@ st104:
3177
2997
  case 104:
3178
2998
  goto tr159;
3179
2999
  tr159:
3180
- #line 404 "pitchfork_http.rl"
3000
+ #line 408 "pitchfork_http.rl"
3181
3001
  {
3182
3002
  skip_chunk_data_hack: {
3183
3003
  size_t nr = MIN((size_t)hp->len.chunk, REMAINING);
@@ -3199,7 +3019,7 @@ st105:
3199
3019
  if ( ++p == pe )
3200
3020
  goto _test_eof105;
3201
3021
  case 105:
3202
- #line 3203 "pitchfork_http.c"
3022
+ #line 3023 "pitchfork_http.c"
3203
3023
  switch( (*p) ) {
3204
3024
  case 10: goto st100;
3205
3025
  case 13: goto st106;
@@ -3406,30 +3226,30 @@ case 113:
3406
3226
  goto st113;
3407
3227
  goto st0;
3408
3228
  tr172:
3409
- #line 324 "pitchfork_http.rl"
3229
+ #line 334 "pitchfork_http.rl"
3410
3230
  { MARK(mark, p); }
3411
- #line 326 "pitchfork_http.rl"
3231
+ #line 336 "pitchfork_http.rl"
3412
3232
  { write_cont_value(hp, buffer, p); }
3413
3233
  goto st114;
3414
3234
  tr175:
3415
- #line 326 "pitchfork_http.rl"
3235
+ #line 336 "pitchfork_http.rl"
3416
3236
  { write_cont_value(hp, buffer, p); }
3417
3237
  goto st114;
3418
3238
  tr182:
3419
- #line 324 "pitchfork_http.rl"
3239
+ #line 334 "pitchfork_http.rl"
3420
3240
  { MARK(mark, p); }
3421
- #line 325 "pitchfork_http.rl"
3241
+ #line 335 "pitchfork_http.rl"
3422
3242
  { write_value(self, hp, buffer, p); }
3423
3243
  goto st114;
3424
3244
  tr185:
3425
- #line 325 "pitchfork_http.rl"
3245
+ #line 335 "pitchfork_http.rl"
3426
3246
  { write_value(self, hp, buffer, p); }
3427
3247
  goto st114;
3428
3248
  st114:
3429
3249
  if ( ++p == pe )
3430
3250
  goto _test_eof114;
3431
3251
  case 114:
3432
- #line 3433 "pitchfork_http.c"
3252
+ #line 3253 "pitchfork_http.c"
3433
3253
  switch( (*p) ) {
3434
3254
  case 9: goto st115;
3435
3255
  case 10: goto tr167;
@@ -3458,14 +3278,14 @@ case 114:
3458
3278
  goto tr169;
3459
3279
  goto st0;
3460
3280
  tr171:
3461
- #line 324 "pitchfork_http.rl"
3281
+ #line 334 "pitchfork_http.rl"
3462
3282
  { MARK(mark, p); }
3463
3283
  goto st115;
3464
3284
  st115:
3465
3285
  if ( ++p == pe )
3466
3286
  goto _test_eof115;
3467
3287
  case 115:
3468
- #line 3469 "pitchfork_http.c"
3288
+ #line 3289 "pitchfork_http.c"
3469
3289
  switch( (*p) ) {
3470
3290
  case 9: goto tr171;
3471
3291
  case 10: goto tr172;
@@ -3477,14 +3297,14 @@ case 115:
3477
3297
  goto st0;
3478
3298
  goto tr170;
3479
3299
  tr170:
3480
- #line 324 "pitchfork_http.rl"
3300
+ #line 334 "pitchfork_http.rl"
3481
3301
  { MARK(mark, p); }
3482
3302
  goto st116;
3483
3303
  st116:
3484
3304
  if ( ++p == pe )
3485
3305
  goto _test_eof116;
3486
3306
  case 116:
3487
- #line 3488 "pitchfork_http.c"
3307
+ #line 3308 "pitchfork_http.c"
3488
3308
  switch( (*p) ) {
3489
3309
  case 10: goto tr175;
3490
3310
  case 13: goto tr176;
@@ -3497,35 +3317,35 @@ case 116:
3497
3317
  goto st0;
3498
3318
  goto st116;
3499
3319
  tr173:
3500
- #line 324 "pitchfork_http.rl"
3320
+ #line 334 "pitchfork_http.rl"
3501
3321
  { MARK(mark, p); }
3502
- #line 326 "pitchfork_http.rl"
3322
+ #line 336 "pitchfork_http.rl"
3503
3323
  { write_cont_value(hp, buffer, p); }
3504
3324
  goto st117;
3505
3325
  tr176:
3506
- #line 326 "pitchfork_http.rl"
3326
+ #line 336 "pitchfork_http.rl"
3507
3327
  { write_cont_value(hp, buffer, p); }
3508
3328
  goto st117;
3509
3329
  tr183:
3510
- #line 324 "pitchfork_http.rl"
3330
+ #line 334 "pitchfork_http.rl"
3511
3331
  { MARK(mark, p); }
3512
- #line 325 "pitchfork_http.rl"
3332
+ #line 335 "pitchfork_http.rl"
3513
3333
  { write_value(self, hp, buffer, p); }
3514
3334
  goto st117;
3515
3335
  tr186:
3516
- #line 325 "pitchfork_http.rl"
3336
+ #line 335 "pitchfork_http.rl"
3517
3337
  { write_value(self, hp, buffer, p); }
3518
3338
  goto st117;
3519
3339
  st117:
3520
3340
  if ( ++p == pe )
3521
3341
  goto _test_eof117;
3522
3342
  case 117:
3523
- #line 3524 "pitchfork_http.c"
3343
+ #line 3344 "pitchfork_http.c"
3524
3344
  if ( (*p) == 10 )
3525
3345
  goto st114;
3526
3346
  goto st0;
3527
3347
  tr167:
3528
- #line 391 "pitchfork_http.rl"
3348
+ #line 395 "pitchfork_http.rl"
3529
3349
  {
3530
3350
  cs = http_parser_first_final;
3531
3351
  goto post_exec;
@@ -3535,7 +3355,7 @@ st124:
3535
3355
  if ( ++p == pe )
3536
3356
  goto _test_eof124;
3537
3357
  case 124:
3538
- #line 3539 "pitchfork_http.c"
3358
+ #line 3359 "pitchfork_http.c"
3539
3359
  goto st0;
3540
3360
  st118:
3541
3361
  if ( ++p == pe )
@@ -3545,20 +3365,20 @@ case 118:
3545
3365
  goto tr167;
3546
3366
  goto st0;
3547
3367
  tr169:
3548
- #line 320 "pitchfork_http.rl"
3368
+ #line 330 "pitchfork_http.rl"
3549
3369
  { MARK(start.field, p); }
3550
- #line 321 "pitchfork_http.rl"
3370
+ #line 331 "pitchfork_http.rl"
3551
3371
  { snake_upcase_char(deconst(p)); }
3552
3372
  goto st119;
3553
3373
  tr178:
3554
- #line 321 "pitchfork_http.rl"
3374
+ #line 331 "pitchfork_http.rl"
3555
3375
  { snake_upcase_char(deconst(p)); }
3556
3376
  goto st119;
3557
3377
  st119:
3558
3378
  if ( ++p == pe )
3559
3379
  goto _test_eof119;
3560
3380
  case 119:
3561
- #line 3562 "pitchfork_http.c"
3381
+ #line 3382 "pitchfork_http.c"
3562
3382
  switch( (*p) ) {
3563
3383
  case 33: goto tr178;
3564
3384
  case 58: goto tr179;
@@ -3584,18 +3404,18 @@ case 119:
3584
3404
  goto tr178;
3585
3405
  goto st0;
3586
3406
  tr181:
3587
- #line 324 "pitchfork_http.rl"
3407
+ #line 334 "pitchfork_http.rl"
3588
3408
  { MARK(mark, p); }
3589
3409
  goto st120;
3590
3410
  tr179:
3591
- #line 323 "pitchfork_http.rl"
3411
+ #line 333 "pitchfork_http.rl"
3592
3412
  { hp->s.field_len = LEN(start.field, p); }
3593
3413
  goto st120;
3594
3414
  st120:
3595
3415
  if ( ++p == pe )
3596
3416
  goto _test_eof120;
3597
3417
  case 120:
3598
- #line 3599 "pitchfork_http.c"
3418
+ #line 3419 "pitchfork_http.c"
3599
3419
  switch( (*p) ) {
3600
3420
  case 9: goto tr181;
3601
3421
  case 10: goto tr182;
@@ -3607,14 +3427,14 @@ case 120:
3607
3427
  goto st0;
3608
3428
  goto tr180;
3609
3429
  tr180:
3610
- #line 324 "pitchfork_http.rl"
3430
+ #line 334 "pitchfork_http.rl"
3611
3431
  { MARK(mark, p); }
3612
3432
  goto st121;
3613
3433
  st121:
3614
3434
  if ( ++p == pe )
3615
3435
  goto _test_eof121;
3616
3436
  case 121:
3617
- #line 3618 "pitchfork_http.c"
3437
+ #line 3438 "pitchfork_http.c"
3618
3438
  switch( (*p) ) {
3619
3439
  case 10: goto tr185;
3620
3440
  case 13: goto tr186;
@@ -3755,7 +3575,7 @@ case 121:
3755
3575
  _out: {}
3756
3576
  }
3757
3577
 
3758
- #line 465 "pitchfork_http.rl"
3578
+ #line 469 "pitchfork_http.rl"
3759
3579
  post_exec: /* "_out:" also goes here */
3760
3580
  if (hp->cs != http_parser_error)
3761
3581
  hp->cs = cs;
@@ -3906,6 +3726,12 @@ static VALUE HttpParser_alloc(VALUE klass)
3906
3726
  return TypedData_Make_Struct(klass, struct http_parser, &hp_type, hp);
3907
3727
  }
3908
3728
 
3729
+ #ifndef HAVE_RB_HASH_NEW_CAPA
3730
+ static inline VALUE rb_hash_new_capa(long capa) {
3731
+ return rb_hash_new();
3732
+ }
3733
+ #endif
3734
+
3909
3735
  /**
3910
3736
  * call-seq:
3911
3737
  * parser.new => parser
@@ -3918,7 +3744,7 @@ static VALUE HttpParser_init(VALUE self)
3918
3744
 
3919
3745
  http_parser_init(hp);
3920
3746
  RB_OBJ_WRITE(self, &hp->buf, rb_str_new(NULL, 0));
3921
- RB_OBJ_WRITE(self, &hp->env, rb_hash_new());
3747
+ RB_OBJ_WRITE(self, &hp->env, rb_hash_new_capa(32)); // Even the simplest request will have 10 keys
3922
3748
 
3923
3749
  return self;
3924
3750
  }
@@ -4304,8 +4130,6 @@ RUBY_FUNC_EXPORTED void Init_pitchfork_http(void)
4304
4130
  */
4305
4131
  rb_define_const(cHttpParser, "LENGTH_MAX", OFFT2NUM(UH_OFF_T_MAX));
4306
4132
 
4307
- rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1);
4308
-
4309
4133
  init_common_fields();
4310
4134
  SET_GLOBAL(g_http_host, "HOST");
4311
4135
  SET_GLOBAL(g_http_trailer, "TRAILER");