unicorn 4.9.0 → 5.0.1

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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +5 -0
  3. data/.manifest +3 -10
  4. data/Application_Timeouts +3 -3
  5. data/DESIGN +2 -4
  6. data/Documentation/unicorn.1.txt +8 -5
  7. data/Documentation/unicorn_rails.1.txt +2 -2
  8. data/FAQ +17 -8
  9. data/GIT-VERSION-FILE +1 -1
  10. data/GIT-VERSION-GEN +1 -1
  11. data/GNUmakefile +6 -1
  12. data/ISSUES +20 -28
  13. data/KNOWN_ISSUES +9 -9
  14. data/LATEST +28 -29
  15. data/Links +14 -17
  16. data/NEWS +159 -0
  17. data/PHILOSOPHY +0 -6
  18. data/README +22 -17
  19. data/SIGNALS +1 -1
  20. data/Sandbox +4 -4
  21. data/TUNING +11 -8
  22. data/bin/unicorn +1 -1
  23. data/bin/unicorn_rails +1 -1
  24. data/examples/nginx.conf +10 -11
  25. data/examples/unicorn.conf.rb +1 -4
  26. data/examples/unicorn.socket +11 -0
  27. data/examples/unicorn@.service +26 -0
  28. data/ext/unicorn_http/extconf.rb +1 -0
  29. data/ext/unicorn_http/httpdate.c +1 -1
  30. data/ext/unicorn_http/unicorn_http.c +267 -334
  31. data/ext/unicorn_http/unicorn_http.rl +89 -156
  32. data/lib/unicorn/configurator.rb +17 -31
  33. data/lib/unicorn/const.rb +2 -25
  34. data/lib/unicorn/http_request.rb +22 -33
  35. data/lib/unicorn/http_response.rb +13 -31
  36. data/lib/unicorn/http_server.rb +129 -122
  37. data/lib/unicorn/socket_helper.rb +36 -72
  38. data/lib/unicorn/stream_input.rb +3 -3
  39. data/lib/unicorn/tmpio.rb +0 -5
  40. data/lib/unicorn/util.rb +2 -1
  41. data/lib/unicorn/version.rb +1 -1
  42. data/lib/unicorn/worker.rb +3 -15
  43. data/lib/unicorn.rb +10 -18
  44. data/man/man1/unicorn.1 +7 -5
  45. data/man/man1/unicorn_rails.1 +2 -2
  46. data/t/hijack.ru +2 -1
  47. data/t/t0200-rack-hijack.sh +5 -2
  48. data/test/exec/test_exec.rb +52 -0
  49. data/test/test_helper.rb +3 -2
  50. data/test/unit/test_http_parser_ng.rb +16 -114
  51. data/test/unit/test_response.rb +28 -16
  52. data/test/unit/test_socket_helper.rb +1 -1
  53. data/unicorn.gemspec +10 -1
  54. metadata +13 -23
  55. data/examples/git.ru +0 -13
  56. data/lib/unicorn/app/exec_cgi.rb +0 -154
  57. data/lib/unicorn/app/inetd.rb +0 -109
  58. data/lib/unicorn/ssl_client.rb +0 -11
  59. data/lib/unicorn/ssl_configurator.rb +0 -104
  60. data/lib/unicorn/ssl_server.rb +0 -42
  61. data/t/t0016-trust-x-forwarded-false.sh +0 -30
  62. data/t/t0017-trust-x-forwarded-true.sh +0 -30
  63. data/test/unit/test_http_parser_xftrust.rb +0 -38
  64. data/test/unit/test_sni_hostnames.rb +0 -47
@@ -27,86 +27,32 @@ void init_unicorn_httpdate(void);
27
27
  #define UH_FL_KAVERSION 0x80
28
28
  #define UH_FL_HASHEADER 0x100
29
29
  #define UH_FL_TO_CLEAR 0x200
30
+ #define UH_FL_RESSTART 0x400 /* for check_client_connection */
30
31
 
31
32
  /* all of these flags need to be set for keepalive to be supported */
32
33
  #define UH_FL_KEEPALIVE (UH_FL_KAVERSION | UH_FL_REQEOF | UH_FL_HASHEADER)
33
34
 
34
- /*
35
- * whether or not to trust X-Forwarded-Proto and X-Forwarded-SSL when
36
- * setting rack.url_scheme
37
- */
38
- static VALUE trust_x_forward = Qtrue;
39
-
40
- static unsigned long keepalive_requests = 100; /* same as nginx */
41
-
42
- /*
43
- * Returns the maximum number of keepalive requests a client may make
44
- * before the parser refuses to continue.
45
- */
46
- static VALUE ka_req(VALUE self)
47
- {
48
- return ULONG2NUM(keepalive_requests);
49
- }
50
-
51
- /*
52
- * Sets the maximum number of keepalive requests a client may make.
53
- * A special value of +nil+ causes this to be the maximum value
54
- * possible (this is architecture-dependent).
55
- */
56
- static VALUE set_ka_req(VALUE self, VALUE val)
57
- {
58
- keepalive_requests = NIL_P(val) ? ULONG_MAX : NUM2ULONG(val);
59
-
60
- return ka_req(self);
61
- }
62
-
63
- /*
64
- * Sets whether or not the parser will trust X-Forwarded-Proto and
65
- * X-Forwarded-SSL headers and set "rack.url_scheme" to "https" accordingly.
66
- * Rainbows!/Zbatery installations facing untrusted clients directly
67
- * should set this to +false+
68
- */
69
- static VALUE set_xftrust(VALUE self, VALUE val)
70
- {
71
- if (Qtrue == val || Qfalse == val)
72
- trust_x_forward = val;
73
- else
74
- rb_raise(rb_eTypeError, "must be true or false");
75
-
76
- return val;
77
- }
78
-
79
- /*
80
- * returns whether or not the parser will trust X-Forwarded-Proto and
81
- * X-Forwarded-SSL headers and set "rack.url_scheme" to "https" accordingly
82
- */
83
- static VALUE xftrust(VALUE self)
84
- {
85
- return trust_x_forward;
86
- }
87
-
88
- static size_t MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */
35
+ static unsigned int MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */
89
36
 
90
37
  /* this is only intended for use with Rainbows! */
91
38
  static VALUE set_maxhdrlen(VALUE self, VALUE len)
92
39
  {
93
- return SIZET2NUM(MAX_HEADER_LEN = NUM2SIZET(len));
40
+ return UINT2NUM(MAX_HEADER_LEN = NUM2UINT(len));
94
41
  }
95
42
 
96
- /* keep this small for Rainbows! since every client has one */
43
+ /* keep this small for other servers (e.g. yahns) since every client has one */
97
44
  struct http_parser {
98
45
  int cs; /* Ragel internal state */
99
46
  unsigned int flags;
100
- unsigned long nr_requests;
101
- size_t mark;
102
- size_t offset;
47
+ unsigned int mark;
48
+ unsigned int offset;
103
49
  union { /* these 2 fields don't nest */
104
- size_t field;
105
- size_t query;
50
+ unsigned int field;
51
+ unsigned int query;
106
52
  } start;
107
53
  union {
108
- size_t field_len; /* only used during header processing */
109
- size_t dest_offset; /* only used during body processing */
54
+ unsigned int field_len; /* only used during header processing */
55
+ unsigned int dest_offset; /* only used during body processing */
110
56
  } s;
111
57
  VALUE buf;
112
58
  VALUE env;
@@ -117,7 +63,19 @@ struct http_parser {
117
63
  } len;
118
64
  };
119
65
 
120
- static ID id_clear, id_set_backtrace, id_response_start_sent;
66
+ static ID id_set_backtrace;
67
+
68
+ #ifdef HAVE_RB_HASH_CLEAR /* Ruby >= 2.0 */
69
+ # define my_hash_clear(h) (void)rb_hash_clear(h)
70
+ #else /* !HAVE_RB_HASH_CLEAR - Ruby <= 1.9.3 */
71
+
72
+ static ID id_clear;
73
+
74
+ static void my_hash_clear(VALUE h)
75
+ {
76
+ rb_funcall(h, id_clear, 0);
77
+ }
78
+ #endif /* HAVE_RB_HASH_CLEAR */
121
79
 
122
80
  static void finalize_header(struct http_parser *hp);
123
81
 
@@ -126,13 +84,25 @@ static void parser_raise(VALUE klass, const char *msg)
126
84
  VALUE exc = rb_exc_new2(klass, msg);
127
85
  VALUE bt = rb_ary_new();
128
86
 
129
- rb_funcall(exc, id_set_backtrace, 1, bt);
130
- rb_exc_raise(exc);
87
+ rb_funcall(exc, id_set_backtrace, 1, bt);
88
+ rb_exc_raise(exc);
89
+ }
90
+
91
+ static inline unsigned int ulong2uint(unsigned long n)
92
+ {
93
+ unsigned int i = (unsigned int)n;
94
+
95
+ if (sizeof(unsigned int) != sizeof(unsigned long)) {
96
+ if ((unsigned long)i != n) {
97
+ rb_raise(rb_eRangeError, "too large to be 32-bit uint: %lu", n);
98
+ }
99
+ }
100
+ return i;
131
101
  }
132
102
 
133
103
  #define REMAINING (unsigned long)(pe - p)
