thin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of thin might be problematic. Click here for more details.
- data/README +47 -5
- data/Rakefile +33 -2
- data/doc/rdoc/classes/Kernel.html +182 -0
- data/doc/rdoc/classes/Process.html +175 -0
- data/doc/rdoc/classes/Thin.html +184 -0
- data/doc/rdoc/classes/Thin/CGIWrapper.html +438 -0
- data/doc/rdoc/classes/Thin/Cluster.html +392 -0
- data/doc/rdoc/classes/Thin/Command.html +221 -0
- data/doc/rdoc/classes/Thin/CommandError.html +154 -0
- data/doc/rdoc/classes/Thin/Commands.html +145 -0
- data/doc/rdoc/classes/Thin/Daemonizable.html +250 -0
- data/doc/rdoc/classes/Thin/Daemonizable/ClassMethods.html +203 -0
- data/doc/rdoc/classes/Thin/DirHandler.html +250 -0
- data/doc/rdoc/classes/Thin/Handler.html +195 -0
- data/doc/rdoc/classes/Thin/Headers.html +244 -0
- data/doc/rdoc/classes/Thin/InvalidRequest.html +150 -0
- data/doc/rdoc/classes/Thin/Logging.html +214 -0
- data/doc/rdoc/classes/Thin/RailsHandler.html +234 -0
- data/doc/rdoc/classes/Thin/RailsServer.html +175 -0
- data/doc/rdoc/classes/Thin/Request.html +379 -0
- data/doc/rdoc/classes/Thin/Response.html +311 -0
- data/doc/rdoc/classes/Thin/Server.html +381 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/README.html +260 -0
- data/doc/rdoc/files/bin/thin.html +188 -0
- data/doc/rdoc/files/bin/thin_cluster.html +175 -0
- data/doc/rdoc/files/lib/thin/cgi_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/cluster_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/command_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/consts_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/daemonizing_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/handler_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/headers_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/logging_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/mime_types_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/rails_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/recipes_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/request_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/response_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/server_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/statuses_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/version_rb.html +171 -0
- data/doc/rdoc/index.html +10 -0
- data/doc/rdoc/logo.gif +0 -0
- data/doc/rdoc/rdoc-style.css +86 -0
- data/lib/thin/commands/cluster/config.rb +2 -0
- data/lib/thin/consts.rb +4 -0
- data/lib/thin/request.rb +30 -11
- data/lib/thin/server.rb +1 -1
- data/lib/thin/version.rb +1 -1
- metadata +52 -1
@@ -0,0 +1,171 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
thin » File: version.rb
|
7
|
+
</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
<script language="JavaScript" type="text/javascript">
|
11
|
+
// <![CDATA[
|
12
|
+
|
13
|
+
function toggleSource( id )
|
14
|
+
{
|
15
|
+
var elem
|
16
|
+
var link
|
17
|
+
|
18
|
+
if( document.getElementById )
|
19
|
+
{
|
20
|
+
elem = document.getElementById( id )
|
21
|
+
link = document.getElementById( "l_" + id )
|
22
|
+
}
|
23
|
+
else if ( document.all )
|
24
|
+
{
|
25
|
+
elem = eval( "document.all." + id )
|
26
|
+
link = eval( "document.all.l_" + id )
|
27
|
+
}
|
28
|
+
else
|
29
|
+
return false;
|
30
|
+
|
31
|
+
if( elem.style.display == "block" )
|
32
|
+
{
|
33
|
+
elem.style.display = "none"
|
34
|
+
link.innerHTML = "show source"
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
elem.style.display = "block"
|
39
|
+
link.innerHTML = "hide source"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function openCode( url )
|
44
|
+
{
|
45
|
+
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
46
|
+
}
|
47
|
+
// ]]>
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
<ul id="menu">
|
52
|
+
<li><a href="/thin/">home</a></li>
|
53
|
+
<li><a href="/thin/doc/">doc</a></li>
|
54
|
+
<li><a href="/thin/trac.fcgi/timeline">timeline</a></li>
|
55
|
+
<li><a href="/thin/trac.fcgi/browser">code</a></li>
|
56
|
+
<li><a href="/thin/trac.fcgi/report">tickets</a></li>
|
57
|
+
<li><a href="/thin/trac.fcgi/newticket">new ticket</a></li>
|
58
|
+
</ul>
|
59
|
+
<div id="sidebar">
|
60
|
+
<h2>Files</h2>
|
61
|
+
<ul class="list">
|
62
|
+
<li><a href="../../../files/README.html" value="File: README">README</a></li>
|
63
|
+
<li><a href="../../../files/lib/thin/cgi_rb.html" value="File: cgi.rb">lib/thin/cgi.rb</a></li>
|
64
|
+
<li><a href="../../../files/lib/thin/cluster_rb.html" value="File: cluster.rb">lib/thin/cluster.rb</a></li>
|
65
|
+
<li><a href="../../../files/lib/thin/command_rb.html" value="File: command.rb">lib/thin/command.rb</a></li>
|
66
|
+
<li><a href="../../../files/lib/thin/consts_rb.html" value="File: consts.rb">lib/thin/consts.rb</a></li>
|
67
|
+
<li><a href="../../../files/lib/thin/daemonizing_rb.html" value="File: daemonizing.rb">lib/thin/daemonizing.rb</a></li>
|
68
|
+
<li><a href="../../../files/lib/thin/handler_rb.html" value="File: handler.rb">lib/thin/handler.rb</a></li>
|
69
|
+
<li><a href="../../../files/lib/thin/headers_rb.html" value="File: headers.rb">lib/thin/headers.rb</a></li>
|
70
|
+
<li><a href="../../../files/lib/thin/logging_rb.html" value="File: logging.rb">lib/thin/logging.rb</a></li>
|
71
|
+
<li><a href="../../../files/lib/thin/mime_types_rb.html" value="File: mime_types.rb">lib/thin/mime_types.rb</a></li>
|
72
|
+
<li><a href="../../../files/lib/thin/rails_rb.html" value="File: rails.rb">lib/thin/rails.rb</a></li>
|
73
|
+
<li><a href="../../../files/lib/thin/recipes_rb.html" value="File: recipes.rb">lib/thin/recipes.rb</a></li>
|
74
|
+
<li><a href="../../../files/lib/thin/request_rb.html" value="File: request.rb">lib/thin/request.rb</a></li>
|
75
|
+
<li><a href="../../../files/lib/thin/response_rb.html" value="File: response.rb">lib/thin/response.rb</a></li>
|
76
|
+
<li><a href="../../../files/lib/thin/server_rb.html" value="File: server.rb">lib/thin/server.rb</a></li>
|
77
|
+
<li><a href="../../../files/lib/thin/statuses_rb.html" value="File: statuses.rb">lib/thin/statuses.rb</a></li>
|
78
|
+
<li><a href="../../../files/lib/thin/version_rb.html" value="File: version.rb">lib/thin/version.rb</a></li>
|
79
|
+
<li><a href="../../../files/bin/thin.html" value="File: thin">bin/thin</a></li>
|
80
|
+
<li><a href="../../../files/bin/thin_cluster.html" value="File: thin_cluster">bin/thin_cluster</a></li>
|
81
|
+
</ul>
|
82
|
+
|
83
|
+
<h2>Classes</h2>
|
84
|
+
<ul class="list">
|
85
|
+
<li><a href="../../../classes/Thin.html" title="Module: Thin">Thin</a></li>
|
86
|
+
<li><a href="../../../classes/Thin/Commands.html" title="Module: Thin::Commands">Thin::Commands</a></li>
|
87
|
+
<li><a href="../../../classes/Thin/Daemonizable.html" title="Module: Thin::Daemonizable">Thin::Daemonizable</a></li>
|
88
|
+
<li><a href="../../../classes/Thin/Daemonizable/ClassMethods.html" title="Module: Thin::Daemonizable::ClassMethods">Thin::Daemonizable::ClassMethods</a></li>
|
89
|
+
<li><a href="../../../classes/Thin/VERSION.html" title="Module: Thin::VERSION">Thin::VERSION</a></li>
|
90
|
+
<li><a href="../../../classes/Thin/Logging.html" title="Module: Thin::Logging">Thin::Logging</a></li>
|
91
|
+
<li><a href="../../../classes/Thin/DirHandler.html" title="Class: Thin::DirHandler">Thin::DirHandler</a></li>
|
92
|
+
<li><a href="../../../classes/Thin/InvalidRequest.html" title="Class: Thin::InvalidRequest">Thin::InvalidRequest</a></li>
|
93
|
+
<li><a href="../../../classes/Thin/CGIWrapper.html" title="Class: Thin::CGIWrapper">Thin::CGIWrapper</a></li>
|
94
|
+
<li><a href="../../../classes/Thin/Command.html" title="Class: Thin::Command">Thin::Command</a></li>
|
95
|
+
<li><a href="../../../classes/Thin/Response.html" title="Class: Thin::Response">Thin::Response</a></li>
|
96
|
+
<li><a href="../../../classes/Thin/Headers.html" title="Class: Thin::Headers">Thin::Headers</a></li>
|
97
|
+
<li><a href="../../../classes/Thin/Server.html" title="Class: Thin::Server">Thin::Server</a></li>
|
98
|
+
<li><a href="../../../classes/Thin/CommandError.html" title="Class: Thin::CommandError">Thin::CommandError</a></li>
|
99
|
+
<li><a href="../../../classes/Thin/Request.html" title="Class: Thin::Request">Thin::Request</a></li>
|
100
|
+
<li><a href="../../../classes/Thin/RailsServer.html" title="Class: Thin::RailsServer">Thin::RailsServer</a></li>
|
101
|
+
<li><a href="../../../classes/Thin/Cluster.html" title="Class: Thin::Cluster">Thin::Cluster</a></li>
|
102
|
+
<li><a href="../../../classes/Thin/RailsHandler.html" title="Class: Thin::RailsHandler">Thin::RailsHandler</a></li>
|
103
|
+
<li><a href="../../../classes/Thin/Handler.html" title="Class: Thin::Handler">Thin::Handler</a></li>
|
104
|
+
<li><a href="../../../classes/Process.html" title="Module: Process">Process</a></li>
|
105
|
+
<li><a href="../../../classes/Kernel.html" title="Module: Kernel">Kernel</a></li>
|
106
|
+
</ul>
|
107
|
+
</div>
|
108
|
+
<div id="container">
|
109
|
+
<div id="header">
|
110
|
+
<a href="/thin/" title="Home">
|
111
|
+
<img id="logo" src="../../../logo.gif" />
|
112
|
+
</a>
|
113
|
+
<h2 id="tag_line">A fast and very simple Ruby web server</h2>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="content">
|
117
|
+
<h2>File: version.rb</h2>
|
118
|
+
|
119
|
+
<div id="lib/thin/version.rb" class="page_shade">
|
120
|
+
<div class="page">
|
121
|
+
<div class="header">
|
122
|
+
<div class="path">lib/thin/version.rb / Mon Dec 03 23:36:39 -0500 2007</div>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
<h2>Set of Capistrano 2 recipes</h2>
|
126
|
+
<p>
|
127
|
+
To use, add on top of your Capfile file:
|
128
|
+
</p>
|
129
|
+
<pre>
|
130
|
+
load 'config/deploy'
|
131
|
+
# ...
|
132
|
+
require 'thin'
|
133
|
+
require 'thin/recipes'
|
134
|
+
</pre>
|
135
|
+
<h3>Configurable parameters</h3>
|
136
|
+
<p>
|
137
|
+
You can configure some parameters but it should work out of the box. Path
|
138
|
+
to the thin_cluster script, don‘t need to change this if you
|
139
|
+
installed thin as a gem on the server.
|
140
|
+
</p>
|
141
|
+
<pre>
|
142
|
+
set :thin_cluster, "thin_cluster"
|
143
|
+
</pre>
|
144
|
+
<p>
|
145
|
+
Location of the config file:
|
146
|
+
</p>
|
147
|
+
<pre>
|
148
|
+
set :thin_config, "#{release_path}/config/thin.yml"
|
149
|
+
</pre>
|
150
|
+
|
151
|
+
|
152
|
+
<strong>Requires:</strong>
|
153
|
+
socket
|
154
|
+
</ul>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
<div id="footer">
|
167
|
+
<hr />
|
168
|
+
© <a href="http://macournoyer.com">Marc-André Cournoyer</a>
|
169
|
+
</div>
|
170
|
+
</body>
|
171
|
+
</html>
|
data/doc/rdoc/index.html
ADDED
data/doc/rdoc/logo.gif
ADDED
Binary file
|
@@ -0,0 +1,86 @@
|
|
1
|
+
body { margin:0; padding:0; font: 12px Times, "Times New Roman"; text-align: center }
|
2
|
+
img { border:0 }
|
3
|
+
|
4
|
+
a { color: #666; text-decoration: none; border-bottom: solid 1px #ccc; }
|
5
|
+
a:hover { color: #333; border-bottom: solid 1px #aaa; }
|
6
|
+
|
7
|
+
acronym { border-bottom: dotted 1px #ccc; cursor: help; }
|
8
|
+
|
9
|
+
pre { font: 9px Courier, "Courier New"; background: #111; color: #fff; padding: 3px; border: solid 1px #ccc; }
|
10
|
+
hr { background: url(/thin/images/split.gif) no-repeat; height: 30px; width: 100px; border: 0; margin: 40px auto; }
|
11
|
+
|
12
|
+
input, select, textarea { font: 9px Tahoma, Arial; }
|
13
|
+
label { font-size: 11px; }
|
14
|
+
|
15
|
+
h1, h2, h3, h4 { margin: 12px 0 8px 0; padding: 0; }
|
16
|
+
h3 { font-size: 14px; }
|
17
|
+
h4 { font-size: 13px; }
|
18
|
+
|
19
|
+
ul#menu { padding: 4px; margin:0; background: #111; list-style: none; border-bottom: solid 1px #ccc; }
|
20
|
+
ul#menu li { margin:0; display: inline; }
|
21
|
+
ul#menu li a { color: #fff; text-decoration: none; padding: 6px; border: 0; }
|
22
|
+
ul#menu li a:hover { text-decoration: underline; }
|
23
|
+
|
24
|
+
#container { width: 300px; margin: 0 auto; }
|
25
|
+
|
26
|
+
#header { padding: 30px 0 10px 0; }
|
27
|
+
#header #logo { padding-bottom: 10px; }
|
28
|
+
#header #tag_line { margin: 4px 0; font-size: 12px; letter-spacing: -1px; color: #333; }
|
29
|
+
|
30
|
+
#content { line-height: 16px; text-align: left; }
|
31
|
+
#content h1 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
|
32
|
+
#content h2 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
|
33
|
+
#content h3 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
|
34
|
+
|
35
|
+
#content ul { list-style-image: url(/thin/images/bullet.gif); margin: 0; padding: 0 20px; }
|
36
|
+
#content li { padding: 1px 0; }
|
37
|
+
|
38
|
+
#footer { margin: 60px 0 20px 0; font-size: 10px; color: #666; }
|
39
|
+
|
40
|
+
#sidebar { position: absolute; right: 0; width: 400px; text-align: right; padding: 10px; }
|
41
|
+
|
42
|
+
ul.list { list-style: none; }
|
43
|
+
ul.list li { margin: 0; padding: 1px 0; }
|
44
|
+
|
45
|
+
/*RDoc*/
|
46
|
+
.dyn-source { display: none; }
|
47
|
+
.path { text-align: center; font: 9px Tahoma, Arial; }
|
48
|
+
.method-type { font: 9px Tahoma, Arial; color: #fff; background: #111; border: solid 1px #ccc; padding: 1px; }
|
49
|
+
|
50
|
+
/*Trac*/
|
51
|
+
#container.wide { width: 600px; }
|
52
|
+
#prefs { position: absolute; right: 0; width: 200px; }
|
53
|
+
|
54
|
+
#content.timeline h2 { font: 9px Tahoma, Arial; border-bottom: solid 1px #ccc; color: #ccc; text-align: left; }
|
55
|
+
#content.timeline dt { padding: 3px; }
|
56
|
+
#content.timeline dt a { border: 0; }
|
57
|
+
#content.timeline dt a em { border-bottom: solid 1px #ccc; }
|
58
|
+
#content.timeline dt .time { font: 9px Tahoma, Arial; color: #fff; background: #111; border: solid 1px #ccc; padding: 1px; }
|
59
|
+
|
60
|
+
table { border-collapse: collapse; }
|
61
|
+
|
62
|
+
table.listing { margin: 30px 0; width: 100%; }
|
63
|
+
table.listing th { font: 9px Tahoma, Arial; border-bottom: solid 1px #ccc; text-align: left; }
|
64
|
+
table.listing th a { border: 0; }
|
65
|
+
table.listing td { padding: 4px; }
|
66
|
+
|
67
|
+
table .odd td { background: #eee; }
|
68
|
+
|
69
|
+
#jumprev { float: right; }
|
70
|
+
|
71
|
+
#help { float: right; margin: 20px 0; }
|
72
|
+
#altlinks { clear: both; }
|
73
|
+
|
74
|
+
#ctxtnav ul { padding: 4px; margin:0; list-style: none; }
|
75
|
+
#ctxtnav ul li { margin:0; display: inline; }
|
76
|
+
|
77
|
+
table.code { background: #111; color: #fff; padding: 3px; border: solid 1px #ccc; width: 100%; }
|
78
|
+
table.code tbody td { font: 10px Courier, "Courier New"; padding: 3px; }
|
79
|
+
table.code th.info { display: none; }
|
80
|
+
table.code th { font: 8px Tahoma, Arial; text-align: right; padding: 1px 6px; }
|
81
|
+
table.code th a { border: 0; }
|
82
|
+
table.code td { padding: 2px; }
|
83
|
+
|
84
|
+
.field, .buttons { margin: 14px 0; }
|
85
|
+
|
86
|
+
fieldset table, textarea { width: 100%; }
|
data/lib/thin/consts.rb
CHANGED
@@ -2,6 +2,10 @@ module Thin
|
|
2
2
|
NAME = 'thin'.freeze
|
3
3
|
SERVER = "#{NAME} #{VERSION::STRING}".freeze
|
4
4
|
|
5
|
+
# Versions for the protocoles used
|
6
|
+
HTTP_VERSION = 'HTTP/1.1'.freeze
|
7
|
+
CGI_VERSION = 'CGI/1.2'.freeze
|
8
|
+
|
5
9
|
# The basic max request size we'll try to read.
|
6
10
|
CHUNK_SIZE = 16 * 1024
|
7
11
|
|
data/lib/thin/request.rb
CHANGED
@@ -5,7 +5,9 @@ module Thin
|
|
5
5
|
|
6
6
|
# A request made to the server.
|
7
7
|
class Request
|
8
|
+
# HTTP headers that should not have a +HTTP_+ prefixed to the CGI variable name
|
8
9
|
HTTP_LESS_HEADERS = %w(Content-Length Content-Type).freeze
|
10
|
+
# Methods that might contain a body.
|
9
11
|
BODYFUL_METHODS = %w(POST PUT).freeze
|
10
12
|
|
11
13
|
# We control max length of different part of the request
|
@@ -19,19 +21,24 @@ module Thin
|
|
19
21
|
MAX_HEADER_LENGTH = 1024 * (80 + 32)
|
20
22
|
|
21
23
|
attr_reader :body, :params, :verb, :path
|
22
|
-
|
24
|
+
|
25
|
+
# For debugging and trace.
|
26
|
+
# When +trace+ is set to true, +raw+ will be populated with
|
27
|
+
# the raw request.
|
28
|
+
attr_accessor :trace, :raw
|
23
29
|
|
24
30
|
def initialize
|
25
31
|
@params = {
|
26
|
-
'GATEWAY_INTERFACE' =>
|
27
|
-
'HTTP_VERSION' =>
|
28
|
-
'SERVER_PROTOCOL' =>
|
32
|
+
'GATEWAY_INTERFACE' => CGI_VERSION,
|
33
|
+
'HTTP_VERSION' => HTTP_VERSION,
|
34
|
+
'SERVER_PROTOCOL' => HTTP_VERSION
|
29
35
|
}
|
30
36
|
@body = StringIO.new
|
31
37
|
@raw = ''
|
32
38
|
@trace = false
|
33
39
|
end
|
34
40
|
|
41
|
+
# Parse the headers and body from the +content+ buffer.
|
35
42
|
def parse!(content)
|
36
43
|
parse_headers! content
|
37
44
|
parse_body! content if BODYFUL_METHODS.include?(verb)
|
@@ -42,8 +49,11 @@ module Thin
|
|
42
49
|
end
|
43
50
|
|
44
51
|
# Parse the request headers from the socket into CGI like variables.
|
45
|
-
# Parse the request according to http://www.w3.org/Protocols/rfc2616/rfc2616.html
|
46
|
-
# Parse env variables according to http://www.ietf.org/rfc/rfc3875
|
52
|
+
# Parse the request according to http://www.w3.org/Protocols/rfc2616/rfc2616.html.
|
53
|
+
# Parse env variables according to http://www.ietf.org/rfc/rfc3875.
|
54
|
+
# Raises an InvalidRequest error when the request is not valid, because:
|
55
|
+
# * no valid request line
|
56
|
+
# * uri, path or header is too long
|
47
57
|
def parse_headers!(content)
|
48
58
|
if matches = readline(content).match(/^([A-Z]+) (.*?)(?:#(.*))? HTTP/)
|
49
59
|
@verb, uri, fragment = matches[1,3]
|
@@ -54,7 +64,7 @@ module Thin
|
|
54
64
|
raise InvalidRequest, 'No method specified' unless @verb
|
55
65
|
raise InvalidRequest, 'No URI specified' unless uri
|
56
66
|
|
57
|
-
#
|
67
|
+
# Validate various length for security
|
58
68
|
raise InvalidRequest, 'URI too long' if uri.size > MAX_REQUEST_URI_LENGTH
|
59
69
|
raise InvalidRequest, 'Fragment too long' if fragment && fragment.size > MAX_FRAGMENT_LENGTH
|
60
70
|
|
@@ -75,13 +85,14 @@ module Thin
|
|
75
85
|
@params['REQUEST_METHOD'] = @verb
|
76
86
|
@params['QUERY_STRING'] = query_string if query_string
|
77
87
|
|
88
|
+
# Parse all headers from 'Something-Weird' into @params['HTTP_SOMETHING_WEIRD']
|
78
89
|
headers_size = 0
|
79
90
|
until content.eof?
|
80
91
|
line = readline(content)
|
81
92
|
headers_size += line.size
|
82
|
-
|
83
|
-
|
84
|
-
|
93
|
+
|
94
|
+
break if ?\r == line[0] # Reached the end of the headers
|
95
|
+
if matches = line.match(/^([\w\-]+): (.*)$/)
|
85
96
|
name, value = matches[1,2]
|
86
97
|
raise InvalidRequest, 'Header name too long' if name.size > MAX_FIELD_NAME_LENGTH
|
87
98
|
raise InvalidRequest, 'Header value too long' if value.size > MAX_FIELD_VALUE_LENGTH
|
@@ -98,8 +109,16 @@ module Thin
|
|
98
109
|
@params['SERVER_NAME'] = @params['HTTP_HOST'].split(':')[0] if @params['HTTP_HOST']
|
99
110
|
end
|
100
111
|
|
112
|
+
# Parse the request body by chunks.
|
113
|
+
# We assume the Content-Length is valid and is the actual size of the body.
|
114
|
+
# This is garanteed when used behind a proxy server like Nginx:
|
115
|
+
# Note that when using the HTTP Proxy Module (or even when using FastCGI), the entire client
|
116
|
+
# request will be buffered in nginx before being passed on to the backend proxied servers.
|
117
|
+
# As a result, upload progress meters will not function correctly if they work by measuring
|
118
|
+
# the data received by the backend servers.
|
119
|
+
# - http://wiki.codemongers.com/NginxHttpProxyModule
|
120
|
+
# On Apache w/ mod_proxy, you need to install mod_accel : http://sysoev.ru/en/
|
101
121
|
def parse_body!(content)
|
102
|
-
# Parse by chunks
|
103
122
|
length = content_length
|
104
123
|
while @body.size < length
|
105
124
|
chunk = content.readpartial(CHUNK_SIZE)
|
data/lib/thin/server.rb
CHANGED
data/lib/thin/version.rb
CHANGED
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: thin
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
6
|
+
version: 0.4.0
|
7
7
|
date: 2007-12-03 00:00:00 -05:00
|
8
8
|
summary: Thin and fast web server
|
9
9
|
require_paths:
|
@@ -34,6 +34,57 @@ files:
|
|
34
34
|
- bin/thin
|
35
35
|
- bin/thin_cluster
|
36
36
|
- doc/benchmarks.txt
|
37
|
+
- doc/rdoc
|
38
|
+
- doc/rdoc/classes
|
39
|
+
- doc/rdoc/classes/Kernel.html
|
40
|
+
- doc/rdoc/classes/Process.html
|
41
|
+
- doc/rdoc/classes/Thin
|
42
|
+
- doc/rdoc/classes/Thin/CGIWrapper.html
|
43
|
+
- doc/rdoc/classes/Thin/Cluster.html
|
44
|
+
- doc/rdoc/classes/Thin/Command.html
|
45
|
+
- doc/rdoc/classes/Thin/CommandError.html
|
46
|
+
- doc/rdoc/classes/Thin/Commands.html
|
47
|
+
- doc/rdoc/classes/Thin/Daemonizable
|
48
|
+
- doc/rdoc/classes/Thin/Daemonizable/ClassMethods.html
|
49
|
+
- doc/rdoc/classes/Thin/Daemonizable.html
|
50
|
+
- doc/rdoc/classes/Thin/DirHandler.html
|
51
|
+
- doc/rdoc/classes/Thin/Handler.html
|
52
|
+
- doc/rdoc/classes/Thin/Headers.html
|
53
|
+
- doc/rdoc/classes/Thin/InvalidRequest.html
|
54
|
+
- doc/rdoc/classes/Thin/Logging.html
|
55
|
+
- doc/rdoc/classes/Thin/RailsHandler.html
|
56
|
+
- doc/rdoc/classes/Thin/RailsServer.html
|
57
|
+
- doc/rdoc/classes/Thin/Request.html
|
58
|
+
- doc/rdoc/classes/Thin/Response.html
|
59
|
+
- doc/rdoc/classes/Thin/Server.html
|
60
|
+
- doc/rdoc/classes/Thin.html
|
61
|
+
- doc/rdoc/created.rid
|
62
|
+
- doc/rdoc/files
|
63
|
+
- doc/rdoc/files/bin
|
64
|
+
- doc/rdoc/files/bin/thin.html
|
65
|
+
- doc/rdoc/files/bin/thin_cluster.html
|
66
|
+
- doc/rdoc/files/lib
|
67
|
+
- doc/rdoc/files/lib/thin
|
68
|
+
- doc/rdoc/files/lib/thin/cgi_rb.html
|
69
|
+
- doc/rdoc/files/lib/thin/cluster_rb.html
|
70
|
+
- doc/rdoc/files/lib/thin/command_rb.html
|
71
|
+
- doc/rdoc/files/lib/thin/consts_rb.html
|
72
|
+
- doc/rdoc/files/lib/thin/daemonizing_rb.html
|
73
|
+
- doc/rdoc/files/lib/thin/handler_rb.html
|
74
|
+
- doc/rdoc/files/lib/thin/headers_rb.html
|
75
|
+
- doc/rdoc/files/lib/thin/logging_rb.html
|
76
|
+
- doc/rdoc/files/lib/thin/mime_types_rb.html
|
77
|
+
- doc/rdoc/files/lib/thin/rails_rb.html
|
78
|
+
- doc/rdoc/files/lib/thin/recipes_rb.html
|
79
|
+
- doc/rdoc/files/lib/thin/request_rb.html
|
80
|
+
- doc/rdoc/files/lib/thin/response_rb.html
|
81
|
+
- doc/rdoc/files/lib/thin/server_rb.html
|
82
|
+
- doc/rdoc/files/lib/thin/statuses_rb.html
|
83
|
+
- doc/rdoc/files/lib/thin/version_rb.html
|
84
|
+
- doc/rdoc/files/README.html
|
85
|
+
- doc/rdoc/index.html
|
86
|
+
- doc/rdoc/logo.gif
|
87
|
+
- doc/rdoc/rdoc-style.css
|
37
88
|
- lib/thin
|
38
89
|
- lib/thin/cgi.rb
|
39
90
|
- lib/thin/cluster.rb
|