thin 1.8.0 → 2.0.0.pre
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/.gitignore +9 -0
- data/CHANGELOG +29 -107
- data/Gemfile +8 -0
- data/README.md +44 -78
- data/Rakefile +28 -18
- data/bin/thin +4 -4
- data/examples/async.ru +21 -0
- data/examples/thin.conf.rb +39 -0
- data/lib/thin.rb +2 -44
- data/lib/thin/async.rb +108 -0
- data/lib/thin/backends/prefork.rb +44 -0
- data/lib/thin/backends/single_process.rb +28 -0
- data/lib/thin/chunked_body.rb +28 -0
- data/lib/thin/configurator.rb +118 -0
- data/lib/thin/connection.rb +246 -172
- data/lib/thin/listener.rb +114 -0
- data/lib/thin/request.rb +94 -76
- data/lib/thin/response.rb +112 -45
- data/lib/thin/runner.rb +134 -197
- data/lib/thin/server.rb +203 -252
- data/lib/thin/system.rb +49 -0
- data/lib/thin/version.rb +11 -26
- data/man/index.txt +3 -0
- data/man/thin-conf.5.ronn +121 -0
- data/man/thin.1.ronn +105 -0
- data/site/.gitignore +2 -0
- data/site/README.md +21 -0
- data/site/Rakefile +20 -0
- data/site/config.ru +4 -0
- data/site/public/images/grid.png +0 -0
- data/site/public/javascripts/dd_belatedpng.js +13 -0
- data/site/public/javascripts/modernizr-1.6.min.js +30 -0
- data/site/public/man/thin-conf.5.html +220 -0
- data/site/public/man/thin.1.html +177 -0
- data/site/site/assets/javascripts/main.coffee +2 -0
- data/site/site/assets/stylesheets/_config.scss +55 -0
- data/site/site/assets/stylesheets/main.scss +24 -0
- data/site/site/helpers.rb +17 -0
- data/site/site/layouts/base.erb +55 -0
- data/site/site/layouts/default.erb +17 -0
- data/site/site/pages/about.md +5 -0
- data/site/site/pages/index.erb +10 -0
- data/site/site/partials/.gitkeep +0 -0
- data/test/fixtures/big.txt +1 -0
- data/test/fixtures/small.txt +1 -0
- data/test/fixtures/thin.conf.rb +15 -0
- data/test/integration/async_test.rb +35 -0
- data/test/integration/big_request_test.rb +30 -0
- data/test/integration/config.ru +57 -0
- data/test/integration/daemonize_test.rb +26 -0
- data/test/integration/env_test.rb +44 -0
- data/test/integration/error_test.rb +37 -0
- data/test/integration/file_sending_test.rb +24 -0
- data/test/integration/keep_alive_test.rb +35 -0
- data/test/integration/robustness_test.rb +37 -0
- data/test/integration/single_process_test.rb +15 -0
- data/test/integration/socket_family_test.rb +38 -0
- data/test/integration/worker_test.rb +22 -0
- data/test/test_helper.rb +195 -0
- data/test/unit/configurator_test.rb +43 -0
- data/test/unit/connection_test.rb +94 -0
- data/test/unit/listener_test.rb +74 -0
- data/test/unit/request_test.rb +74 -0
- data/test/unit/response_test.rb +90 -0
- data/test/unit/server_test.rb +29 -0
- data/test/unit/system_test.rb +17 -0
- data/thin.gemspec +26 -0
- data/v2.todo +21 -0
- metadata +138 -93
- checksums.yaml +0 -7
- data/example/adapter.rb +0 -32
- data/example/async_app.ru +0 -126
- data/example/async_chat.ru +0 -247
- data/example/async_tailer.ru +0 -100
- data/example/config.ru +0 -22
- data/example/monit_sockets +0 -20
- data/example/monit_unixsock +0 -20
- data/example/myapp.rb +0 -1
- data/example/ramaze.ru +0 -12
- data/example/thin.god +0 -80
- data/example/thin_solaris_smf.erb +0 -36
- data/example/thin_solaris_smf.readme.txt +0 -150
- data/example/vlad.rake +0 -72
- data/ext/thin_parser/common.rl +0 -59
- data/ext/thin_parser/ext_help.h +0 -14
- data/ext/thin_parser/extconf.rb +0 -6
- data/ext/thin_parser/parser.c +0 -1447
- data/ext/thin_parser/parser.h +0 -49
- data/ext/thin_parser/parser.rl +0 -152
- data/ext/thin_parser/thin.c +0 -435
- data/lib/rack/adapter/loader.rb +0 -75
- data/lib/rack/adapter/rails.rb +0 -178
- data/lib/rack/handler/thin.rb +0 -38
- data/lib/thin/backends/base.rb +0 -169
- data/lib/thin/backends/swiftiply_client.rb +0 -56
- data/lib/thin/backends/tcp_server.rb +0 -34
- data/lib/thin/backends/unix_server.rb +0 -56
- data/lib/thin/command.rb +0 -53
- data/lib/thin/controllers/cluster.rb +0 -178
- data/lib/thin/controllers/controller.rb +0 -189
- data/lib/thin/controllers/service.rb +0 -76
- data/lib/thin/controllers/service.sh.erb +0 -39
- data/lib/thin/daemonizing.rb +0 -199
- data/lib/thin/headers.rb +0 -40
- data/lib/thin/logging.rb +0 -174
- data/lib/thin/stats.html.erb +0 -216
- data/lib/thin/stats.rb +0 -52
- data/lib/thin/statuses.rb +0 -48
data/lib/thin/stats.html.erb
DELETED
@@ -1,216 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
# Taken from Rack::ShowException
|
3
|
-
# adapted from Django <djangoproject.com>
|
4
|
-
# Copyright (c) 2005, the Lawrence Journal-World
|
5
|
-
# Used under the modified BSD license:
|
6
|
-
# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
|
7
|
-
%>
|
8
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
9
|
-
<html lang="en">
|
10
|
-
<head>
|
11
|
-
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
12
|
-
<meta name="robots" content="NONE,NOARCHIVE" />
|
13
|
-
<title>Thin Stats</title>
|
14
|
-
<style type="text/css">
|
15
|
-
html * { padding:0; margin:0; }
|
16
|
-
body * { padding:10px 20px; }
|
17
|
-
body * * { padding:0; }
|
18
|
-
body { font:small sans-serif; }
|
19
|
-
body>div { border-bottom:1px solid #ddd; }
|
20
|
-
h1 { font-weight:normal; }
|
21
|
-
h2 { margin-bottom:.8em; }
|
22
|
-
h2 span { font-size:80%; color:#666; font-weight:normal; }
|
23
|
-
h3 { margin:1em 0 .5em 0; }
|
24
|
-
h4 { margin:0 0 .5em 0; font-weight: normal; }
|
25
|
-
table {
|
26
|
-
border:1px solid #ccc; border-collapse: collapse; background:white; }
|
27
|
-
tbody td, tbody th { vertical-align:top; padding:2px 3px; }
|
28
|
-
thead th {
|
29
|
-
padding:1px 6px 1px 3px; background:#fefefe; text-align:left;
|
30
|
-
font-weight:normal; font-size:11px; border:1px solid #ddd; }
|
31
|
-
tbody th { text-align:right; color:#666; padding-right:.5em; }
|
32
|
-
table.vars { margin:5px 0 2px 40px; }
|
33
|
-
table.vars td, table.req td { font-family:monospace; }
|
34
|
-
table td.code { width:100%;}
|
35
|
-
table td.code div { overflow:hidden; }
|
36
|
-
table.source th { color:#666; }
|
37
|
-
table.source td {
|
38
|
-
font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
|
39
|
-
ul.traceback { list-style-type:none; }
|
40
|
-
ul.traceback li.frame { margin-bottom:1em; }
|
41
|
-
div.context { margin: 10px 0; }
|
42
|
-
div.context ol {
|
43
|
-
padding-left:30px; margin:0 10px; list-style-position: inside; }
|
44
|
-
div.context ol li {
|
45
|
-
font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
|
46
|
-
div.context ol.context-line li { color:black; background-color:#ccc; }
|
47
|
-
div.context ol.context-line li span { float: right; }
|
48
|
-
div.commands { margin-left: 40px; }
|
49
|
-
div.commands a { color:black; text-decoration:none; }
|
50
|
-
#summary { background: #ffc; }
|
51
|
-
#summary h2 { font-weight: normal; color: #666; }
|
52
|
-
#summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; }
|
53
|
-
#summary ul#quicklinks li { float: left; padding: 0 1em; }
|
54
|
-
#summary ul#quicklinks>li+li { border-left: 1px #666 solid; }
|
55
|
-
#explanation { background:#eee; }
|
56
|
-
#template, #template-not-exist { background:#f6f6f6; }
|
57
|
-
#template-not-exist ul { margin: 0 0 0 20px; }
|
58
|
-
#traceback { background:#eee; }
|
59
|
-
#summary table { border:none; background:transparent; }
|
60
|
-
#requests { background:#f6f6f6; padding-left:120px; }
|
61
|
-
#requests h2, #requests h3 { position:relative; margin-left:-100px; }
|
62
|
-
#requests h3 { margin-bottom:-1em; }
|
63
|
-
.error { background: #ffc; }
|
64
|
-
.specific { color:#cc3300; font-weight:bold; }
|
65
|
-
</style>
|
66
|
-
</head>
|
67
|
-
<body>
|
68
|
-
|
69
|
-
<div id="summary">
|
70
|
-
<h1>Server stats</h1>
|
71
|
-
<h2><%= Thin::SERVER %></h2>
|
72
|
-
<table>
|
73
|
-
<tr>
|
74
|
-
<th>Uptime</th>
|
75
|
-
<td><%= Time.now - @start_time %> sec</td>
|
76
|
-
</tr>
|
77
|
-
<tr>
|
78
|
-
<th>PID</th>
|
79
|
-
<td><%=h Process.pid %></td>
|
80
|
-
</tr>
|
81
|
-
</table>
|
82
|
-
|
83
|
-
<% if @last_request %>
|
84
|
-
<h3>Jump to:</h3>
|
85
|
-
<ul id="quicklinks">
|
86
|
-
<li><a href="#get-info">GET</a></li>
|
87
|
-
<li><a href="#post-info">POST</a></li>
|
88
|
-
<li><a href="#cookie-info">Cookies</a></li>
|
89
|
-
<li><a href="#env-info">ENV</a></li>
|
90
|
-
</ul>
|
91
|
-
<% end %>
|
92
|
-
</div>
|
93
|
-
|
94
|
-
<div id="stats">
|
95
|
-
<h2>Requests</h2>
|
96
|
-
<h3>Stats</h3>
|
97
|
-
<table class="req">
|
98
|
-
<tr>
|
99
|
-
<td>Requests</td>
|
100
|
-
<td><%= @requests %></td>
|
101
|
-
</tr>
|
102
|
-
<tr>
|
103
|
-
<td>Finished</td>
|
104
|
-
<td><%= @requests_finished %></td>
|
105
|
-
</tr>
|
106
|
-
<tr>
|
107
|
-
<td>Errors</td>
|
108
|
-
<td><%= @requests - @requests_finished %></td>
|
109
|
-
</tr>
|
110
|
-
<tr>
|
111
|
-
<td>Last request</td>
|
112
|
-
<td><%= @last_request_time %> sec</td>
|
113
|
-
</tr>
|
114
|
-
</table>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<% if @last_request %>
|
118
|
-
<div id="requestinfo">
|
119
|
-
<h2>Last Request information</h2>
|
120
|
-
|
121
|
-
<h3 id="get-info">GET</h3>
|
122
|
-
<% unless @last_request.GET.empty? %>
|
123
|
-
<table class="req">
|
124
|
-
<thead>
|
125
|
-
<tr>
|
126
|
-
<th>Variable</th>
|
127
|
-
<th>Value</th>
|
128
|
-
</tr>
|
129
|
-
</thead>
|
130
|
-
<tbody>
|
131
|
-
<% @last_request.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
132
|
-
<tr>
|
133
|
-
<td><%=h key %></td>
|
134
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
135
|
-
</tr>
|
136
|
-
<% } %>
|
137
|
-
</tbody>
|
138
|
-
</table>
|
139
|
-
<% else %>
|
140
|
-
<p>No GET data.</p>
|
141
|
-
<% end %>
|
142
|
-
|
143
|
-
<h3 id="post-info">POST</h3>
|
144
|
-
<% unless @last_request.POST.empty? %>
|
145
|
-
<table class="req">
|
146
|
-
<thead>
|
147
|
-
<tr>
|
148
|
-
<th>Variable</th>
|
149
|
-
<th>Value</th>
|
150
|
-
</tr>
|
151
|
-
</thead>
|
152
|
-
<tbody>
|
153
|
-
<% @last_request.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
154
|
-
<tr>
|
155
|
-
<td><%=h key %></td>
|
156
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
157
|
-
</tr>
|
158
|
-
<% } %>
|
159
|
-
</tbody>
|
160
|
-
</table>
|
161
|
-
<% else %>
|
162
|
-
<p>No POST data.</p>
|
163
|
-
<% end %>
|
164
|
-
|
165
|
-
|
166
|
-
<h3 id="cookie-info">COOKIES</h3>
|
167
|
-
<% unless @last_request.cookies.empty? %>
|
168
|
-
<table class="req">
|
169
|
-
<thead>
|
170
|
-
<tr>
|
171
|
-
<th>Variable</th>
|
172
|
-
<th>Value</th>
|
173
|
-
</tr>
|
174
|
-
</thead>
|
175
|
-
<tbody>
|
176
|
-
<% @last_request.cookies.each { |key, val| %>
|
177
|
-
<tr>
|
178
|
-
<td><%=h key %></td>
|
179
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
180
|
-
</tr>
|
181
|
-
<% } %>
|
182
|
-
</tbody>
|
183
|
-
</table>
|
184
|
-
<% else %>
|
185
|
-
<p>No cookie data.</p>
|
186
|
-
<% end %>
|
187
|
-
|
188
|
-
<h3 id="env-info">Rack ENV</h3>
|
189
|
-
<table class="req">
|
190
|
-
<thead>
|
191
|
-
<tr>
|
192
|
-
<th>Variable</th>
|
193
|
-
<th>Value</th>
|
194
|
-
</tr>
|
195
|
-
</thead>
|
196
|
-
<tbody>
|
197
|
-
<% @last_request.env.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
198
|
-
<tr>
|
199
|
-
<td><%=h key %></td>
|
200
|
-
<td class="code"><div><%=h val %></div></td>
|
201
|
-
</tr>
|
202
|
-
<% } %>
|
203
|
-
</tbody>
|
204
|
-
</table>
|
205
|
-
|
206
|
-
</div>
|
207
|
-
<% end %>
|
208
|
-
|
209
|
-
<div id="explanation">
|
210
|
-
<p>
|
211
|
-
You're seeing this page because you use <code>Thin::Stats</code>.
|
212
|
-
</p>
|
213
|
-
</div>
|
214
|
-
|
215
|
-
</body>
|
216
|
-
</html>
|
data/lib/thin/stats.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
|
-
module Thin
|
4
|
-
module Stats
|
5
|
-
# Rack adapter to log stats about a Rack application.
|
6
|
-
class Adapter
|
7
|
-
include ERB::Util
|
8
|
-
|
9
|
-
def initialize(app, path='/stats')
|
10
|
-
@app = app
|
11
|
-
@path = path
|
12
|
-
|
13
|
-
@template = ERB.new(File.read(File.dirname(__FILE__) + '/stats.html.erb'))
|
14
|
-
|
15
|
-
@requests = 0
|
16
|
-
@requests_finished = 0
|
17
|
-
@start_time = Time.now
|
18
|
-
end
|
19
|
-
|
20
|
-
def call(env)
|
21
|
-
if env['PATH_INFO'].index(@path) == 0
|
22
|
-
serve(env)
|
23
|
-
else
|
24
|
-
log(env) { @app.call(env) }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def log(env)
|
29
|
-
@requests += 1
|
30
|
-
@last_request = Rack::Request.new(env)
|
31
|
-
request_started_at = Time.now
|
32
|
-
|
33
|
-
response = yield
|
34
|
-
|
35
|
-
@requests_finished += 1
|
36
|
-
@last_request_time = Time.now - request_started_at
|
37
|
-
|
38
|
-
response
|
39
|
-
end
|
40
|
-
|
41
|
-
def serve(env)
|
42
|
-
body = @template.result(binding)
|
43
|
-
|
44
|
-
[
|
45
|
-
200,
|
46
|
-
{ 'Content-Type' => 'text/html' },
|
47
|
-
[body]
|
48
|
-
]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/lib/thin/statuses.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module Thin
|
2
|
-
# Every standard HTTP code mapped to the appropriate message.
|
3
|
-
# Stolent from Mongrel.
|
4
|
-
HTTP_STATUS_CODES = {
|
5
|
-
100 => 'Continue',
|
6
|
-
101 => 'Switching Protocols',
|
7
|
-
200 => 'OK',
|
8
|
-
201 => 'Created',
|
9
|
-
202 => 'Accepted',
|
10
|
-
203 => 'Non-Authoritative Information',
|
11
|
-
204 => 'No Content',
|
12
|
-
205 => 'Reset Content',
|
13
|
-
206 => 'Partial Content',
|
14
|
-
300 => 'Multiple Choices',
|
15
|
-
301 => 'Moved Permanently',
|
16
|
-
302 => 'Moved Temporarily',
|
17
|
-
303 => 'See Other',
|
18
|
-
304 => 'Not Modified',
|
19
|
-
305 => 'Use Proxy',
|
20
|
-
400 => 'Bad Request',
|
21
|
-
401 => 'Unauthorized',
|
22
|
-
402 => 'Payment Required',
|
23
|
-
403 => 'Forbidden',
|
24
|
-
404 => 'Not Found',
|
25
|
-
405 => 'Method Not Allowed',
|
26
|
-
406 => 'Not Acceptable',
|
27
|
-
407 => 'Proxy Authentication Required',
|
28
|
-
408 => 'Request Time-out',
|
29
|
-
409 => 'Conflict',
|
30
|
-
410 => 'Gone',
|
31
|
-
411 => 'Length Required',
|
32
|
-
412 => 'Precondition Failed',
|
33
|
-
413 => 'Request Entity Too Large',
|
34
|
-
414 => 'Request-URI Too Large',
|
35
|
-
415 => 'Unsupported Media Type',
|
36
|
-
422 => 'Unprocessable Entity',
|
37
|
-
428 => 'Precondition Required',
|
38
|
-
429 => 'Too Many Requests',
|
39
|
-
431 => 'Request Header Fields Too Large',
|
40
|
-
500 => 'Internal Server Error',
|
41
|
-
501 => 'Not Implemented',
|
42
|
-
502 => 'Bad Gateway',
|
43
|
-
503 => 'Service Unavailable',
|
44
|
-
504 => 'Gateway Time-out',
|
45
|
-
505 => 'HTTP Version not supported',
|
46
|
-
511 => 'Network Authentication Required'
|
47
|
-
}
|
48
|
-
end
|