134
- #define LEN(AT, FPC) (FPC - buffer - hp->AT)
135
- #define MARK(M,FPC) (hp->M = (FPC) - buffer)
104
+ #define LEN(AT, FPC) (ulong2uint(FPC - buffer) - hp->AT)
105
+ #define MARK(M,FPC) (hp->M = ulong2uint((FPC) - buffer))
136
106
  #define PTR_TO(F) (buffer + hp->F)
137
107
  #define STR_NEW(M,FPC) rb_str_new(PTR_TO(M), LEN(M, FPC))
138
108
  #define STRIPPED_STR_NEW(M,FPC) stripped_str_new(PTR_TO(M), LEN(M, FPC))
@@ -316,12 +286,12 @@ static void write_value(struct http_parser *hp,
316
286
  /** Machine **/
317
287
 
318
288
 
319
- #line 423 "unicorn_http.rl"
289
+ #line 393 "unicorn_http.rl"
320
290
 
321
291
 
322
292
  /** Data **/
323
293
 
324
- #line 325 "unicorn_http.c"
294
+ #line 295 "unicorn_http.c"
325
295
  static const int http_parser_start = 1;
326
296
  static const int http_parser_first_final = 122;
327
297
  static const int http_parser_error = 0;
@@ -332,7 +302,7 @@ static const int http_parser_en_Trailers = 114;
332
302
  static const int http_parser_en_main = 1;
333
303
 
334
304
 
335
- #line 427 "unicorn_http.rl"
305
+ #line 397 "unicorn_http.rl"
336
306
 
337
307
  static void http_parser_init(struct http_parser *hp)
338
308
  {
@@ -345,12 +315,12 @@ static void http_parser_init(struct http_parser *hp)
345
315
  hp->len.content = 0;
346
316
  hp->cont = Qfalse; /* zero on MRI, should be optimized away by above */
347
317
 
348
- #line 349 "unicorn_http.c"
318
+ #line 319 "unicorn_http.c"
349
319
  {
350
320
  cs = http_parser_start;
351
321
  }
352
322
 
353
- #line 439 "unicorn_http.rl"
323
+ #line 409 "unicorn_http.rl"
354
324
  hp->cs = cs;
355
325
  }
356
326
 
@@ -378,7 +348,7 @@ http_parser_execute(struct http_parser *hp, char *buffer, size_t len)
378
348
  goto skip_chunk_data_hack;
379
349
  }
380
350
 
