thin 1.2.7-x86-mswin32 → 1.2.8-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +29 -0
- data/Rakefile +1 -1
- data/example/monit_sockets +4 -4
- data/example/monit_unixsock +4 -4
- data/ext/thin_parser/common.rl +1 -1
- data/ext/thin_parser/parser.c +231 -167
- data/lib/rack/adapter/rails.rb +9 -6
- data/lib/thin/backends/base.rb +8 -0
- data/lib/thin/backends/unix_server.rb +9 -4
- data/lib/thin/connection.rb +9 -1
- data/lib/thin/controllers/controller.rb +6 -0
- data/lib/thin/daemonizing.rb +10 -6
- data/lib/thin/response.rb +5 -2
- data/lib/thin/runner.rb +10 -2
- data/lib/thin/server.rb +3 -0
- data/lib/thin/version.rb +2 -2
- data/lib/thin_parser.so +0 -0
- data/spec/connection_spec.rb +1 -0
- data/spec/daemonizing_spec.rb +4 -0
- data/spec/rack/rails_adapter_spec.rb +68 -1
- data/spec/rails_app/public/dispatch.cgi +2 -2
- data/spec/rails_app/public/dispatch.fcgi +1 -1
- data/spec/rails_app/public/dispatch.rb +2 -2
- data/spec/request/parser_spec.rb +11 -0
- data/spec/response_spec.rb +11 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -4
- data/lib/1.8/thin_parser.so +0 -0
- data/lib/1.9/thin_parser.so +0 -0
data/CHANGELOG
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
== 1.2.8 Black Keys
|
2
|
+
* Allow the connection to remain open for 1xx statuses [timshadel]
|
3
|
+
|
4
|
+
Both the 100 and 101 status codes require that the connection to the
|
5
|
+
server remain open. The 100 status code is used to tell the client that
|
6
|
+
the server is still receiving its request, and will continue to read
|
7
|
+
request input on the connection. The 101 status code is used to upgrade
|
8
|
+
the existing connection to another protocol, and specifically is NOT
|
9
|
+
used to upgrade a separate connection. Therefore, the connection must
|
10
|
+
remain open after this response in order to facilitate that.
|
11
|
+
|
12
|
+
* Accept IE7 badly encoded URL (eg.: %uEEEE)
|
13
|
+
* Fix gemspec to work w/ Bundler [smparkes]
|
14
|
+
* Add SSL support [tmm1]
|
15
|
+
* Catch Errno::EPERM in Process.running? [Tony Kemp]
|
16
|
+
On some systems (e.g. OpenBSD) you receive an EPERM exception if
|
17
|
+
you try to Process.getpgid on a process you do not own (even if you
|
18
|
+
are root). But it does mean that the process exists, so return true.
|
19
|
+
* Fix Rails version check that select which Rack adapter to use. Was using CGI adapter in Rails 3.
|
20
|
+
* Ignore SIGHUP when no restart block is given
|
21
|
+
* Add SSL options to thin command line tool [goldmann]
|
22
|
+
|
23
|
+
--ssl Enables SSL
|
24
|
+
--ssl-key-file PATH Path to private key
|
25
|
+
--ssl-cert-file PATH Path to certificate
|
26
|
+
--ssl-verify Enables SSL certificate verification
|
27
|
+
* Expose peer SSL certificate in env (rack.peer_cert) [fd]
|
28
|
+
* Adjusting unix socket permissions to be more open [mbj]
|
29
|
+
|
1
30
|
== 1.2.7 No Hup
|
2
31
|
* Support multiple Ruby version (fat binaries under windows)
|
3
32
|
* Do not trap unsupported HUP signal on Windows
|
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ end
|
|
37
37
|
|
38
38
|
desc "Build gem packages"
|
39
39
|
task :gems do
|
40
|
-
sh "
|
40
|
+
sh "rake clean gem && rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1"
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "Release version #{Thin::VERSION::STRING} gems to rubyforge"
|
data/example/monit_sockets
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
check process blog1
|
2
2
|
with pidfile /u/apps/blog/shared/pids/thin.14000.pid
|
3
|
-
start program = "
|
4
|
-
stop program = "
|
3
|
+
start program = "ruby thin start -d -e production -u nobody -g nobody -p 14000 -a 127.0.0.1 -P tmp/pids/thin.14000.pid -c /u/apps/blog/current"
|
4
|
+
stop program = "ruby thin stop -P /u/apps/blog/shared/pids/thin.14000.pid"
|
5
5
|
if totalmem > 90.0 MB for 5 cycles then restart
|
6
6
|
if failed port 14000 then restart
|
7
7
|
if cpu usage > 95% for 3 cycles then restart
|
@@ -10,8 +10,8 @@ check process blog1
|
|
10
10
|
|
11
11
|
check process blog2
|
12
12
|
with pidfile /u/apps/blog/shared/pids/thin.14001.pid
|
13
|
-
start program = "
|
14
|
-
stop program = "
|
13
|
+
start program = "ruby thin start -d -e production -u nobody -g nobody -p 14001 -a 127.0.0.1 -P tmp/pids/thin.14001.pid -c /u/apps/blog/current"
|
14
|
+
stop program = "ruby thin stop -P /u/apps/blog/shared/pids/thin.14001.pid"
|
15
15
|
if totalmem > 90.0 MB for 5 cycles then restart
|
16
16
|
if failed port 14001 then restart
|
17
17
|
if cpu usage > 95% for 3 cycles then restart
|
data/example/monit_unixsock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
check process blog1
|
2
2
|
with pidfile /u/apps/blog/shared/pids/thin.1.pid
|
3
|
-
start program = "
|
4
|
-
stop program = "
|
3
|
+
start program = "ruby thin start -d -e production -S /u/apps/blog/shared/pids/thin.1.sock -P tmp/pids/thin.1.pid -c /u/apps/blog/current"
|
4
|
+
stop program = "ruby thin stop -P /u/apps/blog/shared/pids/thin.1.pid"
|
5
5
|
if totalmem > 90.0 MB for 5 cycles then restart
|
6
6
|
if failed unixsocket /u/apps/blog/shared/pids/thin.1.sock then restart
|
7
7
|
if cpu usage > 95% for 3 cycles then restart
|
@@ -10,8 +10,8 @@ check process blog1
|
|
10
10
|
|
11
11
|
check process blog2
|
12
12
|
with pidfile /u/apps/blog/shared/pids/thin.2.pid
|
13
|
-
start program = "
|
14
|
-
stop program = "
|
13
|
+
start program = "ruby thin start -d -e production -S /u/apps/blog/shared/pids/thin.2.sock -P tmp/pids/thin.2.pid -c /u/apps/blog/current"
|
14
|
+
stop program = "ruby thin stop -P /u/apps/blog/shared/pids/thin.2.pid"
|
15
15
|
if totalmem > 90.0 MB for 5 cycles then restart
|
16
16
|
if failed unixsocket /u/apps/blog/shared/pids/thin.2.sock then restart
|
17
17
|
if cpu usage > 95% for 3 cycles then restart
|
data/ext/thin_parser/common.rl
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
unsafe = (CTL | " " | "#" | "%" | sorta_safe);
|
16
16
|
national = any -- (alpha | digit | reserved | extra | safe | unsafe);
|
17
17
|
unreserved = (alpha | digit | safe | extra | national);
|
18
|
-
escape = ("%" xdigit xdigit);
|
18
|
+
escape = ("%" "u"? xdigit xdigit);
|
19
19
|
uchar = (unreserved | escape | sorta_safe);
|
20
20
|
pchar = (uchar | ":" | "@" | "&" | "=" | "+");
|
21
21
|
tspecials = ("(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | "\"" | "/" | "[" | "]" | "?" | "=" | "{" | "}" | " " | "\t");
|
data/ext/thin_parser/parser.c
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
#line 27 "parser.c"
|
27
27
|
static const int http_parser_start = 1;
|
28
|
-
static const int http_parser_first_final =
|
28
|
+
static const int http_parser_first_final = 58;
|
29
29
|
static const int http_parser_error = 0;
|
30
30
|
|
31
31
|
static const int http_parser_en_main = 1;
|
@@ -103,17 +103,17 @@ case 2:
|
|
103
103
|
#line 104 "parser.c"
|
104
104
|
switch( (*p) ) {
|
105
105
|
case 32: goto tr2;
|
106
|
-
case 36: goto
|
107
|
-
case 95: goto
|
106
|
+
case 36: goto st39;
|
107
|
+
case 95: goto st39;
|
108
108
|
}
|
109
109
|
if ( (*p) < 48 ) {
|
110
110
|
if ( 45 <= (*p) && (*p) <= 46 )
|
111
|
-
goto
|
111
|
+
goto st39;
|
112
112
|
} else if ( (*p) > 57 ) {
|
113
113
|
if ( 65 <= (*p) && (*p) <= 90 )
|
114
|
-
goto
|
114
|
+
goto st39;
|
115
115
|
} else
|
116
|
-
goto
|
116
|
+
goto st39;
|
117
117
|
goto st0;
|
118
118
|
tr2:
|
119
119
|
#line 36 "parser.rl"
|
@@ -183,7 +183,7 @@ tr34:
|
|
183
183
|
}
|
184
184
|
}
|
185
185
|
goto st5;
|
186
|
-
|
186
|
+
tr44:
|
187
187
|
#line 65 "parser.rl"
|
188
188
|
{
|
189
189
|
if (parser->request_path != NULL) {
|
@@ -197,7 +197,7 @@ tr42:
|
|
197
197
|
}
|
198
198
|
}
|
199
199
|
goto st5;
|
200
|
-
|
200
|
+
tr51:
|
201
201
|
#line 52 "parser.rl"
|
202
202
|
{MARK(query_start, p); }
|
203
203
|
#line 53 "parser.rl"
|
@@ -213,7 +213,7 @@ tr48:
|
|
213
213
|
}
|
214
214
|
}
|
215
215
|
goto st5;
|
216
|
-
|
216
|
+
tr55:
|
217
217
|
#line 53 "parser.rl"
|
218
218
|
{
|
219
219
|
if (parser->query_string != NULL) {
|
@@ -376,13 +376,13 @@ tr22:
|
|
376
376
|
if (parser->header_done != NULL) {
|
377
377
|
parser->header_done(parser->data, p + 1, pe - p - 1);
|
378
378
|
}
|
379
|
-
{p++; cs =
|
379
|
+
{p++; cs = 58; goto _out;}
|
380
380
|
}
|
381
|
-
goto
|
382
|
-
|
381
|
+
goto st58;
|
382
|
+
st58:
|
383
383
|
if ( ++p == pe )
|
384
|
-
goto
|
385
|
-
case
|
384
|
+
goto _test_eof58;
|
385
|
+
case 58:
|
386
386
|
#line 387 "parser.c"
|
387
387
|
goto st0;
|
388
388
|
tr21:
|
@@ -458,7 +458,7 @@ tr9:
|
|
458
458
|
}
|
459
459
|
}
|
460
460
|
goto st20;
|
461
|
-
|
461
|
+
tr45:
|
462
462
|
#line 65 "parser.rl"
|
463
463
|
{
|
464
464
|
if (parser->request_path != NULL) {
|
@@ -472,7 +472,7 @@ tr43:
|
|
472
472
|
}
|
473
473
|
}
|
474
474
|
goto st20;
|
475
|
-
|
475
|
+
tr52:
|
476
476
|
#line 52 "parser.rl"
|
477
477
|
{MARK(query_start, p); }
|
478
478
|
#line 53 "parser.rl"
|
@@ -488,7 +488,7 @@ tr49:
|
|
488
488
|
}
|
489
489
|
}
|
490
490
|
goto st20;
|
491
|
-
|
491
|
+
tr56:
|
492
492
|
#line 53 "parser.rl"
|
493
493
|
{
|
494
494
|
if (parser->query_string != NULL) {
|
@@ -543,6 +543,8 @@ st22:
|
|
543
543
|
goto _test_eof22;
|
544
544
|
case 22:
|
545
545
|
#line 546 "parser.c"
|
546
|
+
if ( (*p) == 117 )
|
547
|
+
goto st24;
|
546
548
|
if ( (*p) < 65 ) {
|
547
549
|
if ( 48 <= (*p) && (*p) <= 57 )
|
548
550
|
goto st23;
|
@@ -565,111 +567,94 @@ case 23:
|
|
565
567
|
} else
|
566
568
|
goto st21;
|
567
569
|
goto st0;
|
568
|
-
tr5:
|
569
|
-
#line 22 "parser.rl"
|
570
|
-
{MARK(mark, p); }
|
571
|
-
goto st24;
|
572
570
|
st24:
|
573
571
|
if ( ++p == pe )
|
574
572
|
goto _test_eof24;
|
575
573
|
case 24:
|
576
|
-
|
574
|
+
if ( (*p) < 65 ) {
|
575
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
576
|
+
goto st23;
|
577
|
+
} else if ( (*p) > 70 ) {
|
578
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
579
|
+
goto st23;
|
580
|
+
} else
|
581
|
+
goto st23;
|
582
|
+
goto st0;
|
583
|
+
tr5:
|
584
|
+
#line 22 "parser.rl"
|
585
|
+
{MARK(mark, p); }
|
586
|
+
goto st25;
|
587
|
+
st25:
|
588
|
+
if ( ++p == pe )
|
589
|
+
goto _test_eof25;
|
590
|
+
case 25:
|
591
|
+
#line 592 "parser.c"
|
577
592
|
switch( (*p) ) {
|
578
|
-
case 43: goto
|
579
|
-
case 58: goto
|
593
|
+
case 43: goto st25;
|
594
|
+
case 58: goto st26;
|
580
595
|
}
|
581
596
|
if ( (*p) < 48 ) {
|
582
597
|
if ( 45 <= (*p) && (*p) <= 46 )
|
583
|
-
goto
|
598
|
+
goto st25;
|
584
599
|
} else if ( (*p) > 57 ) {
|
585
600
|
if ( (*p) > 90 ) {
|
586
601
|
if ( 97 <= (*p) && (*p) <= 122 )
|
587
|
-
goto
|
602
|
+
goto st25;
|
588
603
|
} else if ( (*p) >= 65 )
|
589
|
-
goto
|
604
|
+
goto st25;
|
590
605
|
} else
|
591
|
-
goto
|
606
|
+
goto st25;
|
592
607
|
goto st0;
|
593
608
|
tr7:
|
594
609
|
#line 22 "parser.rl"
|
595
610
|
{MARK(mark, p); }
|
596
|
-
goto
|
597
|
-
|
611
|
+
goto st26;
|
612
|
+
st26:
|
598
613
|
if ( ++p == pe )
|
599
|
-
goto
|
600
|
-
case
|
601
|
-
#line
|
614
|
+
goto _test_eof26;
|
615
|
+
case 26:
|
616
|
+
#line 617 "parser.c"
|
602
617
|
switch( (*p) ) {
|
603
618
|
case 32: goto tr8;
|
604
619
|
case 35: goto tr9;
|
605
|
-
case 37: goto
|
620
|
+
case 37: goto st27;
|
606
621
|
case 127: goto st0;
|
607
622
|
}
|
608
623
|
if ( 0 <= (*p) && (*p) <= 31 )
|
609
624
|
goto st0;
|
610
|
-
goto
|
611
|
-
st26:
|
612
|
-
if ( ++p == pe )
|
613
|
-
goto _test_eof26;
|
614
|
-
case 26:
|
615
|
-
if ( (*p) < 65 ) {
|
616
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
617
|
-
goto st27;
|
618
|
-
} else if ( (*p) > 70 ) {
|
619
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
620
|
-
goto st27;
|
621
|
-
} else
|
622
|
-
goto st27;
|
623
|
-
goto st0;
|
625
|
+
goto st26;
|
624
626
|
st27:
|
625
627
|
if ( ++p == pe )
|
626
628
|
goto _test_eof27;
|
627
629
|
case 27:
|
630
|
+
if ( (*p) == 117 )
|
631
|
+
goto st29;
|
628
632
|
if ( (*p) < 65 ) {
|
629
633
|
if ( 48 <= (*p) && (*p) <= 57 )
|
630
|
-
goto
|
634
|
+
goto st28;
|
631
635
|
} else if ( (*p) > 70 ) {
|
632
636
|
if ( 97 <= (*p) && (*p) <= 102 )
|
633
|
-
goto
|
637
|
+
goto st28;
|
634
638
|
} else
|
635
|
-
goto
|
639
|
+
goto st28;
|
636
640
|
goto st0;
|
637
|
-
tr6:
|
638
|
-
#line 22 "parser.rl"
|
639
|
-
{MARK(mark, p); }
|
640
|
-
goto st28;
|
641
641
|
st28:
|
642
642
|
if ( ++p == pe )
|
643
643
|
goto _test_eof28;
|
644
644
|
case 28:
|
645
|
-
#line 646 "parser.c"
|
646
|
-
switch( (*p) ) {
|
647
|
-
case 32: goto tr42;
|
648
|
-
case 35: goto tr43;
|
649
|
-
case 37: goto st29;
|
650
|
-
case 63: goto tr45;
|
651
|
-
case 127: goto st0;
|
652
|
-
}
|
653
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
654
|
-
goto st0;
|
655
|
-
goto st28;
|
656
|
-
st29:
|
657
|
-
if ( ++p == pe )
|
658
|
-
goto _test_eof29;
|
659
|
-
case 29:
|
660
645
|
if ( (*p) < 65 ) {
|
661
646
|
if ( 48 <= (*p) && (*p) <= 57 )
|
662
|
-
goto
|
647
|
+
goto st26;
|
663
648
|
} else if ( (*p) > 70 ) {
|
664
649
|
if ( 97 <= (*p) && (*p) <= 102 )
|
665
|
-
goto
|
650
|
+
goto st26;
|
666
651
|
} else
|
667
|
-
goto
|
652
|
+
goto st26;
|
668
653
|
goto st0;
|
669
|
-
|
654
|
+
st29:
|
670
655
|
if ( ++p == pe )
|
671
|
-
goto
|
672
|
-
case
|
656
|
+
goto _test_eof29;
|
657
|
+
case 29:
|
673
658
|
if ( (*p) < 65 ) {
|
674
659
|
if ( 48 <= (*p) && (*p) <= 57 )
|
675
660
|
goto st28;
|
@@ -679,68 +664,57 @@ case 30:
|
|
679
664
|
} else
|
680
665
|
goto st28;
|
681
666
|
goto st0;
|
682
|
-
|
683
|
-
#line
|
684
|
-
{
|
685
|
-
|
686
|
-
|
687
|
-
}
|
688
|
-
}
|
689
|
-
goto st31;
|
690
|
-
st31:
|
667
|
+
tr6:
|
668
|
+
#line 22 "parser.rl"
|
669
|
+
{MARK(mark, p); }
|
670
|
+
goto st30;
|
671
|
+
st30:
|
691
672
|
if ( ++p == pe )
|
692
|
-
goto
|
693
|
-
case
|
694
|
-
#line
|
673
|
+
goto _test_eof30;
|
674
|
+
case 30:
|
675
|
+
#line 676 "parser.c"
|
695
676
|
switch( (*p) ) {
|
696
|
-
case 32: goto
|
697
|
-
case 35: goto
|
698
|
-
case 37: goto
|
677
|
+
case 32: goto tr44;
|
678
|
+
case 35: goto tr45;
|
679
|
+
case 37: goto st31;
|
680
|
+
case 63: goto tr47;
|
699
681
|
case 127: goto st0;
|
700
682
|
}
|
701
683
|
if ( 0 <= (*p) && (*p) <= 31 )
|
702
684
|
goto st0;
|
703
|
-
goto
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
685
|
+
goto st30;
|
686
|
+
st31:
|
687
|
+
if ( ++p == pe )
|
688
|
+
goto _test_eof31;
|
689
|
+
case 31:
|
690
|
+
if ( (*p) == 117 )
|
691
|
+
goto st33;
|
692
|
+
if ( (*p) < 65 ) {
|
693
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
694
|
+
goto st32;
|
695
|
+
} else if ( (*p) > 70 ) {
|
696
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
697
|
+
goto st32;
|
698
|
+
} else
|
699
|
+
goto st32;
|
700
|
+
goto st0;
|
708
701
|
st32:
|
709
702
|
if ( ++p == pe )
|
710
703
|
goto _test_eof32;
|
711
704
|
case 32:
|
712
|
-
#line 713 "parser.c"
|
713
|
-
switch( (*p) ) {
|
714
|
-
case 32: goto tr52;
|
715
|
-
case 35: goto tr53;
|
716
|
-
case 37: goto st33;
|
717
|
-
case 127: goto st0;
|
718
|
-
}
|
719
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
720
|
-
goto st0;
|
721
|
-
goto st32;
|
722
|
-
tr50:
|
723
|
-
#line 52 "parser.rl"
|
724
|
-
{MARK(query_start, p); }
|
725
|
-
goto st33;
|
726
|
-
st33:
|
727
|
-
if ( ++p == pe )
|
728
|
-
goto _test_eof33;
|
729
|
-
case 33:
|
730
|
-
#line 731 "parser.c"
|
731
705
|
if ( (*p) < 65 ) {
|
732
706
|
if ( 48 <= (*p) && (*p) <= 57 )
|
733
|
-
goto
|
707
|
+
goto st30;
|
734
708
|
} else if ( (*p) > 70 ) {
|
735
709
|
if ( 97 <= (*p) && (*p) <= 102 )
|
736
|
-
goto
|
710
|
+
goto st30;
|
737
711
|
} else
|
738
|
-
goto
|
712
|
+
goto st30;
|
739
713
|
goto st0;
|
740
|
-
|
714
|
+
st33:
|
741
715
|
if ( ++p == pe )
|
742
|
-
goto
|
743
|
-
case
|
716
|
+
goto _test_eof33;
|
717
|
+
case 33:
|
744
718
|
if ( (*p) < 65 ) {
|
745
719
|
if ( 48 <= (*p) && (*p) <= 57 )
|
746
720
|
goto st32;
|
@@ -750,38 +724,62 @@ case 34:
|
|
750
724
|
} else
|
751
725
|
goto st32;
|
752
726
|
goto st0;
|
727
|
+
tr47:
|
728
|
+
#line 65 "parser.rl"
|
729
|
+
{
|
730
|
+
if (parser->request_path != NULL) {
|
731
|
+
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
732
|
+
}
|
733
|
+
}
|
734
|
+
goto st34;
|
735
|
+
st34:
|
736
|
+
if ( ++p == pe )
|
737
|
+
goto _test_eof34;
|
738
|
+
case 34:
|
739
|
+
#line 740 "parser.c"
|
740
|
+
switch( (*p) ) {
|
741
|
+
case 32: goto tr51;
|
742
|
+
case 35: goto tr52;
|
743
|
+
case 37: goto tr53;
|
744
|
+
case 127: goto st0;
|
745
|
+
}
|
746
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
747
|
+
goto st0;
|
748
|
+
goto tr50;
|
749
|
+
tr50:
|
750
|
+
#line 52 "parser.rl"
|
751
|
+
{MARK(query_start, p); }
|
752
|
+
goto st35;
|
753
753
|
st35:
|
754
754
|
if ( ++p == pe )
|
755
755
|
goto _test_eof35;
|
756
756
|
case 35:
|
757
|
+
#line 758 "parser.c"
|
757
758
|
switch( (*p) ) {
|
758
|
-
case 32: goto
|
759
|
-
case
|
760
|
-
case
|
759
|
+
case 32: goto tr55;
|
760
|
+
case 35: goto tr56;
|
761
|
+
case 37: goto st36;
|
762
|
+
case 127: goto st0;
|
761
763
|
}
|
762
|
-
if ( (*p)
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
goto st36;
|
770
|
-
goto st0;
|
764
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
765
|
+
goto st0;
|
766
|
+
goto st35;
|
767
|
+
tr53:
|
768
|
+
#line 52 "parser.rl"
|
769
|
+
{MARK(query_start, p); }
|
770
|
+
goto st36;
|
771
771
|
st36:
|
772
772
|
if ( ++p == pe )
|
773
773
|
goto _test_eof36;
|
774
774
|
case 36:
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
if ( (*p) < 48 ) {
|
781
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
775
|
+
#line 776 "parser.c"
|
776
|
+
if ( (*p) == 117 )
|
777
|
+
goto st38;
|
778
|
+
if ( (*p) < 65 ) {
|
779
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
782
780
|
goto st37;
|
783
|
-
} else if ( (*p) >
|
784
|
-
if (
|
781
|
+
} else if ( (*p) > 70 ) {
|
782
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
785
783
|
goto st37;
|
786
784
|
} else
|
787
785
|
goto st37;
|
@@ -790,37 +788,27 @@ st37:
|
|
790
788
|
if ( ++p == pe )
|
791
789
|
goto _test_eof37;
|
792
790
|
case 37:
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
800
|
-
goto st38;
|
801
|
-
} else if ( (*p) > 57 ) {
|
802
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
803
|
-
goto st38;
|
791
|
+
if ( (*p) < 65 ) {
|
792
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
793
|
+
goto st35;
|
794
|
+
} else if ( (*p) > 70 ) {
|
795
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
796
|
+
goto st35;
|
804
797
|
} else
|
805
|
-
goto
|
798
|
+
goto st35;
|
806
799
|
goto st0;
|
807
800
|
st38:
|
808
801
|
if ( ++p == pe )
|
809
802
|
goto _test_eof38;
|
810
803
|
case 38:
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
818
|
-
goto st39;
|
819
|
-
} else if ( (*p) > 57 ) {
|
820
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
821
|
-
goto st39;
|
804
|
+
if ( (*p) < 65 ) {
|
805
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
806
|
+
goto st37;
|
807
|
+
} else if ( (*p) > 70 ) {
|
808
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
809
|
+
goto st37;
|
822
810
|
} else
|
823
|
-
goto
|
811
|
+
goto st37;
|
824
812
|
goto st0;
|
825
813
|
st39:
|
826
814
|
if ( ++p == pe )
|
@@ -1078,6 +1066,78 @@ st53:
|
|
1078
1066
|
if ( ++p == pe )
|
1079
1067
|
goto _test_eof53;
|
1080
1068
|
case 53:
|
1069
|
+
switch( (*p) ) {
|
1070
|
+
case 32: goto tr2;
|
1071
|
+
case 36: goto st54;
|
1072
|
+
case 95: goto st54;
|
1073
|
+
}
|
1074
|
+
if ( (*p) < 48 ) {
|
1075
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1076
|
+
goto st54;
|
1077
|
+
} else if ( (*p) > 57 ) {
|
1078
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1079
|
+
goto st54;
|
1080
|
+
} else
|
1081
|
+
goto st54;
|
1082
|
+
goto st0;
|
1083
|
+
st54:
|
1084
|
+
if ( ++p == pe )
|
1085
|
+
goto _test_eof54;
|
1086
|
+
case 54:
|
1087
|
+
switch( (*p) ) {
|
1088
|
+
case 32: goto tr2;
|
1089
|
+
case 36: goto st55;
|
1090
|
+
case 95: goto st55;
|
1091
|
+
}
|
1092
|
+
if ( (*p) < 48 ) {
|
1093
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1094
|
+
goto st55;
|
1095
|
+
} else if ( (*p) > 57 ) {
|
1096
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1097
|
+
goto st55;
|
1098
|
+
} else
|
1099
|
+
goto st55;
|
1100
|
+
goto st0;
|
1101
|
+
st55:
|
1102
|
+
if ( ++p == pe )
|
1103
|
+
goto _test_eof55;
|
1104
|
+
case 55:
|
1105
|
+
switch( (*p) ) {
|
1106
|
+
case 32: goto tr2;
|
1107
|
+
case 36: goto st56;
|
1108
|
+
case 95: goto st56;
|
1109
|
+
}
|
1110
|
+
if ( (*p) < 48 ) {
|
1111
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1112
|
+
goto st56;
|
1113
|
+
} else if ( (*p) > 57 ) {
|
1114
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1115
|
+
goto st56;
|
1116
|
+
} else
|
1117
|
+
goto st56;
|
1118
|
+
goto st0;
|
1119
|
+
st56:
|
1120
|
+
if ( ++p == pe )
|
1121
|
+
goto _test_eof56;
|
1122
|
+
case 56:
|
1123
|
+
switch( (*p) ) {
|
1124
|
+
case 32: goto tr2;
|
1125
|
+
case 36: goto st57;
|
1126
|
+
case 95: goto st57;
|
1127
|
+
}
|
1128
|
+
if ( (*p) < 48 ) {
|
1129
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1130
|
+
goto st57;
|
1131
|
+
} else if ( (*p) > 57 ) {
|
1132
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1133
|
+
goto st57;
|
1134
|
+
} else
|
1135
|
+
goto st57;
|
1136
|
+
goto st0;
|
1137
|
+
st57:
|
1138
|
+
if ( ++p == pe )
|
1139
|
+
goto _test_eof57;
|
1140
|
+
case 57:
|
1081
1141
|
if ( (*p) == 32 )
|
1082
1142
|
goto tr2;
|
1083
1143
|
goto st0;
|
@@ -1097,7 +1157,7 @@ case 53:
|
|
1097
1157
|
_test_eof14: cs = 14; goto _test_eof;
|
1098
1158
|
_test_eof15: cs = 15; goto _test_eof;
|
1099
1159
|
_test_eof16: cs = 16; goto _test_eof;
|
1100
|
-
|
1160
|
+
_test_eof58: cs = 58; goto _test_eof;
|
1101
1161
|
_test_eof17: cs = 17; goto _test_eof;
|
1102
1162
|
_test_eof18: cs = 18; goto _test_eof;
|
1103
1163
|
_test_eof19: cs = 19; goto _test_eof;
|
@@ -1135,6 +1195,10 @@ case 53:
|
|
1135
1195
|
_test_eof51: cs = 51; goto _test_eof;
|
1136
1196
|
_test_eof52: cs = 52; goto _test_eof;
|
1137
1197
|
_test_eof53: cs = 53; goto _test_eof;
|
1198
|
+
_test_eof54: cs = 54; goto _test_eof;
|
1199
|
+
_test_eof55: cs = 55; goto _test_eof;
|
1200
|
+
_test_eof56: cs = 56; goto _test_eof;
|
1201
|
+
_test_eof57: cs = 57; goto _test_eof;
|
1138
1202
|
|
1139
1203
|
_test_eof: {}
|
1140
1204
|
_out: {}
|
data/lib/rack/adapter/rails.rb
CHANGED
@@ -22,7 +22,7 @@ module Rack
|
|
22
22
|
|
23
23
|
load_application
|
24
24
|
|
25
|
-
@rails_app = if rack_based?
|
25
|
+
@rails_app = if self.class.rack_based?
|
26
26
|
ActionController::Dispatcher.new
|
27
27
|
else
|
28
28
|
CgiApp.new
|
@@ -31,11 +31,6 @@ module Rack
|
|
31
31
|
@file_app = Rack::File.new(::File.join(RAILS_ROOT, "public"))
|
32
32
|
end
|
33
33
|
|
34
|
-
def rack_based?
|
35
|
-
rails_version = ::Rails::VERSION
|
36
|
-
rails_version::MAJOR >= 2 && rails_version::MINOR >= 2 && rails_version::TINY >= 3
|
37
|
-
end
|
38
|
-
|
39
34
|
def load_application
|
40
35
|
ENV['RAILS_ENV'] = @env
|
41
36
|
|
@@ -73,6 +68,14 @@ module Rack
|
|
73
68
|
# No static file, let Rails handle it
|
74
69
|
@rails_app.call(env)
|
75
70
|
end
|
71
|
+
|
72
|
+
def self.rack_based?
|
73
|
+
rails_version = ::Rails::VERSION
|
74
|
+
return false if rails_version::MAJOR < 2
|
75
|
+
return false if rails_version::MAJOR == 2 && rails_version::MINOR < 2
|
76
|
+
return false if rails_version::MAJOR == 2 && rails_version::MINOR == 2 && rails_version::TINY < 3
|
77
|
+
true # >= 2.2.3
|
78
|
+
end
|
76
79
|
|
77
80
|
protected
|
78
81
|
# For Rails pre Rack (2.3)
|
data/lib/thin/backends/base.rb
CHANGED
@@ -27,6 +27,10 @@ module Thin
|
|
27
27
|
attr_writer :threaded
|
28
28
|
def threaded?; @threaded end
|
29
29
|
|
30
|
+
# Allow using SSL in the backend.
|
31
|
+
attr_writer :ssl, :ssl_options
|
32
|
+
def ssl?; @ssl end
|
33
|
+
|
30
34
|
# Number of persistent connections currently opened
|
31
35
|
attr_accessor :persistent_connection_count
|
32
36
|
|
@@ -125,6 +129,10 @@ module Thin
|
|
125
129
|
connection.app = @server.app
|
126
130
|
connection.comm_inactivity_timeout = @timeout
|
127
131
|
connection.threaded = @threaded
|
132
|
+
|
133
|
+
if @ssl
|
134
|
+
connection.start_tls(@ssl_options)
|
135
|
+
end
|
128
136
|
|
129
137
|
# We control the number of persistent connections by keeping
|
130
138
|
# a count of the total one allowed yet.
|
@@ -14,10 +14,15 @@ module Thin
|
|
14
14
|
# Connect the server
|
15
15
|
def connect
|
16
16
|
at_exit { remove_socket_file } # In case it crashes
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
old_umask = File.umask(0)
|
18
|
+
begin
|
19
|
+
EventMachine.start_unix_domain_server(@socket, UnixConnection, &method(:initialize_connection))
|
20
|
+
# HACK EventMachine.start_unix_domain_server doesn't return the connection signature
|
21
|
+
# so we have to go in the internal stuff to find it.
|
20
22
|
@signature = EventMachine.instance_eval{@acceptors.keys.first}
|
23
|
+
ensure
|
24
|
+
File.umask(old_umask)
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
# Stops the server
|
@@ -48,4 +53,4 @@ module Thin
|
|
48
53
|
'127.0.0.1' # Unix domain sockets can only be local
|
49
54
|
end
|
50
55
|
end
|
51
|
-
end
|
56
|
+
end
|
data/lib/thin/connection.rb
CHANGED
@@ -29,7 +29,7 @@ module Thin
|
|
29
29
|
# Calling the application in a threaded allowing
|
30
30
|
# concurrent processing of requests.
|
31
31
|
attr_writer :threaded
|
32
|
-
|
32
|
+
|
33
33
|
# Get the connection ready to process a request.
|
34
34
|
def post_init
|
35
35
|
@request = Request.new
|
@@ -67,6 +67,14 @@ module Thin
|
|
67
67
|
# callback is no longer referenced, so be tidy!
|
68
68
|
@request.async_callback = method(:post_process)
|
69
69
|
|
70
|
+
if @backend.ssl?
|
71
|
+
@request.env["rack.url_scheme"] = "https"
|
72
|
+
|
73
|
+
if cert = get_peer_cert
|
74
|
+
@request.env['rack.peer_cert'] = cert
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
70
78
|
# When we're under a non-async framework like rails, we can still spawn
|
71
79
|
# off async responses using the callback info, so there's little point
|
72
80
|
# in removing this.
|
@@ -51,6 +51,12 @@ module Thin
|
|
51
51
|
server.threaded = @options[:threaded]
|
52
52
|
server.no_epoll = @options[:no_epoll] if server.backend.respond_to?(:no_epoll=)
|
53
53
|
|
54
|
+
# ssl support
|
55
|
+
if @options[:ssl]
|
56
|
+
server.ssl = true
|
57
|
+
server.ssl_options = { :private_key_file => @options[:ssl_key_file], :cert_chain_file => @options[:ssl_cert_file], :verify_peer => @options[:ssl_verify] }
|
58
|
+
end
|
59
|
+
|
54
60
|
# Detach the process, after this line the current process returns
|
55
61
|
server.daemonize if @options[:daemonize]
|
56
62
|
|
data/lib/thin/daemonizing.rb
CHANGED
@@ -5,6 +5,8 @@ module Process
|
|
5
5
|
# Returns +true+ the process identied by +pid+ is running.
|
6
6
|
def running?(pid)
|
7
7
|
Process.getpgid(pid) != -1
|
8
|
+
rescue Errno::EPERM
|
9
|
+
true
|
8
10
|
rescue Errno::ESRCH
|
9
11
|
false
|
10
12
|
end
|
@@ -44,6 +46,7 @@ module Thin
|
|
44
46
|
# HACK we need to create the directory before daemonization to prevent a bug under 1.9
|
45
47
|
# ignoring all signals when the directory is created after daemonization.
|
46
48
|
FileUtils.mkdir_p File.dirname(@pid_file)
|
49
|
+
FileUtils.mkdir_p File.dirname(@log_file)
|
47
50
|
|
48
51
|
Daemonize.daemonize(File.expand_path(@log_file), name)
|
49
52
|
|
@@ -83,12 +86,13 @@ module Thin
|
|
83
86
|
|
84
87
|
# Restart the server.
|
85
88
|
def restart
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
if @on_restart
|
90
|
+
log '>> Restarting ...'
|
91
|
+
stop
|
92
|
+
remove_pid_file
|
93
|
+
@on_restart.call
|
94
|
+
exit!
|
95
|
+
end
|
92
96
|
end
|
93
97
|
|
94
98
|
module ClassMethods
|
data/lib/thin/response.rb
CHANGED
@@ -7,6 +7,8 @@ module Thin
|
|
7
7
|
SERVER = 'Server'.freeze
|
8
8
|
CONTENT_LENGTH = 'Content-Length'.freeze
|
9
9
|
|
10
|
+
PERSISTENT_STATUSES = [100, 101].freeze
|
11
|
+
|
10
12
|
# Status code
|
11
13
|
attr_accessor :status
|
12
14
|
|
@@ -93,9 +95,10 @@ module Thin
|
|
93
95
|
end
|
94
96
|
|
95
97
|
# Persistent connection must be requested as keep-alive
|
96
|
-
# from the server and have a Content-Length
|
98
|
+
# from the server and have a Content-Length, or the response
|
99
|
+
# status must require that the connection remain open.
|
97
100
|
def persistent?
|
98
|
-
@persistent && @headers.has_key?(CONTENT_LENGTH)
|
101
|
+
(@persistent && @headers.has_key?(CONTENT_LENGTH)) || PERSISTENT_STATUSES.include?(@status)
|
99
102
|
end
|
100
103
|
end
|
101
104
|
end
|
data/lib/thin/runner.rb
CHANGED
@@ -70,7 +70,15 @@ module Thin
|
|
70
70
|
"Rack adapter") { |file| @options[:rackup] = file }
|
71
71
|
opts.on("-c", "--chdir DIR", "Change to dir before starting") { |dir| @options[:chdir] = File.expand_path(dir) }
|
72
72
|
opts.on( "--stats PATH", "Mount the Stats adapter under PATH") { |path| @options[:stats] = path }
|
73
|
-
|
73
|
+
|
74
|
+
opts.separator ""
|
75
|
+
opts.separator "SSL options:"
|
76
|
+
|
77
|
+
opts.on( "--ssl", "Enables SSL") { @options[:ssl] = true }
|
78
|
+
opts.on( "--ssl-key-file PATH", "Path to private key") { |path| @options[:ssl_key_file] = path }
|
79
|
+
opts.on( "--ssl-cert-file PATH", "Path to certificate") { |path| @options[:ssl_cert_file] = path }
|
80
|
+
opts.on( "--ssl-verify", "Enables SSL certificate verification") { @options[:ssl_verify] = true }
|
81
|
+
|
74
82
|
opts.separator ""
|
75
83
|
opts.separator "Adapter options:"
|
76
84
|
opts.on("-e", "--environment ENV", "Framework environment " +
|
@@ -122,7 +130,7 @@ module Thin
|
|
122
130
|
opts.separator "Common options:"
|
123
131
|
|
124
132
|
opts.on_tail("-r", "--require FILE", "require the library") { |file| @options[:require] << file }
|
125
|
-
opts.on_tail("-D", "--debug", "Set
|
133
|
+
opts.on_tail("-D", "--debug", "Set debugging on") { @options[:debug] = true }
|
126
134
|
opts.on_tail("-V", "--trace", "Set tracing on (log raw request/response)") { @options[:trace] = true }
|
127
135
|
opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
|
128
136
|
opts.on_tail('-v', '--version', "Show version") { puts Thin::SERVER; exit }
|
data/lib/thin/server.rb
CHANGED
@@ -82,6 +82,9 @@ module Thin
|
|
82
82
|
# Allow using threads in the backend.
|
83
83
|
def_delegators :backend, :threaded?, :threaded=
|
84
84
|
|
85
|
+
# Allow using SSL in the backend.
|
86
|
+
def_delegators :backend, :ssl?, :ssl=, :ssl_options=
|
87
|
+
|
85
88
|
# Address and port on which the server is listening for connections.
|
86
89
|
def_delegators :backend, :host, :port
|
87
90
|
|
data/lib/thin/version.rb
CHANGED
@@ -6,11 +6,11 @@ module Thin
|
|
6
6
|
module VERSION #:nodoc:
|
7
7
|
MAJOR = 1
|
8
8
|
MINOR = 2
|
9
|
-
TINY =
|
9
|
+
TINY = 8
|
10
10
|
|
11
11
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
12
12
|
|
13
|
-
CODENAME = "
|
13
|
+
CODENAME = "Black Keys".freeze
|
14
14
|
|
15
15
|
RACK = [1, 0].freeze # Rack protocol version
|
16
16
|
end
|
data/lib/thin_parser.so
ADDED
Binary file
|
data/spec/connection_spec.rb
CHANGED
data/spec/daemonizing_spec.rb
CHANGED
@@ -150,6 +150,10 @@ describe 'Daemonizing' do
|
|
150
150
|
proc { sleep 0.1 while File.exist?(@server.pid_file) }.should take_less_then(10)
|
151
151
|
end
|
152
152
|
|
153
|
+
it "should ignore if no restart block specified" do
|
154
|
+
TestServer.restart(@server.pid_file)
|
155
|
+
end
|
156
|
+
|
153
157
|
it "should not restart when not running" do
|
154
158
|
silence_stream STDOUT do
|
155
159
|
TestServer.restart(@server.pid_file)
|
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
@rails_app_path = File.dirname(__FILE__) + '/../rails_app'
|
10
10
|
@request = Rack::MockRequest.new(Rack::Adapter::Rails.new(:root => @rails_app_path))
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "should handle simple GET request" do
|
14
14
|
res = @request.get("/simple", :lint => true)
|
15
15
|
|
@@ -104,3 +104,70 @@ begin
|
|
104
104
|
rescue Gem::LoadError
|
105
105
|
warn 'Rails 2.0.2 is required to run the Rails adapter specs'
|
106
106
|
end
|
107
|
+
|
108
|
+
module RailsMock
|
109
|
+
module VERSION
|
110
|
+
MAJOR = 0
|
111
|
+
MINOR = 0
|
112
|
+
TINY = 0
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe Rack::Adapter::Rails, "Adapter version" do
|
117
|
+
before do
|
118
|
+
unless defined?(::Rails)
|
119
|
+
::Rails = RailsMock
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should use Rack based adapter when Rails = 2.2.3" do
|
124
|
+
with_rails_version(2, 2, 3) do
|
125
|
+
Rack::Adapter::Rails.should be_rack_based
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should not use Rack based adapter when Rails < 2.2.3" do
|
130
|
+
with_rails_version(2, 2, 2) do
|
131
|
+
Rack::Adapter::Rails.should_not be_rack_based
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should not use Rack based adapter when Rails = 1.2.3" do
|
136
|
+
with_rails_version(1, 2, 2) do
|
137
|
+
Rack::Adapter::Rails.should_not be_rack_based
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should use Rack based adapter when Rails = 3.0.0" do
|
142
|
+
with_rails_version(3, 0, 0) do
|
143
|
+
Rack::Adapter::Rails.should be_rack_based
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def with_rails_version(major, minor, tiny)
|
148
|
+
old_major = ::Rails::VERSION::MAJOR
|
149
|
+
old_minor = ::Rails::VERSION::MINOR
|
150
|
+
old_tiny = ::Rails::VERSION::TINY
|
151
|
+
|
152
|
+
silence_warnings do
|
153
|
+
::Rails::VERSION.const_set :MAJOR, major
|
154
|
+
::Rails::VERSION.const_set :MINOR, minor
|
155
|
+
::Rails::VERSION.const_set :TINY, tiny
|
156
|
+
end
|
157
|
+
|
158
|
+
yield
|
159
|
+
|
160
|
+
silence_warnings do
|
161
|
+
::Rails::VERSION.const_set :MAJOR, old_major
|
162
|
+
::Rails::VERSION.const_set :MINOR, old_minor
|
163
|
+
::Rails::VERSION.const_set :TINY, old_tiny
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def silence_warnings
|
168
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
169
|
+
yield
|
170
|
+
ensure
|
171
|
+
$VERBOSE = old_verbose
|
172
|
+
end unless method_defined?(:silence_warnings)
|
173
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
4
4
|
|
@@ -7,4 +7,4 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
|
|
7
7
|
require "dispatcher"
|
8
8
|
|
9
9
|
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
10
|
-
Dispatcher.dispatch
|
10
|
+
Dispatcher.dispatch
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
4
4
|
|
@@ -7,4 +7,4 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
|
|
7
7
|
require "dispatcher"
|
8
8
|
|
9
9
|
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
10
|
-
Dispatcher.dispatch
|
10
|
+
Dispatcher.dispatch
|
data/spec/request/parser_spec.rb
CHANGED
@@ -240,4 +240,15 @@ EOS
|
|
240
240
|
env[pi].should == uri.path
|
241
241
|
end
|
242
242
|
end
|
243
|
+
|
244
|
+
it "should parse IE7 badly encoded URL" do
|
245
|
+
body = <<-EOS.chomp
|
246
|
+
GET /H%uFFFDhnchenbrustfilet HTTP/1.1
|
247
|
+
Host: localhost:3000
|
248
|
+
|
249
|
+
EOS
|
250
|
+
request = R(body, true)
|
251
|
+
|
252
|
+
request.env['REQUEST_URI'].should == "/H%uFFFDhnchenbrustfilet"
|
253
|
+
end
|
243
254
|
end
|
data/spec/response_spec.rb
CHANGED
@@ -80,6 +80,17 @@ describe Response do
|
|
80
80
|
@response.should_not be_persistent
|
81
81
|
end
|
82
82
|
|
83
|
+
it "should be persistent when the status code implies it should stay open" do
|
84
|
+
@response = Response.new
|
85
|
+
@response.status = 100
|
86
|
+
# "There are no required headers for this class of status code" -- HTTP spec 10.1
|
87
|
+
@response.body = ''
|
88
|
+
|
89
|
+
# Specifying it as persistent in the code is NOT required
|
90
|
+
# @response.persistent!
|
91
|
+
@response.should be_persistent
|
92
|
+
end
|
93
|
+
|
83
94
|
it "should be persistent when specified" do
|
84
95
|
@response.persistent!
|
85
96
|
@response.should be_persistent
|
data/spec/spec_helper.rb
CHANGED
@@ -144,6 +144,7 @@ module Helpers
|
|
144
144
|
|
145
145
|
def start_server(address=DEFAULT_TEST_ADDRESS, port=DEFAULT_TEST_PORT, options={}, &app)
|
146
146
|
@server = Thin::Server.new(address, port, options, app)
|
147
|
+
@server.ssl = options[:ssl]
|
147
148
|
@server.threaded = options[:threaded]
|
148
149
|
@server.timeout = 3
|
149
150
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: x86-mswin32
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Cournoyer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2011-02-25 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/thin/statuses.rb
|
97
97
|
- lib/thin/version.rb
|
98
98
|
- lib/thin.rb
|
99
|
+
- lib/thin_parser.so
|
99
100
|
- spec/backends/swiftiply_client_spec.rb
|
100
101
|
- spec/backends/tcp_server_spec.rb
|
101
102
|
- spec/backends/unix_server_spec.rb
|
@@ -186,8 +187,6 @@ files:
|
|
186
187
|
- ext/thin_parser/extconf.rb
|
187
188
|
- ext/thin_parser/common.rl
|
188
189
|
- ext/thin_parser/parser.rl
|
189
|
-
- lib/1.8/thin_parser.so
|
190
|
-
- lib/1.9/thin_parser.so
|
191
190
|
has_rdoc: true
|
192
191
|
homepage: http://code.macournoyer.com/thin/
|
193
192
|
licenses: []
|
data/lib/1.8/thin_parser.so
DELETED
Binary file
|
data/lib/1.9/thin_parser.so
DELETED
Binary file
|