381
- #line 382 "unicorn_http.c"
351
+ #line 352 "unicorn_http.c"
382
352
  {
383
353
  if ( p == pe )
384
354
  goto _test_eof;
@@ -413,14 +383,14 @@ st0:
413
383
  cs = 0;
414
384
  goto _out;
415
385
  tr0:
416
- #line 319 "unicorn_http.rl"
386
+ #line 289 "unicorn_http.rl"
417
387
  {MARK(mark, p); }
418
388
  goto st2;
419
389
  st2:
420
390
  if ( ++p == pe )
421
391
  goto _test_eof2;
422
392
  case 2:
423
- #line 424 "unicorn_http.c"
393
+ #line 394 "unicorn_http.c"
424
394
  switch( (*p) ) {
425
395
  case 32: goto tr3;
426
396
  case 33: goto st49;
@@ -446,14 +416,14 @@ case 2:
446
416
  goto st49;
447
417
  goto st0;
448
418
  tr3:
449
- #line 328 "unicorn_http.rl"
419
+ #line 298 "unicorn_http.rl"
450
420
  { request_method(hp, PTR_TO(mark), LEN(mark, p)); }
451
421
  goto st3;
452
422
  st3:
453
423
  if ( ++p == pe )
454
424
  goto _test_eof3;
455
425
  case 3:
456
- #line 457 "unicorn_http.c"
426
+ #line 427 "unicorn_http.c"
457
427
  switch( (*p) ) {
458
428
  case 42: goto tr5;
459
429
  case 47: goto tr6;
@@ -462,21 +432,21 @@ case 3:
462
432
  }
463
433
  goto st0;
464
434
  tr5:
465
- #line 319 "unicorn_http.rl"
435
+ #line 289 "unicorn_http.rl"
466
436
  {MARK(mark, p); }
467
437
  goto st4;
468
438
  st4:
469
439
  if ( ++p == pe )
470
440
  goto _test_eof4;
471
441
  case 4:
472
- #line 473 "unicorn_http.c"
442
+ #line 443 "unicorn_http.c"
473
443
  switch( (*p) ) {
474
444
  case 32: goto tr8;
475
445
  case 35: goto tr9;
476
446
  }
477
447
  goto st0;
478
448
  tr8:
479
- #line 333 "unicorn_http.rl"
449
+ #line 303 "unicorn_http.rl"
480
450
  {
481
451
  VALUE str;
482
452
 
@@ -494,23 +464,23 @@ tr8:
494
464
  }
495
465
  goto st5;
496
466
  tr37:
497
- #line 319 "unicorn_http.rl"
467
+ #line 289 "unicorn_http.rl"
498
468
  {MARK(mark, p); }
499
- #line 348 "unicorn_http.rl"
469
+ #line 318 "unicorn_http.rl"
500
470
  {
501
471
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
502
472
  rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
503
473
  }
504
474
  goto st5;
505
475
  tr40:
506
- #line 348 "unicorn_http.rl"
476
+ #line 318 "unicorn_http.rl"
507
477
  {
508
478
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
509
479
  rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
510
480
  }
511
481
  goto st5;
512
482
  tr44:
513
- #line 358 "unicorn_http.rl"
483
+ #line 328 "unicorn_http.rl"
514
484
  {
515
485
  VALUE val;
516
486
 
@@ -521,7 +491,7 @@ tr44:
521
491
  if (!STR_CSTR_EQ(val, "*"))
522
492
  rb_hash_aset(hp->env, g_path_info, val);
523
493
  }
524
- #line 333 "unicorn_http.rl"
494
+ #line 303 "unicorn_http.rl"
525
495
  {
526
496
  VALUE str;
527
497
 
@@ -539,14 +509,14 @@ tr44:
539
509
  }
540
510
  goto st5;
541
511
  tr50:
542
- #line 352 "unicorn_http.rl"
512
+ #line 322 "unicorn_http.rl"
543
513
  {MARK(start.query, p); }
544
- #line 353 "unicorn_http.rl"
514
+ #line 323 "unicorn_http.rl"
545
515
  {
546
516
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
547
517
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
548
518
  }
549
- #line 333 "unicorn_http.rl"
519
+ #line 303 "unicorn_http.rl"
550
520
  {
551
521
  VALUE str;
552
522
 
@@ -564,12 +534,12 @@ tr50:
564
534
  }
565
535
  goto st5;
566
536
  tr54:
567
- #line 353 "unicorn_http.rl"
537
+ #line 323 "unicorn_http.rl"
568
538
  {
569
539
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
570
540
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
571
541
  }
572
- #line 333 "unicorn_http.rl"
542
+ #line 303 "unicorn_http.rl"
573
543
  {
574
544
  VALUE str;
575
545
 
@@ -590,19 +560,19 @@ st5:
590
560
  if ( ++p == pe )
591
561
  goto _test_eof5;
592
562
  case 5:
593
- #line 594 "unicorn_http.c"
563
+ #line 564 "unicorn_http.c"
594
564
  if ( (*p) == 72 )
595
565
  goto tr10;
596
566
  goto st0;
597
567
  tr10:
598
- #line 319 "unicorn_http.rl"
568
+ #line 289 "unicorn_http.rl"
599
569
  {MARK(mark, p); }
600
570
  goto st6;
601
571
  st6:
602
572
  if ( ++p == pe )
603
573
  goto _test_eof6;
604
574
  case 6:
605
- #line 606 "unicorn_http.c"
575
+ #line 576 "unicorn_http.c"
606
576
  if ( (*p) == 84 )
607
577
  goto st7;
608
578
  goto st0;
@@ -660,34 +630,34 @@ case 13:
660
630
  goto st13;
661
631
  goto st0;
662
632
  tr18:
663
- #line 357 "unicorn_http.rl"
633
+ #line 327 "unicorn_http.rl"
664
634
  { http_version(hp, PTR_TO(mark), LEN(mark, p)); }
665
635
  goto st14;
666
636
  tr25:
667
- #line 325 "unicorn_http.rl"
637
+ #line 295 "unicorn_http.rl"
668
638
  { MARK(mark, p); }
669
- #line 327 "unicorn_http.rl"
639
+ #line 297 "unicorn_http.rl"
670
640
  { write_cont_value(hp, buffer, p); }
671
641
  goto st14;
672
642
  tr27:
673
- #line 327 "unicorn_http.rl"
643
+ #line 297 "unicorn_http.rl"
674
644
  { write_cont_value(hp, buffer, p); }
675
645
  goto st14;
676
646
  tr33:
677
- #line 325 "unicorn_http.rl"
647
+ #line 295 "unicorn_http.rl"
678
648
  { MARK(mark, p); }
679
- #line 326 "unicorn_http.rl"
649
+ #line 296 "unicorn_http.rl"
680
650
  { write_value(hp, buffer, p); }
681
651
  goto st14;
682
652
  tr35:
683
- #line 326 "unicorn_http.rl"
653
+ #line 296 "unicorn_http.rl"
684
654
  { write_value(hp, buffer, p); }
685
655
  goto st14;
686
656
  st14:
687
657
  if ( ++p == pe )
688
658
  goto _test_eof14;
689
659
  case 14:
690
- #line 691 "unicorn_http.c"
660
+ #line 661 "unicorn_http.c"
691
661
  if ( (*p) == 10 )
692
662
  goto st15;
693
663
  goto st0;
@@ -722,14 +692,14 @@ case 15:
722
692
  goto tr22;
723
693
  goto st0;
724
694
  tr24:
725
- #line 325 "unicorn_http.rl"
695
+ #line 295 "unicorn_http.rl"
726
696
  { MARK(mark, p); }
727
697
  goto st16;
728
698
  st16:
729
699
  if ( ++p == pe )
730
700
  goto _test_eof16;
731
701
  case 16:
732
- #line 733 "unicorn_http.c"
702
+ #line 703 "unicorn_http.c"
733
703
  switch( (*p) ) {
734
704
  case 9: goto tr24;
735
705
  case 13: goto tr25;
@@ -740,14 +710,14 @@ case 16:
740
710
  goto st0;
741
711
  goto tr23;
742
712
  tr23:
743
- #line 325 "unicorn_http.rl"
713
+ #line 295 "unicorn_http.rl"
744
714
  { MARK(mark, p); }
745
715
  goto st17;
746
716
  st17:
747
717
  if ( ++p == pe )
748
718
  goto _test_eof17;
749
719
  case 17:
750
- #line 751 "unicorn_http.c"
720
+ #line 721 "unicorn_http.c"
751
721
  switch( (*p) ) {
752
722
  case 13: goto tr27;
753
723
  case 127: goto st0;
@@ -759,7 +729,7 @@ case 17:
759
729
  goto st0;
760
730
  goto st17;
761
731
  tr99:
762
- #line 333 "unicorn_http.rl"
732
+ #line 303 "unicorn_http.rl"
763
733
  {
764
734
  VALUE str;
765
735
 
@@ -777,23 +747,23 @@ tr99:
777
747
  }
778
748
  goto st18;
779
749
  tr102:
780
- #line 319 "unicorn_http.rl"
750
+ #line 289 "unicorn_http.rl"
781
751
  {MARK(mark, p); }
782
- #line 348 "unicorn_http.rl"
752
+ #line 318 "unicorn_http.rl"
783
753
  {
784
754
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
785
755
  rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
786
756
  }
787
757
  goto st18;
788
758
  tr105:
789
- #line 348 "unicorn_http.rl"
759
+ #line 318 "unicorn_http.rl"
790
760
  {
791
761
  VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
792
762
  rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
793
763
  }
794
764
  goto st18;
795
765
  tr109:
796
- #line 358 "unicorn_http.rl"
766
+ #line 328 "unicorn_http.rl"
797
767
  {
798
768
  VALUE val;
799
769
 
@@ -804,7 +774,7 @@ tr109:
804
774
  if (!STR_CSTR_EQ(val, "*"))
805
775
  rb_hash_aset(hp->env, g_path_info, val);
806
776
  }
807
- #line 333 "unicorn_http.rl"
777
+ #line 303 "unicorn_http.rl"
808
778
  {
809
779
  VALUE str;
810
780
 
@@ -822,14 +792,14 @@ tr109:
822
792
  }
823
793
  goto st18;
824
794
  tr115:
825
- #line 352 "unicorn_http.rl"
795
+ #line 322 "unicorn_http.rl"
826
796
  {MARK(start.query, p); }
827
- #line 353 "unicorn_http.rl"
797
+ #line 323 "unicorn_http.rl"
828
798
  {
829
799
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
830
800
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
831
801
  }
832
- #line 333 "unicorn_http.rl"
802
+ #line 303 "unicorn_http.rl"
833
803
  {
834
804
  VALUE str;
835
805
 
@@ -847,12 +817,12 @@ tr115:
847
817
  }
848
818
  goto st18;
849
819
  tr119:
850
- #line 353 "unicorn_http.rl"
820
+ #line 323 "unicorn_http.rl"
851
821
  {
852
822
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
853
823
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
854
824
  }
855
- #line 333 "unicorn_http.rl"
825
+ #line 303 "unicorn_http.rl"
856
826
  {
857
827
  VALUE str;
858
828
 
@@ -873,12 +843,12 @@ st18:
873
843
  if ( ++p == pe )
874
844
  goto _test_eof18;
875
845
  case 18:
876
- #line 877 "unicorn_http.c"
846
+ #line 847 "unicorn_http.c"
877
847
  if ( (*p) == 10 )
878
848
  goto tr28;
879
849
  goto st0;
880
850
  tr28:
881
- #line 373 "unicorn_http.rl"
851
+ #line 343 "unicorn_http.rl"
882
852
  {
883
853
  finalize_header(hp);
884
854
 
@@ -902,23 +872,23 @@ st122:
902
872
  if ( ++p == pe )
903
873
  goto _test_eof122;
904
874
  case 122:
905
- #line 906 "unicorn_http.c"
875
+ #line 876 "unicorn_http.c"
906
876
  goto st0;
907
877
  tr22:
908
- #line 321 "unicorn_http.rl"
878
+ #line 291 "unicorn_http.rl"
909
879
  { MARK(start.field, p); }
910
- #line 322 "unicorn_http.rl"
880
+ #line 292 "unicorn_http.rl"
911
881
  { snake_upcase_char(deconst(p)); }
912
882
  goto st19;
913
883
  tr29:
914
- #line 322 "unicorn_http.rl"
884
+ #line 292 "unicorn_http.rl"
915
885
  { snake_upcase_char(deconst(p)); }
916
886
  goto st19;
917
887
  st19:
918
888
  if ( ++p == pe )
919
889
  goto _test_eof19;
920
890
  case 19:
921
- #line 922 "unicorn_http.c"
891
+ #line 892 "unicorn_http.c"
922
892
  switch( (*p) ) {
923
893
  case 33: goto tr29;
924
894
  case 58: goto tr30;
@@ -944,18 +914,18 @@ case 19:
944
914
  goto tr29;
945
915
  goto st0;
946
916
  tr32:
947
- #line 325 "unicorn_http.rl"
917
+ #line 295 "unicorn_http.rl"
948
918
  { MARK(mark, p); }
949
919
  goto st20;
950
920
  tr30:
951
- #line 324 "unicorn_http.rl"
921
+ #line 294 "unicorn_http.rl"
952
922
  { hp->s.field_len = LEN(start.field, p); }
953
923
  goto st20;
954
924
  st20:
955
925
  if ( ++p == pe )
956
926
  goto _test_eof20;
957
927
  case 20:
958
- #line 959 "unicorn_http.c"
928
+ #line 929 "unicorn_http.c"
959
929
  switch( (*p) ) {
960
930
  case 9: goto tr32;
961
931
  case 13: goto tr33;
@@ -966,14 +936,14 @@ case 20:
966
936
  goto st0;
967
937
  goto tr31;
968
938
  tr31:
969
- #line 325 "unicorn_http.rl"
939
+ #line 295 "unicorn_http.rl"
970
940
  { MARK(mark, p); }
971
941
  goto st21;
972
942
  st21:
973
943
  if ( ++p == pe )
974
944
  goto _test_eof21;
975
945
  case 21:
976
- #line 977 "unicorn_http.c"
946
+ #line 947 "unicorn_http.c"
977
947
  switch( (*p) ) {
978
948
  case 13: goto tr35;
979
949
  case 127: goto st0;
@@ -985,7 +955,7 @@ case 21:
985
955
  goto st0;
986
956
  goto st21;
987
957
  tr9:
988
- #line 333 "unicorn_http.rl"
958
+ #line 303 "unicorn_http.rl"
989
959
  {
990
960
  VALUE str;
991
961
 
@@ -1003,7 +973,7 @@ tr9:
1003
973
  }
1004
974
  goto st22;
1005
975
  tr45:
1006
- #line 358 "unicorn_http.rl"
976
+ #line 328 "unicorn_http.rl"
1007
977
  {
1008
978
  VALUE val;
1009
979
 
@@ -1014,7 +984,7 @@ tr45:
1014
984
  if (!STR_CSTR_EQ(val, "*"))
1015
985
  rb_hash_aset(hp->env, g_path_info, val);
1016
986
  }
1017
- #line 333 "unicorn_http.rl"
987
+ #line 303 "unicorn_http.rl"
1018
988
  {
1019
989
  VALUE str;
1020
990
 
@@ -1032,14 +1002,14 @@ tr45:
1032
1002
  }
1033
1003
  goto st22;
1034
1004
  tr51:
1035
- #line 352 "unicorn_http.rl"
1005
+ #line 322 "unicorn_http.rl"
1036
1006
  {MARK(start.query, p); }
1037
- #line 353 "unicorn_http.rl"
1007
+ #line 323 "unicorn_http.rl"
1038
1008
  {
1039
1009
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1040
1010
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1041
1011
  }
1042
- #line 333 "unicorn_http.rl"
1012
+ #line 303 "unicorn_http.rl"
1043
1013
  {
1044
1014
  VALUE str;
1045
1015
 
@@ -1057,12 +1027,12 @@ tr51:
1057
1027
  }
1058
1028
  goto st22;
1059
1029
  tr55:
1060
- #line 353 "unicorn_http.rl"
1030
+ #line 323 "unicorn_http.rl"
1061
1031
  {
1062
1032
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
1063
1033
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
1064
1034
  }
1065
- #line 333 "unicorn_http.rl"
1035
+ #line 303 "unicorn_http.rl"
1066
1036
  {
1067
1037
  VALUE str;
1068
1038
 
@@ -1083,7 +1053,7 @@ st22:
1083
1053
  if ( ++p == pe )
1084
1054
  goto _test_eof22;
1085
1055
  case 22:
1086
- #line 1087 "unicorn_http.c"
1056
+ #line 1057 "unicorn_http.c"
1087
1057
  switch( (*p) ) {
1088
1058
  case 32: goto tr37;
1089
1059
  case 35: goto st0;
@@ -1094,14 +1064,14 @@ case 22:
1094
1064
  goto st0;
1095
1065
  goto tr36;
1096
1066
  tr36:
1097
- #line 319 "unicorn_http.rl"
1067
+ #line 289 "unicorn_http.rl"
1098
1068
  {MARK(mark, p); }
1099
1069
  goto st23;
1100
1070
  st23:
1101
1071
  if ( ++p == pe )
1102
1072
  goto _test_eof23;
1103
1073
  case 23:
1104
- #line 1105 "unicorn_http.c"
1074
+ #line 1075 "unicorn_http.c"
1105
1075
  switch( (*p) ) {
1106
1076
  case 32: goto tr40;
1107
1077
  case 35: goto st0;
@@ -1112,14 +1082,14 @@ case 23:
1112
1082
  goto st0;
1113
1083
  goto st23;
1114
1084
  tr38:
1115
- #line 319 "unicorn_http.rl"
1085
+ #line 289 "unicorn_http.rl"
1116
1086
  {MARK(mark, p); }
1117
1087
  goto st24;
1118
1088
  st24:
1119
1089
  if ( ++p == pe )
1120
1090
  goto _test_eof24;
1121
1091
  case 24:
1122
- #line 1123 "unicorn_http.c"
1092
+ #line 1093 "unicorn_http.c"
1123
1093
  if ( (*p) < 65 ) {
1124
1094
  if ( 48 <= (*p) && (*p) <= 57 )
1125
1095
  goto st25;
@@ -1143,20 +1113,20 @@ case 25:
1143
1113
  goto st23;
1144
1114
  goto st0;
1145
1115
  tr6:
1146
- #line 319 "unicorn_http.rl"
1116
+ #line 289 "unicorn_http.rl"
1147
1117
  {MARK(mark, p); }
1148
1118
  goto st26;
1149
1119
  tr71:
1150
- #line 332 "unicorn_http.rl"
1120
+ #line 302 "unicorn_http.rl"
1151
1121
  { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
1152
- #line 319 "unicorn_http.rl"
1122
+ #line 289 "unicorn_http.rl"
1153
1123
  {MARK(mark, p); }
1154
1124
  goto st26;
1155
1125
  st26:
1156
1126
  if ( ++p == pe )
1157
1127
  goto _test_eof26;
1158
1128
  case 26:
1159
- #line 1160 "unicorn_http.c"
1129
+ #line 1130 "unicorn_http.c"
1160
1130
  switch( (*p) ) {
1161
1131
  case 32: goto tr44;
1162
1132
  case 35: goto tr45;
@@ -1194,7 +1164,7 @@ case 28:
1194
1164
  goto st26;
1195
1165
  goto st0;
1196
1166
  tr47:
1197
- #line 358 "unicorn_http.rl"
1167
+ #line 328 "unicorn_http.rl"
1198
1168
  {
1199
1169
  VALUE val;
1200
1170
 
@@ -1210,7 +1180,7 @@ st29:
1210
1180
  if ( ++p == pe )
1211
1181
  goto _test_eof29;
1212
1182
  case 29:
1213
- #line 1214 "unicorn_http.c"
1183
+ #line 1184 "unicorn_http.c"
1214
1184
  switch( (*p) ) {
1215
1185
  case 32: goto tr50;
1216
1186
  case 35: goto tr51;
@@ -1221,14 +1191,14 @@ case 29:
1221
1191
  goto st0;
1222
1192
  goto tr49;
1223
1193
  tr49:
1224
- #line 352 "unicorn_http.rl"
1194
+ #line 322 "unicorn_http.rl"
1225
1195
  {MARK(start.query, p); }
1226
1196
  goto st30;
1227
1197
  st30:
1228
1198
  if ( ++p == pe )
1229
1199
  goto _test_eof30;
1230
1200
  case 30:
1231
- #line 1232 "unicorn_http.c"
1201
+ #line 1202 "unicorn_http.c"
1232
1202
  switch( (*p) ) {
1233
1203
  case 32: goto tr54;
1234
1204
  case 35: goto tr55;
@@ -1239,14 +1209,14 @@ case 30:
1239
1209
  goto st0;
1240
1210
  goto st30;
1241
1211
  tr52:
1242
- #line 352 "unicorn_http.rl"
1212
+ #line 322 "unicorn_http.rl"
1243
1213
  {MARK(start.query, p); }
1244
1214
  goto st31;
1245
1215
  st31:
1246
1216
  if ( ++p == pe )
1247
1217
  goto _test_eof31;
1248
1218
  case 31:
1249
- #line 1250 "unicorn_http.c"
1219
+ #line 1220 "unicorn_http.c"
1250
1220
  if ( (*p) < 65 ) {
1251
1221
  if ( 48 <= (*p) && (*p) <= 57 )
1252
1222
  goto st32;
@@ -1270,58 +1240,58 @@ case 32:
1270
1240
  goto st30;
1271
1241
  goto st0;
1272
1242
  tr7:
1273
- #line 319 "unicorn_http.rl"
1243
+ #line 289 "unicorn_http.rl"
1274
1244
  {MARK(mark, p); }
1275
- #line 323 "unicorn_http.rl"
1245
+ #line 293 "unicorn_http.rl"
1276
1246
  { downcase_char(deconst(p)); }
1277
1247
  goto st33;
1278
1248
  st33:
1279
1249
  if ( ++p == pe )
1280
1250
  goto _test_eof33;
1281
1251
  case 33:
1282
- #line 1283 "unicorn_http.c"
1252
+ #line 1253 "unicorn_http.c"
1283
1253
  switch( (*p) ) {
1284
1254
  case 84: goto tr58;
1285
1255
  case 116: goto tr58;
1286
1256
  }
1287
1257
  goto st0;
1288
1258
  tr58:
1289
- #line 323 "unicorn_http.rl"
1259
+ #line 293 "unicorn_http.rl"
1290
1260
  { downcase_char(deconst(p)); }
1291
1261
  goto st34;
1292
1262
  st34:
1293
1263
  if ( ++p == pe )
1294
1264
  goto _test_eof34;
1295
1265
  case 34:
1296
- #line 1297 "unicorn_http.c"
1266
+ #line 1267 "unicorn_http.c"
1297
1267
  switch( (*p) ) {
1298
1268
  case 84: goto tr59;
1299
1269
  case 116: goto tr59;
1300
1270
  }
1301
1271
  goto st0;
1302
1272
  tr59:
1303
- #line 323 "unicorn_http.rl"
1273
+ #line 293 "unicorn_http.rl"
1304
1274
  { downcase_char(deconst(p)); }
1305
1275
  goto st35;
1306
1276
  st35:
1307
1277
  if ( ++p == pe )
1308
1278
  goto _test_eof35;
1309
1279
  case 35:
1310
- #line 1311 "unicorn_http.c"
1280
+ #line 1281 "unicorn_http.c"
1311
1281
  switch( (*p) ) {
1312
1282
  case 80: goto tr60;
1313
1283
  case 112: goto tr60;
1314
1284
  }
1315
1285
  goto st0;
1316
1286
  tr60:
1317
- #line 323 "unicorn_http.rl"
1287
+ #line 293 "unicorn_http.rl"
1318
1288
  { downcase_char(deconst(p)); }
1319
1289
  goto st36;
1320
1290
  st36:
1321
1291
  if ( ++p == pe )
1322
1292
  goto _test_eof36;
1323
1293
  case 36:
1324
- #line 1325 "unicorn_http.c"
1294
+ #line 1295 "unicorn_http.c"
1325
1295
  switch( (*p) ) {
1326
1296
  case 58: goto tr61;
1327
1297
  case 83: goto tr62;
@@ -1329,7 +1299,7 @@ case 36:
1329
1299
  }
1330
1300
  goto st0;
1331
1301
  tr61:
1332
- #line 329 "unicorn_http.rl"
1302
+ #line 299 "unicorn_http.rl"
1333
1303
  {
1334
1304
  rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
1335
1305
  }
@@ -1338,7 +1308,7 @@ st37:
1338
1308
  if ( ++p == pe )
1339
1309
  goto _test_eof37;
1340
1310
  case 37:
1341
- #line 1342 "unicorn_http.c"
1311
+ #line 1312 "unicorn_http.c"
1342
1312
  if ( (*p) == 47 )
1343
1313
  goto st38;
1344
1314
  goto st0;
@@ -1426,14 +1396,14 @@ case 42:
1426
1396
  goto st40;
1427
1397
  goto st0;
1428
1398
  tr67:
1429
- #line 319 "unicorn_http.rl"
1399
+ #line 289 "unicorn_http.rl"
1430
1400
  {MARK(mark, p); }
1431
1401
  goto st43;
1432
1402
  st43:
1433
1403
  if ( ++p == pe )
1434
1404
  goto _test_eof43;
1435
1405
  case 43:
1436
- #line 1437 "unicorn_http.c"
1406
+ #line 1407 "unicorn_http.c"
1437
1407
  switch( (*p) ) {
1438
1408
  case 37: goto st41;
1439
1409
  case 47: goto tr71;
@@ -1485,14 +1455,14 @@ case 44:
1485
1455
  goto st0;
1486
1456
  goto st40;
1487
1457
  tr68:
1488
- #line 319 "unicorn_http.rl"
1458
+ #line 289 "unicorn_http.rl"
1489
1459
  {MARK(mark, p); }
1490
1460
  goto st45;
1491
1461
  st45:
1492
1462
  if ( ++p == pe )
1493
1463
  goto _test_eof45;
1494
1464
  case 45:
1495
- #line 1496 "unicorn_http.c"
1465
+ #line 1466 "unicorn_http.c"
1496
1466
  switch( (*p) ) {
1497
1467
  case 37: goto st41;
1498
1468
  case 47: goto st0;
@@ -1570,14 +1540,14 @@ case 47:
1570
1540
  goto st0;
1571
1541
  goto st40;
1572
1542
  tr62:
1573
- #line 323 "unicorn_http.rl"
1543
+ #line 293 "unicorn_http.rl"
1574
1544
  { downcase_char(deconst(p)); }
1575
1545
  goto st48;
1576
1546
  st48:
1577
1547
  if ( ++p == pe )
1578
1548
  goto _test_eof48;
1579
1549
  case 48:
1580
- #line 1581 "unicorn_http.c"
1550
+ #line 1551 "unicorn_http.c"
1581
1551
  if ( (*p) == 58 )
1582
1552
  goto tr61;
1583
1553
  goto st0;
@@ -2093,14 +2063,14 @@ case 67:
2093
2063
  goto tr3;
2094
2064
  goto st0;
2095
2065
  tr2:
2096
- #line 319 "unicorn_http.rl"
2066
+ #line 289 "unicorn_http.rl"
2097
2067
  {MARK(mark, p); }
2098
2068
  goto st68;
2099
2069
  st68:
2100
2070
  if ( ++p == pe )
2101
2071
  goto _test_eof68;
2102
2072
  case 68:
2103
- #line 2104 "unicorn_http.c"
2073
+ #line 2074 "unicorn_http.c"
2104
2074
  switch( (*p) ) {
2105
2075
  case 32: goto tr3;
2106
2076
  case 33: goto st49;
@@ -2184,14 +2154,14 @@ case 70:
2184
2154
  goto st51;
2185
2155
  goto st0;
2186
2156
  tr95:
2187
- #line 328 "unicorn_http.rl"
2157
+ #line 298 "unicorn_http.rl"
2188
2158
  { request_method(hp, PTR_TO(mark), LEN(mark, p)); }
2189
2159
  goto st71;
2190
2160
  st71:
2191
2161
  if ( ++p == pe )
2192
2162
  goto _test_eof71;
2193
2163
  case 71:
2194
- #line 2195 "unicorn_http.c"
2164
+ #line 2165 "unicorn_http.c"
2195
2165
  switch( (*p) ) {
2196
2166
  case 42: goto tr96;
2197
2167
  case 47: goto tr97;
@@ -2200,14 +2170,14 @@ case 71:
2200
2170
  }
2201
2171
  goto st0;
2202
2172
  tr96:
2203
- #line 319 "unicorn_http.rl"
2173
+ #line 289 "unicorn_http.rl"
2204
2174
  {MARK(mark, p); }
2205
2175
  goto st72;
2206
2176
  st72:
2207
2177
  if ( ++p == pe )
2208
2178
  goto _test_eof72;
2209
2179
  case 72:
2210
- #line 2211 "unicorn_http.c"
2180
+ #line 2181 "unicorn_http.c"
2211
2181
  switch( (*p) ) {
2212
2182
  case 13: goto tr99;
2213
2183
  case 32: goto tr8;
@@ -2215,7 +2185,7 @@ case 72:
2215
2185
  }
2216
2186
  goto st0;
2217
2187
  tr100:
2218
- #line 333 "unicorn_http.rl"
2188
+ #line 303 "unicorn_http.rl"
2219
2189
  {
2220
2190
  VALUE str;
2221
2191
 
@@ -2233,7 +2203,7 @@ tr100:
2233
2203
  }
2234
2204
  goto st73;
2235
2205
  tr110:
2236
- #line 358 "unicorn_http.rl"
2206
+ #line 328 "unicorn_http.rl"
2237
2207
  {
2238
2208
  VALUE val;
2239
2209
 
@@ -2244,7 +2214,7 @@ tr110:
2244
2214
  if (!STR_CSTR_EQ(val, "*"))
2245
2215
  rb_hash_aset(hp->env, g_path_info, val);
2246
2216
  }
2247
- #line 333 "unicorn_http.rl"
2217
+ #line 303 "unicorn_http.rl"
2248
2218
  {
2249
2219
  VALUE str;
2250
2220
 
@@ -2262,14 +2232,14 @@ tr110:
2262
2232
  }
2263
2233
  goto st73;
2264
2234
  tr116:
2265
- #line 352 "unicorn_http.rl"
2235
+ #line 322 "unicorn_http.rl"
2266
2236
  {MARK(start.query, p); }
2267
- #line 353 "unicorn_http.rl"
2237
+ #line 323 "unicorn_http.rl"
2268
2238
  {
2269
2239
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
2270
2240
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
2271
2241
  }
2272
- #line 333 "unicorn_http.rl"
2242
+ #line 303 "unicorn_http.rl"
2273
2243
  {
2274
2244
  VALUE str;
2275
2245
 
@@ -2287,12 +2257,12 @@ tr116:
2287
2257
  }
2288
2258
  goto st73;
2289
2259
  tr120:
2290
- #line 353 "unicorn_http.rl"
2260
+ #line 323 "unicorn_http.rl"
2291
2261
  {
2292
2262
  VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
2293
2263
  rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
2294
2264
  }
2295
- #line 333 "unicorn_http.rl"
2265
+ #line 303 "unicorn_http.rl"
2296
2266
  {
2297
2267
  VALUE str;
2298
2268
 
@@ -2313,7 +2283,7 @@ st73:
2313
2283
  if ( ++p == pe )
2314
2284
  goto _test_eof73;
2315
2285
  case 73:
2316
- #line 2317 "unicorn_http.c"
2286
+ #line 2287 "unicorn_http.c"
2317
2287
  switch( (*p) ) {
2318
2288
  case 13: goto tr102;
2319
2289
  case 32: goto tr37;
@@ -2325,14 +2295,14 @@ case 73:
2325
2295
  goto st0;
2326
2296
  goto tr101;
2327
2297
  tr101:
2328
- #line 319 "unicorn_http.rl"
2298
+ #line 289 "unicorn_http.rl"
2329
2299
  {MARK(mark, p); }
2330
2300
  goto st74;
2331
2301
  st74:
2332
2302
  if ( ++p == pe )
2333
2303
  goto _test_eof74;
2334
2304
  case 74:
2335
- #line 2336 "unicorn_http.c"
2305
+ #line 2306 "unicorn_http.c"
2336
2306
  switch( (*p) ) {
2337
2307
  case 13: goto tr105;
2338
2308
  case 32: goto tr40;
@@ -2344,14 +2314,14 @@ case 74:
2344
2314
  goto st0;
2345
2315
  goto st74;
2346
2316
  tr103:
2347
- #line 319 "unicorn_http.rl"
2317
+ #line 289 "unicorn_http.rl"
2348
2318
  {MARK(mark, p); }
2349
2319
  goto st75;
2350
2320
  st75:
2351
2321
  if ( ++p == pe )
2352
2322
  goto _test_eof75;
2353
2323
  case 75:
2354
- #line 2355 "unicorn_http.c"
2324
+ #line 2325 "unicorn_http.c"
2355
2325
  if ( (*p) < 65 ) {
2356
2326
  if ( 48 <= (*p) && (*p) <= 57 )
2357
2327
  goto st76;
@@ -2375,20 +2345,20 @@ case 76:
2375
2345
  goto st74;
2376
2346
  goto st0;
2377
2347
  tr97:
2378
- #line 319 "unicorn_http.rl"
2348
+ #line 289 "unicorn_http.rl"
2379
2349
  {MARK(mark, p); }
2380
2350
  goto st77;
2381
2351
  tr136:
2382
- #line 332 "unicorn_http.rl"
2352
+ #line 302 "unicorn_http.rl"
2383
2353
  { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
2384
- #line 319 "unicorn_http.rl"
2354
+ #line 289 "unicorn_http.rl"
2385
2355
  {MARK(mark, p); }
2386
2356
  goto st77;
2387
2357
  st77:
2388
2358
  if ( ++p == pe )
2389
2359
  goto _test_eof77;
2390
2360
  case 77:
2391
- #line 2392 "unicorn_http.c"
2361
+ #line 2362 "unicorn_http.c"
2392
2362
  switch( (*p) ) {
2393
2363
  case 13: goto tr109;
2394
2364
  case 32: goto tr44;
@@ -2427,7 +2397,7 @@ case 79:
2427
2397
  goto st77;
2428
2398
  goto st0;
2429
2399
  tr112:
2430
- #line 358 "unicorn_http.rl"
2400
+ #line 328 "unicorn_http.rl"
2431
2401
  {
2432
2402
  VALUE val;
2433
2403
 
@@ -2443,7 +2413,7 @@ st80:
2443
2413
  if ( ++p == pe )
2444
2414
  goto _test_eof80;
2445
2415
  case 80:
2446
- #line 2447 "unicorn_http.c"
2416
+ #line 2417 "unicorn_http.c"
2447
2417
  switch( (*p) ) {
2448
2418
  case 13: goto tr115;
2449
2419
  case 32: goto tr50;
@@ -2455,14 +2425,14 @@ case 80:
2455
2425
  goto st0;
2456
2426
  goto tr114;
2457
2427
  tr114:
2458
- #line 352 "unicorn_http.rl"
2428
+ #line 322 "unicorn_http.rl"
2459
2429
  {MARK(start.query, p); }
2460
2430
  goto st81;
2461
2431
  st81:
2462
2432
  if ( ++p == pe )
2463
2433
  goto _test_eof81;
2464
2434
  case 81:
2465
- #line 2466 "unicorn_http.c"
2435
+ #line 2436 "unicorn_http.c"
2466
2436
  switch( (*p) ) {
2467
2437
  case 13: goto tr119;
2468
2438
  case 32: goto tr54;
@@ -2474,14 +2444,14 @@ case 81:
2474
2444
  goto st0;
2475
2445
  goto st81;
2476
2446
  tr117:
2477
- #line 352 "unicorn_http.rl"
2447
+ #line 322 "unicorn_http.rl"
2478
2448
  {MARK(start.query, p); }
2479
2449
  goto st82;
2480
2450
  st82:
2481
2451
  if ( ++p == pe )
2482
2452
  goto _test_eof82;
2483
2453
  case 82:
2484
- #line 2485 "unicorn_http.c"
2454
+ #line 2455 "unicorn_http.c"
2485
2455
  if ( (*p) < 65 ) {
2486
2456
  if ( 48 <= (*p) && (*p) <= 57 )
2487
2457
  goto st83;
@@ -2505,58 +2475,58 @@ case 83:
2505
2475
  goto st81;
2506
2476
  goto st0;
2507
2477
  tr98:
2508
- #line 319 "unicorn_http.rl"
2478
+ #line 289 "unicorn_http.rl"
2509
2479
  {MARK(mark, p); }
2510
- #line 323 "unicorn_http.rl"
2480
+ #line 293 "unicorn_http.rl"
2511
2481
  { downcase_char(deconst(p)); }
2512
2482
  goto st84;
2513
2483
  st84:
2514
2484
  if ( ++p == pe )
2515
2485
  goto _test_eof84;
2516
2486
  case 84:
2517
- #line 2518 "unicorn_http.c"
2487
+ #line 2488 "unicorn_http.c"
2518
2488
  switch( (*p) ) {
2519
2489
  case 84: goto tr123;
2520
2490
  case 116: goto tr123;
2521
2491
  }
2522
2492
  goto st0;
2523
2493
  tr123:
2524
- #line 323 "unicorn_http.rl"
2494
+ #line 293 "unicorn_http.rl"
2525
2495
  { downcase_char(deconst(p)); }
2526
2496
  goto st85;
2527
2497
  st85:
2528
2498
  if ( ++p == pe )
2529
2499
  goto _test_eof85;
2530
2500
  case 85:
2531
- #line 2532 "unicorn_http.c"
2501
+ #line 2502 "unicorn_http.c"
2532
2502
  switch( (*p) ) {
2533
2503
  case 84: goto tr124;
2534
2504
  case 116: goto tr124;
2535
2505
  }
2536
2506
  goto st0;
2537
2507
  tr124:
2538
- #line 323 "unicorn_http.rl"
2508
+ #line 293 "unicorn_http.rl"
2539
2509
  { downcase_char(deconst(p)); }
2540
2510
  goto st86;
2541
2511
  st86:
2542
2512
  if ( ++p == pe )
2543
2513
  goto _test_eof86;
2544
2514
  case 86:
2545
- #line 2546 "unicorn_http.c"
2515
+ #line 2516 "unicorn_http.c"
2546
2516
  switch( (*p) ) {
2547
2517
  case 80: goto tr125;
2548
2518
  case 112: goto tr125;
2549
2519
  }
2550
2520
  goto st0;
2551
2521
  tr125:
2552
- #line 323 "unicorn_http.rl"
2522
+ #line 293 "unicorn_http.rl"
2553
2523
  { downcase_char(deconst(p)); }
2554
2524
  goto st87;
2555
2525
  st87:
2556
2526
  if ( ++p == pe )
2557
2527
  goto _test_eof87;
2558
2528
  case 87:
2559
- #line 2560 "unicorn_http.c"
2529
+ #line 2530 "unicorn_http.c"
2560
2530
  switch( (*p) ) {
2561
2531
  case 58: goto tr126;
2562
2532
  case 83: goto tr127;
@@ -2564,7 +2534,7 @@ case 87:
2564
2534
  }
2565
2535
  goto st0;
2566
2536
  tr126:
2567
- #line 329 "unicorn_http.rl"
2537
+ #line 299 "unicorn_http.rl"
2568
2538
  {
2569
2539
  rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
2570
2540
  }
@@ -2573,7 +2543,7 @@ st88:
2573
2543
  if ( ++p == pe )
2574
2544
  goto _test_eof88;
2575
2545
  case 88:
2576
- #line 2577 "unicorn_http.c"
2546
+ #line 2547 "unicorn_http.c"
2577
2547
  if ( (*p) == 47 )
2578
2548
  goto st89;
2579
2549
  goto st0;
@@ -2661,14 +2631,14 @@ case 93:
2661
2631
  goto st91;
2662
2632
  goto st0;
2663
2633
  tr132:
2664
- #line 319 "unicorn_http.rl"
2634
+ #line 289 "unicorn_http.rl"
2665
2635
  {MARK(mark, p); }
2666
2636
  goto st94;
2667
2637
  st94:
2668
2638
  if ( ++p == pe )
2669
2639
  goto _test_eof94;
2670
2640
  case 94:
2671
- #line 2672 "unicorn_http.c"
2641
+ #line 2642 "unicorn_http.c"
2672
2642
  switch( (*p) ) {
2673
2643
  case 37: goto st92;
2674
2644
  case 47: goto tr136;
@@ -2720,14 +2690,14 @@ case 95:
2720
2690
  goto st0;
2721
2691
  goto st91;
2722
2692
  tr133:
2723
- #line 319 "unicorn_http.rl"
2693
+ #line 289 "unicorn_http.rl"
2724
2694
  {MARK(mark, p); }
2725
2695
  goto st96;
2726
2696
  st96:
2727
2697
  if ( ++p == pe )
2728
2698
  goto _test_eof96;
2729
2699
  case 96:
2730
- #line 2731 "unicorn_http.c"
2700
+ #line 2701 "unicorn_http.c"
2731
2701
  switch( (*p) ) {
2732
2702
  case 37: goto st92;
2733
2703
  case 47: goto st0;
@@ -2805,14 +2775,14 @@ case 98:
2805
2775
  goto st0;
2806
2776
  goto st91;
2807
2777
  tr127:
2808
- #line 323 "unicorn_http.rl"
2778
+ #line 293 "unicorn_http.rl"
2809
2779
  { downcase_char(deconst(p)); }
2810
2780
  goto st99;
2811
2781
  st99:
2812
2782
  if ( ++p == pe )
2813
2783
  goto _test_eof99;
2814
2784
  case 99:
2815
- #line 2816 "unicorn_http.c"
2785
+ #line 2786 "unicorn_http.c"
2816
2786
  if ( (*p) == 58 )
2817
2787
  goto tr126;
2818
2788
  goto st0;
@@ -2832,7 +2802,7 @@ case 100:
2832
2802
  goto tr141;
2833
2803
  goto st0;
2834
2804
  tr140:
2835
- #line 368 "unicorn_http.rl"
2805
+ #line 338 "unicorn_http.rl"
2836
2806
  {
2837
2807
  hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
2838
2808
  if (hp->len.chunk < 0)
@@ -2843,7 +2813,7 @@ st101:
2843
2813
  if ( ++p == pe )
2844
2814
  goto _test_eof101;
2845
2815
  case 101:
2846
- #line 2847 "unicorn_http.c"
2816
+ #line 2817 "unicorn_http.c"
2847
2817
  switch( (*p) ) {
2848
2818
  case 13: goto st102;
2849
2819
  case 48: goto tr140;
@@ -2866,7 +2836,7 @@ case 102:
2866
2836
  goto tr144;
2867
2837
  goto st0;
2868
2838
  tr144:
2869
- #line 397 "unicorn_http.rl"
2839
+ #line 367 "unicorn_http.rl"
2870
2840
  {
2871
2841
  HP_FL_SET(hp, INTRAILER);
2872
2842
  cs = http_parser_en_Trailers;
@@ -2879,10 +2849,10 @@ st123:
2879
2849
  if ( ++p == pe )
2880
2850
  goto _test_eof123;
2881
2851
  case 123:
2882
- #line 2883 "unicorn_http.c"
2852
+ #line 2853 "unicorn_http.c"
2883
2853
  goto st0;
2884
2854
  tr141:
2885
- #line 368 "unicorn_http.rl"
2855
+ #line 338 "unicorn_http.rl"
2886
2856
  {
2887
2857
  hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
2888
2858
  if (hp->len.chunk < 0)
@@ -2893,7 +2863,7 @@ st103:
2893
2863
  if ( ++p == pe )
2894
2864
  goto _test_eof103;
2895
2865
  case 103:
2896
- #line 2897 "unicorn_http.c"
2866
+ #line 2867 "unicorn_http.c"
2897
2867
  switch( (*p) ) {
2898
2868
  case 13: goto st104;
2899
2869
  case 59: goto st108;
@@ -2920,7 +2890,7 @@ st105:
2920
2890
  case 105:
2921
2891
  goto tr148;
2922
2892
  tr148:
2923
- #line 405 "unicorn_http.rl"
2893
+ #line 375 "unicorn_http.rl"
2924
2894
  {
2925
2895
  skip_chunk_data_hack: {
2926
2896
  size_t nr = MIN((size_t)hp->len.chunk, REMAINING);
@@ -2942,7 +2912,7 @@ st106:
2942
2912
  if ( ++p == pe )
2943
2913
  goto _test_eof106;
2944
2914
  case 106:
2945
- #line 2946 "unicorn_http.c"
2915
+ #line 2916 "unicorn_http.c"
2946
2916
  if ( (*p) == 13 )
2947
2917
  goto st107;
2948
2918
  goto st0;
@@ -3164,14 +3134,14 @@ case 114:
3164
3134
  goto tr157;
3165
3135
  goto st0;
3166
3136
  tr159:
3167
- #line 325 "unicorn_http.rl"
3137
+ #line 295 "unicorn_http.rl"
3168
3138
  { MARK(mark, p); }
3169
3139
  goto st115;
3170
3140
  st115:
3171
3141
  if ( ++p == pe )
3172
3142
  goto _test_eof115;
3173
3143
  case 115:
3174
- #line 3175 "unicorn_http.c"
3144
+ #line 3145 "unicorn_http.c"
3175
3145
  switch( (*p) ) {
3176
3146
  case 9: goto tr159;
3177
3147
  case 13: goto tr160;
@@ -3182,14 +3152,14 @@ case 115:
3182
3152
  goto st0;
3183
3153
  goto tr158;
3184
3154
  tr158:
3185
- #line 325 "unicorn_http.rl"
3155
+ #line 295 "unicorn_http.rl"
3186
3156
  { MARK(mark, p); }
3187
3157
  goto st116;
3188
3158
  st116:
3189
3159
  if ( ++p == pe )
3190
3160
  goto _test_eof116;
3191
3161
  case 116:
3192
- #line 3193 "unicorn_http.c"
3162
+ #line 3163 "unicorn_http.c"
3193
3163
  switch( (*p) ) {
3194
3164
  case 13: goto tr162;
3195
3165
  case 127: goto st0;
@@ -3201,30 +3171,30 @@ case 116:
3201
3171
  goto st0;
3202
3172
  goto st116;
3203
3173
  tr160:
3204
- #line 325 "unicorn_http.rl"
3174
+ #line 295 "unicorn_http.rl"
3205
3175
  { MARK(mark, p); }
3206
- #line 327 "unicorn_http.rl"
3176
+ #line 297 "unicorn_http.rl"
3207
3177
  { write_cont_value(hp, buffer, p); }
3208
3178
  goto st117;
3209
3179
  tr162:
3210
- #line 327 "unicorn_http.rl"
3180
+ #line 297 "unicorn_http.rl"
3211
3181
  { write_cont_value(hp, buffer, p); }
3212
3182
  goto st117;
3213
3183
  tr169:
3214
- #line 325 "unicorn_http.rl"
3184
+ #line 295 "unicorn_http.rl"
3215
3185
  { MARK(mark, p); }
3216
- #line 326 "unicorn_http.rl"
3186
+ #line 296 "unicorn_http.rl"
3217
3187
  { write_value(hp, buffer, p); }
3218
3188
  goto st117;
3219
3189
  tr171:
3220
- #line 326 "unicorn_http.rl"
3190
+ #line 296 "unicorn_http.rl"
3221
3191
  { write_value(hp, buffer, p); }
3222
3192
  goto st117;
3223
3193
  st117:
3224
3194
  if ( ++p == pe )
3225
3195
  goto _test_eof117;
3226
3196
  case 117:
3227
- #line 3228 "unicorn_http.c"
3197
+ #line 3198 "unicorn_http.c"
3228
3198
  if ( (*p) == 10 )
3229
3199
  goto st114;
3230
3200
  goto st0;
@@ -3236,7 +3206,7 @@ case 118:
3236
3206
  goto tr164;
3237
3207
  goto st0;
3238
3208
  tr164:
3239
- #line 392 "unicorn_http.rl"
3209
+ #line 362 "unicorn_http.rl"
3240
3210
  {
3241
3211
  cs = http_parser_first_final;
3242
3212
  goto post_exec;
@@ -3246,23 +3216,23 @@ st124:
3246
3216
  if ( ++p == pe )
3247
3217
  goto _test_eof124;
3248
3218
  case 124:
3249
- #line 3250 "unicorn_http.c"
3219
+ #line 3220 "unicorn_http.c"
3250
3220
  goto st0;
3251
3221
  tr157:
3252
- #line 321 "unicorn_http.rl"
3222
+ #line 291 "unicorn_http.rl"
3253
3223
  { MARK(start.field, p); }
3254
- #line 322 "unicorn_http.rl"
3224
+ #line 292 "unicorn_http.rl"
3255
3225
  { snake_upcase_char(deconst(p)); }
3256
3226
  goto st119;
3257
3227
  tr165:
3258
- #line 322 "unicorn_http.rl"
3228
+ #line 292 "unicorn_http.rl"
3259
3229
  { snake_upcase_char(deconst(p)); }
3260
3230
  goto st119;
3261
3231
  st119:
3262
3232
  if ( ++p == pe )
3263
3233
  goto _test_eof119;
3264
3234
  case 119:
3265
- #line 3266 "unicorn_http.c"
3235
+ #line 3236 "unicorn_http.c"
3266
3236
  switch( (*p) ) {
3267
3237
  case 33: goto tr165;
3268
3238
  case 58: goto tr166;
@@ -3288,18 +3258,18 @@ case 119:
3288
3258
  goto tr165;
3289
3259
  goto st0;
3290
3260
  tr168:
3291
- #line 325 "unicorn_http.rl"
3261
+ #line 295 "unicorn_http.rl"
3292
3262
  { MARK(mark, p); }
3293
3263
  goto st120;
3294
3264
  tr166:
3295
- #line 324 "unicorn_http.rl"
3265
+ #line 294 "unicorn_http.rl"
3296
3266
  { hp->s.field_len = LEN(start.field, p); }
3297
3267
  goto st120;
3298
3268
  st120:
3299
3269
  if ( ++p == pe )
3300
3270
  goto _test_eof120;
3301
3271
  case 120:
3302
- #line 3303 "unicorn_http.c"
3272
+ #line 3273 "unicorn_http.c"
3303
3273
  switch( (*p) ) {
3304
3274
  case 9: goto tr168;
3305
3275
  case 13: goto tr169;
@@ -3310,14 +3280,14 @@ case 120:
3310
3280
  goto st0;
3311
3281
  goto tr167;
3312
3282
  tr167:
3313
- #line 325 "unicorn_http.rl"
3283
+ #line 295 "unicorn_http.rl"
3314
3284
  { MARK(mark, p); }
3315
3285
  goto st121;
3316
3286
  st121:
3317
3287
  if ( ++p == pe )
3318
3288
  goto _test_eof121;
3319
3289
  case 121:
3320
- #line 3321 "unicorn_http.c"
3290
+ #line 3291 "unicorn_http.c"
3321
3291
  switch( (*p) ) {
3322
3292
  case 13: goto tr171;
3323
3293
  case 127: goto st0;
@@ -3457,11 +3427,11 @@ case 121:
3457
3427
  _out: {}
3458
3428
  }
3459
3429
 
3460
- #line 466 "unicorn_http.rl"
3430
+ #line 436 "unicorn_http.rl"
3461
3431
  post_exec: /* "_out:" also goes here */
3462
3432
  if (hp->cs != http_parser_error)
3463
3433
  hp->cs = cs;
3464
- hp->offset = p - buffer;
3434
+ hp->offset = ulong2uint(p - buffer);
3465
3435
 
3466
3436
  assert(p <= pe && "buffer overflow after parsing execute");
3467
3437
  assert(hp->offset <= len && "offset longer than length");
@@ -3486,26 +3456,29 @@ static void set_url_scheme(VALUE env, VALUE *server_port)
3486
3456
  VALUE scheme = rb_hash_aref(env, g_rack_url_scheme);
3487
3457
 
3488
3458
  if (NIL_P(scheme)) {
3489
- if (trust_x_forward == Qfalse) {
3490
- scheme = g_http;
3459
+ /*
3460
+ * would anybody be horribly opposed to removing the X-Forwarded-SSL
3461
+ * and X-Forwarded-Proto handling from this parser? We've had it
3462
+ * forever and nobody has said anything against it, either.
3463
+ * Anyways, please send comments to our public mailing list:
3464
+ * unicorn-public@bogomips.org (no HTML mail, no subscription necessary)
3465
+ */
3466
+ scheme = rb_hash_aref(env, g_http_x_forwarded_ssl);
3467
+ if (!NIL_P(scheme) && STR_CSTR_EQ(scheme, "on")) {
3468
+ *server_port = g_port_443;
3469
+ scheme = g_https;
3491
3470
  } else {
3492
- scheme = rb_hash_aref(env, g_http_x_forwarded_ssl);
3493
- if (!NIL_P(scheme) && STR_CSTR_EQ(scheme, "on")) {
3494
- *server_port = g_port_443;
3495
- scheme = g_https;
3471
+ scheme = rb_hash_aref(env, g_http_x_forwarded_proto);
3472
+ if (NIL_P(scheme)) {
3473
+ scheme = g_http;
3496
3474
  } else {
3497
- scheme = rb_hash_aref(env, g_http_x_forwarded_proto);
3498
- if (NIL_P(scheme)) {
3499
- scheme = g_http;
3475
+ long len = RSTRING_LEN(scheme);
3476
+ if (len >= 5 && !memcmp(RSTRING_PTR(scheme), "https", 5)) {
3477
+ if (len != 5)
3478
+ scheme = g_https;
3479
+ *server_port = g_port_443;
3500
3480
  } else {
3501
- long len = RSTRING_LEN(scheme);
3502
- if (len >= 5 && !memcmp(RSTRING_PTR(scheme), "https", 5)) {
3503
- if (len != 5)
3504
- scheme = g_https;
3505
- *server_port = g_port_443;
3506
- } else {
3507
- scheme = g_http;
3508
- }
3481
+ scheme = g_http;
3509
3482
  }
3510
3483
  }
3511
3484
  }
@@ -3603,7 +3576,6 @@ static VALUE HttpParser_init(VALUE self)
3603
3576
  http_parser_init(hp);
3604
3577
  hp->buf = rb_str_new(NULL, 0);
3605
3578
  hp->env = rb_hash_new();
3606
- hp->nr_requests = keepalive_requests;
3607
3579
 
3608
3580
  return self;
3609
3581
  }
@@ -3620,61 +3592,11 @@ static VALUE HttpParser_clear(VALUE self)
3620
3592
  struct http_parser *hp = data_get(self);
3621
3593
 
3622
3594
  http_parser_init(hp);
3623
- rb_funcall(hp->env, id_clear, 0);
3624
- rb_ivar_set(self, id_response_start_sent, Qfalse);
3595
+ my_hash_clear(hp->env);
3625
3596
 
3626
3597
  return self;
3627
3598
  }
3628
3599
 
3629
- /**
3630
- * call-seq:
3631
- * parser.dechunk! => parser
3632
- *
3633
- * Resets the parser to a state suitable for dechunking response bodies
3634
- *
3635
- */
3636
- static VALUE HttpParser_dechunk_bang(VALUE self)
3637
- {
3638
- struct http_parser *hp = data_get(self);
3639
-
3640
- http_parser_init(hp);
3641
-
3642
- /*
3643
- * we don't care about trailers in dechunk-only mode,
3644
- * but if we did we'd set UH_FL_HASTRAILER and clear hp->env
3645
- */
3646
- if (0) {
3647
- rb_funcall(hp->env, id_clear, 0);
3648
- hp->flags = UH_FL_HASTRAILER;
3649
- }
3650
-
3651
- hp->flags |= UH_FL_HASBODY | UH_FL_INBODY | UH_FL_CHUNKED;
3652
- hp->cs = http_parser_en_ChunkedBody;
3653
-
3654
- return self;
3655
- }
3656
-
3657
- /**
3658
- * call-seq:
3659
- * parser.reset => nil
3660
- *
3661
- * Resets the parser to it's initial state so that you can reuse it
3662
- * rather than making new ones.
3663
- *
3664
- * This method is deprecated and to be removed in Unicorn 4.x
3665
- */
3666
- static VALUE HttpParser_reset(VALUE self)
3667
- {
3668
- static int warned;
3669
-
3670
- if (!warned) {
3671
- rb_warn("Unicorn::HttpParser#reset is deprecated; "
3672
- "use Unicorn::HttpParser#clear instead");
3673
- }
3674
- HttpParser_clear(self);
3675
- return Qnil;
3676
- }
3677
-
3678
3600
  static void advance_str(VALUE str, off_t nr)
3679
3601
  {
3680
3602
  long len = RSTRING_LEN(str);
@@ -3837,15 +3759,13 @@ static VALUE HttpParser_keepalive(VALUE self)
3837
3759
  * parser.next? => true or false
3838
3760
  *
3839
3761
  * Exactly like HttpParser#keepalive?, except it will reset the internal
3840
- * parser state on next parse if it returns true. It will also respect
3841
- * the maximum *keepalive_requests* value and return false if that is
3842
- * reached.
3762
+ * parser state on next parse if it returns true.
3843
3763
  */
3844
3764
  static VALUE HttpParser_next(VALUE self)
3845
3765
  {
3846
3766
  struct http_parser *hp = data_get(self);
3847
3767
 
3848
- if ((HP_FL_ALL(hp, KEEPALIVE)) && (hp->nr_requests-- != 0)) {
3768
+ if (HP_FL_ALL(hp, KEEPALIVE)) {
3849
3769
  HP_FL_SET(hp, TO_CLEAR);
3850
3770
  return Qtrue;
3851
3771
  }
@@ -3955,6 +3875,25 @@ static VALUE HttpParser_filter_body(VALUE self, VALUE dst, VALUE src)
3955
3875
  return src;
3956
3876
  }
3957
3877
 
3878
+ static VALUE HttpParser_rssset(VALUE self, VALUE boolean)
3879
+ {
3880
+ struct http_parser *hp = data_get(self);
3881
+
3882
+ if (RTEST(boolean))
3883
+ HP_FL_SET(hp, RESSTART);
3884
+ else
3885
+ HP_FL_UNSET(hp, RESSTART);
3886
+
3887
+ return boolean; /* ignored by Ruby anyways */
3888
+ }
3889
+
3890
+ static VALUE HttpParser_rssget(VALUE self)
3891
+ {
3892
+ struct http_parser *hp = data_get(self);
3893
+
3894
+ return HP_FL_TEST(hp, RESSTART) ? Qtrue : Qfalse;
3895
+ }
3896
+
3958
3897
  #define SET_GLOBAL(var,str) do { \
3959
3898
  var = find_common_field(str, sizeof(str) - 1); \
3960
3899
  assert(!NIL_P(var) && "missed global field"); \
@@ -3964,7 +3903,7 @@ void Init_unicorn_http(void)
3964
3903
  {
3965
3904
  VALUE mUnicorn, cHttpParser;
3966
3905
 
3967
- mUnicorn = rb_const_get(rb_cObject, rb_intern("Unicorn"));
3906
+ mUnicorn = rb_define_module("Unicorn");
3968
3907
  cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
3969
3908
  eHttpParserError =
3970
3909
  rb_define_class_under(mUnicorn, "HttpParserError", rb_eIOError);
@@ -3977,8 +3916,6 @@ void Init_unicorn_http(void)
3977
3916
  rb_define_alloc_func(cHttpParser, HttpParser_alloc);
3978
3917
  rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
3979
3918
  rb_define_method(cHttpParser, "clear", HttpParser_clear, 0);
3980
- rb_define_method(cHttpParser, "reset", HttpParser_reset, 0);
3981
- rb_define_method(cHttpParser, "dechunk!", HttpParser_dechunk_bang, 0);
3982
3919
  rb_define_method(cHttpParser, "parse", HttpParser_parse, 0);
3983
3920
  rb_define_method(cHttpParser, "add_parse", HttpParser_add_parse, 1);
3984
3921
  rb_define_method(cHttpParser, "headers", HttpParser_headers, 2);
@@ -3991,6 +3928,8 @@ void Init_unicorn_http(void)
3991
3928
  rb_define_method(cHttpParser, "next?", HttpParser_next, 0);
3992
3929
  rb_define_method(cHttpParser, "buf", HttpParser_buf, 0);
3993
3930
  rb_define_method(cHttpParser, "env", HttpParser_env, 0);
3931
+ rb_define_method(cHttpParser, "response_start_sent=", HttpParser_rssset, 1);
3932
+ rb_define_method(cHttpParser, "response_start_sent", HttpParser_rssget, 0);
3994
3933
 
3995
3934
  /*
3996
3935
  * The maximum size a single chunk when using chunked transfer encoding.
@@ -4007,14 +3946,6 @@ void Init_unicorn_http(void)
4007
3946
  */
4008
3947
  rb_define_const(cHttpParser, "LENGTH_MAX", OFFT2NUM(UH_OFF_T_MAX));
4009
3948
 
4010
- /* default value for keepalive_requests */
4011
- rb_define_const(cHttpParser, "KEEPALIVE_REQUESTS_DEFAULT",
4012
- ULONG2NUM(keepalive_requests));
4013
-
4014
- rb_define_singleton_method(cHttpParser, "keepalive_requests", ka_req, 0);
4015
- rb_define_singleton_method(cHttpParser, "keepalive_requests=", set_ka_req, 1);
4016
- rb_define_singleton_method(cHttpParser, "trust_x_forwarded=", set_xftrust, 1);
4017
- rb_define_singleton_method(cHttpParser, "trust_x_forwarded?", xftrust, 0);
4018
3949
  rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1);
4019
3950
 
4020
3951
  init_common_fields();
@@ -4023,9 +3954,11 @@ void Init_unicorn_http(void)
4023
3954
  SET_GLOBAL(g_http_transfer_encoding, "TRANSFER_ENCODING");
4024
3955
  SET_GLOBAL(g_content_length, "CONTENT_LENGTH");
4025
3956
  SET_GLOBAL(g_http_connection, "CONNECTION");
4026
- id_clear = rb_intern("clear");
4027
3957
  id_set_backtrace = rb_intern("set_backtrace");
4028
- id_response_start_sent = rb_intern("@response_start_sent");
4029
3958
  init_unicorn_httpdate();
3959
+
3960
+ #ifndef HAVE_RB_HASH_CLEAR
3961
+ id_clear = rb_intern("clear");
3962
+ #endif
4030
3963
  }
4031
3964
  #undef SET_GLOBAL