thin 0.5.3-x86-mswin32-60 → 0.5.4-x86-mswin32-60

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.

Files changed (52) hide show
  1. data/CHANGELOG +8 -0
  2. data/benchmark/previous.rb +14 -0
  3. data/benchmark/simple.rb +3 -38
  4. data/benchmark/utils.rb +51 -0
  5. data/bin/thin +1 -1
  6. data/example/config.ru +9 -2
  7. data/lib/thin.rb +1 -1
  8. data/lib/thin/connection.rb +4 -2
  9. data/lib/thin/response.rb +22 -14
  10. data/lib/thin/version.rb +2 -2
  11. data/lib/thin_parser.so +0 -0
  12. data/spec/response_spec.rb +22 -9
  13. data/spec/server_spec.rb +8 -3
  14. metadata +5 -56
  15. data/doc/rdoc/classes/Process.html +0 -181
  16. data/doc/rdoc/classes/Rack.html +0 -156
  17. data/doc/rdoc/classes/Rack/Adapter.html +0 -155
  18. data/doc/rdoc/classes/Rack/Adapter/Rails.html +0 -289
  19. data/doc/rdoc/classes/Rack/Adapter/Rails/CGIWrapper.html +0 -359
  20. data/doc/rdoc/classes/Rack/Handler.html +0 -155
  21. data/doc/rdoc/classes/Rack/Handler/Thin.html +0 -175
  22. data/doc/rdoc/classes/Thin.html +0 -164
  23. data/doc/rdoc/classes/Thin/Cluster.html +0 -399
  24. data/doc/rdoc/classes/Thin/Connection.html +0 -223
  25. data/doc/rdoc/classes/Thin/Daemonizable.html +0 -260
  26. data/doc/rdoc/classes/Thin/Daemonizable/ClassMethods.html +0 -197
  27. data/doc/rdoc/classes/Thin/Headers.html +0 -238
  28. data/doc/rdoc/classes/Thin/InvalidRequest.html +0 -144
  29. data/doc/rdoc/classes/Thin/Logging.html +0 -201
  30. data/doc/rdoc/classes/Thin/Request.html +0 -231
  31. data/doc/rdoc/classes/Thin/Response.html +0 -271
  32. data/doc/rdoc/classes/Thin/Server.html +0 -295
  33. data/doc/rdoc/classes/Thin/StopServer.html +0 -143
  34. data/doc/rdoc/created.rid +0 -1
  35. data/doc/rdoc/files/README.html +0 -226
  36. data/doc/rdoc/files/bin/thin.html +0 -245
  37. data/doc/rdoc/files/lib/rack/adapter/rails_rb.html +0 -146
  38. data/doc/rdoc/files/lib/rack/handler/thin_rb.html +0 -146
  39. data/doc/rdoc/files/lib/thin/cluster_rb.html +0 -146
  40. data/doc/rdoc/files/lib/thin/connection_rb.html +0 -145
  41. data/doc/rdoc/files/lib/thin/daemonizing_rb.html +0 -146
  42. data/doc/rdoc/files/lib/thin/headers_rb.html +0 -146
  43. data/doc/rdoc/files/lib/thin/logging_rb.html +0 -146
  44. data/doc/rdoc/files/lib/thin/request_rb.html +0 -145
  45. data/doc/rdoc/files/lib/thin/response_rb.html +0 -145
  46. data/doc/rdoc/files/lib/thin/server_rb.html +0 -145
  47. data/doc/rdoc/files/lib/thin/statuses_rb.html +0 -145
  48. data/doc/rdoc/files/lib/thin/version_rb.html +0 -145
  49. data/doc/rdoc/files/lib/thin_rb.html +0 -152
  50. data/doc/rdoc/index.html +0 -10
  51. data/doc/rdoc/logo.gif +0 -0
  52. data/doc/rdoc/rdoc-style.css +0 -55
@@ -1,399 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- thin &raquo; Class: Thin::Cluster
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/">about</a></li>
53
- <li><a href="/thin/download/">download</a></li>
54
- <li><a href="/thin/usage/">usage</a></li>
55
- <li><a href="/thin/doc/">doc</a></li>
56
- <li><a href="http://groups.google.com/group/thin-ruby/">community</a></li>
57
- </ul>
58
- <div id="sidebar">
59
- <h2>Files</h2>
60
- <ul class="list">
61
- <li><a href="../../files/README.html" value="File: README">README</a></li>
62
- <li><a href="../../files/lib/rack/adapter/rails_rb.html" value="File: rails.rb">lib/rack/adapter/rails.rb</a></li>
63
- <li><a href="../../files/lib/rack/handler/thin_rb.html" value="File: thin.rb">lib/rack/handler/thin.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/connection_rb.html" value="File: connection.rb">lib/thin/connection.rb</a></li>
66
- <li><a href="../../files/lib/thin/daemonizing_rb.html" value="File: daemonizing.rb">lib/thin/daemonizing.rb</a></li>
67
- <li><a href="../../files/lib/thin/headers_rb.html" value="File: headers.rb">lib/thin/headers.rb</a></li>
68
- <li><a href="../../files/lib/thin/logging_rb.html" value="File: logging.rb">lib/thin/logging.rb</a></li>
69
- <li><a href="../../files/lib/thin/request_rb.html" value="File: request.rb">lib/thin/request.rb</a></li>
70
- <li><a href="../../files/lib/thin/response_rb.html" value="File: response.rb">lib/thin/response.rb</a></li>
71
- <li><a href="../../files/lib/thin/server_rb.html" value="File: server.rb">lib/thin/server.rb</a></li>
72
- <li><a href="../../files/lib/thin/statuses_rb.html" value="File: statuses.rb">lib/thin/statuses.rb</a></li>
73
- <li><a href="../../files/lib/thin/version_rb.html" value="File: version.rb">lib/thin/version.rb</a></li>
74
- <li><a href="../../files/lib/thin_rb.html" value="File: thin.rb">lib/thin.rb</a></li>
75
- <li><a href="../../files/bin/thin.html" value="File: thin">bin/thin</a></li>
76
- </ul>
77
-
78
- <h2>Classes</h2>
79
- <ul class="list">
80
- <li><a href="../../classes/Rack.html" title="Module: Rack">Rack</a></li>
81
- <li><a href="../../classes/Rack/Adapter.html" title="Module: Rack::Adapter">Rack::Adapter</a></li>
82
- <li><a href="../../classes/Rack/Adapter/Rails.html" title="Class: Rack::Adapter::Rails">Rack::Adapter::Rails</a></li>
83
- <li><a href="../../classes/Rack/Adapter/Rails/CGIWrapper.html" title="Class: Rack::Adapter::Rails::CGIWrapper">Rack::Adapter::Rails::CGIWrapper</a></li>
84
- <li><a href="../../classes/Rack/Handler.html" title="Module: Rack::Handler">Rack::Handler</a></li>
85
- <li><a href="../../classes/Rack/Handler/Thin.html" title="Class: Rack::Handler::Thin">Rack::Handler::Thin</a></li>
86
- <li><a href="../../classes/Thin.html" title="Module: Thin">Thin</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/InvalidRequest.html" title="Class: Thin::InvalidRequest">Thin::InvalidRequest</a></li>
92
- <li><a href="../../classes/Thin/StopServer.html" title="Class: Thin::StopServer">Thin::StopServer</a></li>
93
- <li><a href="../../classes/Thin/Response.html" title="Class: Thin::Response">Thin::Response</a></li>
94
- <li><a href="../../classes/Thin/Headers.html" title="Class: Thin::Headers">Thin::Headers</a></li>
95
- <li><a href="../../classes/Thin/Server.html" title="Class: Thin::Server">Thin::Server</a></li>
96
- <li><a href="../../classes/Thin/Request.html" title="Class: Thin::Request">Thin::Request</a></li>
97
- <li><a href="../../classes/Thin/Connection.html" title="Class: Thin::Connection">Thin::Connection</a></li>
98
- <li><a href="../../classes/Thin/Cluster.html" title="Class: Thin::Cluster">Thin::Cluster</a></li>
99
- <li><a href="../../classes/Process.html" title="Module: Process">Process</a></li>
100
- </ul>
101
- </div>
102
- <div id="container">
103
- <div id="header">
104
- <a href="/thin/" title="Home">
105
- <img id="logo" src="../../logo.gif" />
106
- </a>
107
- <h2 id="tag_line">A fast and very simple Ruby web server</h2>
108
- </div>
109
-
110
- <div id="content">
111
- <h2>Class: Thin::Cluster</h2>
112
-
113
-
114
- <div id="Thin::Cluster" class="page_shade">
115
- <div class="page">
116
- <h3>Class Thin::Cluster &lt; Object</h3>
117
-
118
- <span class="path">(in files
119
- <a href="../../files/lib/thin/cluster_rb.html">lib/thin/cluster.rb</a>
120
- )</span>
121
-
122
- <p>
123
- Control a set of servers.
124
- </p>
125
- <ul>
126
- <li>Generate <a href="Cluster.html#M000058">start</a> and <a
127
- href="Cluster.html#M000060">stop</a> commands and run them.
128
-
129
- </li>
130
- <li>Inject the port number in the pid and log filenames.
131
-
132
- </li>
133
- </ul>
134
- <p>
135
- Servers are started throught the <tt>thin</tt> commandline script.
136
- </p>
137
-
138
-
139
-
140
-
141
- <h4>Includes</h4>
142
- <ul>
143
- <li><a href="Logging.html">Logging</a></li>
144
- </ul>
145
-
146
- <h2 class="ruled">Methods</h2>
147
- <h4 class="ruled">
148
- <span class="method-type" title="Public Class method">Public Class</span>
149
- <strong><a name="M000053" href="#M000053" title="Permalink to Public Class method: new">new(options)</a></strong>
150
- </h4>
151
-
152
- <p>
153
- Create a <a href="Cluster.html#M000053">new</a> cluster of servers launched
154
- using <tt>options</tt>.
155
- </p>
156
-
157
- <div class="sourcecode">
158
- <p class="source-link">[ <a href="javascript:toggleSource('M000053_source')" id="l_M000053_source">show source</a> ]</p>
159
- <div id="M000053_source" class="dyn-source">
160
- <pre>
161
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 20</span>
162
- 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
163
- 21: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:daemonize</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)
164
- 22: <span class="ruby-ivar">@size</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:servers</span>)
165
- 23: <span class="ruby-ivar">@script</span> = <span class="ruby-value str">'thin'</span>
166
- 24: <span class="ruby-keyword kw">end</span>
167
- </pre>
168
- </div>
169
- </div>
170
- <h4 class="ruled">
171
- <span class="method-type" title="Public Instance method">Public Instance</span>
172
- <strong><a name="M000055" href="#M000055" title="Permalink to Public Instance method: address">address()</a></strong>
173
- </h4>
174
-
175
-
176
- <div class="sourcecode">
177
- <p class="source-link">[ <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show source</a> ]</p>
178
- <div id="M000055_source" class="dyn-source">
179
- <pre>
180
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 27</span>
181
- 27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">address</span>; <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:address</span>] <span class="ruby-keyword kw">end</span>
182
- </pre>
183
- </div>
184
- </div>
185
- <h4 class="ruled">
186
- <span class="method-type" title="Public Instance method">Public Instance</span>
187
- <strong><a name="M000054" href="#M000054" title="Permalink to Public Instance method: first_port">first_port()</a></strong>
188
- </h4>
189
-
190
-
191
- <div class="sourcecode">
192
- <p class="source-link">[ <a href="javascript:toggleSource('M000054_source')" id="l_M000054_source">show source</a> ]</p>
193
- <div id="M000054_source" class="dyn-source">
194
- <pre>
195
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 26</span>
196
- 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first_port</span>; <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:port</span>] <span class="ruby-keyword kw">end</span>
197
- </pre>
198
- </div>
199
- </div>
200
- <h4 class="ruled">
201
- <span class="method-type" title="Public Instance method">Public Instance</span>
202
- <strong><a name="M000057" href="#M000057" title="Permalink to Public Instance method: log_file">log_file()</a></strong>
203
- </h4>
204
-
205
-
206
- <div class="sourcecode">
207
- <p class="source-link">[ <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show source</a> ]</p>
208
- <div id="M000057_source" class="dyn-source">
209
- <pre>
210
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 29</span>
211
- 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_file</span>; <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:chdir</span>], <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:log</span>]) <span class="ruby-keyword kw">end</span>
212
- </pre>
213
- </div>
214
- </div>
215
- <h4 class="ruled">
216
- <span class="method-type" title="Public Instance method">Public Instance</span>
217
- <strong><a name="M000063" href="#M000063" title="Permalink to Public Instance method: log_file_for">log_file_for(port)</a></strong>
218
- </h4>
219
-
220
-
221
- <div class="sourcecode">
222
- <p class="source-link">[ <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show source</a> ]</p>
223
- <div id="M000063_source" class="dyn-source">
224
- <pre>
225
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 62</span>
226
- 62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_file_for</span>(<span class="ruby-identifier">port</span>)
227
- 63: <span class="ruby-identifier">include_port_number</span> <span class="ruby-identifier">log_file</span>, <span class="ruby-identifier">port</span>
228
- 64: <span class="ruby-keyword kw">end</span>
229
- </pre>
230
- </div>
231
- </div>
232
- <h4 class="ruled">
233
- <span class="method-type" title="Public Instance method">Public Instance</span>
234
- <strong><a name="M000056" href="#M000056" title="Permalink to Public Instance method: pid_file">pid_file()</a></strong>
235
- </h4>
236
-
237
-
238
- <div class="sourcecode">
239
- <p class="source-link">[ <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show source</a> ]</p>
240
- <div id="M000056_source" class="dyn-source">
241
- <pre>
242
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 28</span>
243
- 28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pid_file</span>; <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:chdir</span>], <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:pid</span>]) <span class="ruby-keyword kw">end</span>
244
- </pre>
245
- </div>
246
- </div>
247
- <h4 class="ruled">
248
- <span class="method-type" title="Public Instance method">Public Instance</span>
249
- <strong><a name="M000064" href="#M000064" title="Permalink to Public Instance method: pid_file_for">pid_file_for(port)</a></strong>
250
- </h4>
251
-
252
-
253
- <div class="sourcecode">
254
- <p class="source-link">[ <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show source</a> ]</p>
255
- <div id="M000064_source" class="dyn-source">
256
- <pre>
257
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 66</span>
258
- 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pid_file_for</span>(<span class="ruby-identifier">port</span>)
259
- 67: <span class="ruby-identifier">include_port_number</span> <span class="ruby-identifier">pid_file</span>, <span class="ruby-identifier">port</span>
260
- 68: <span class="ruby-keyword kw">end</span>
261
- </pre>
262
- </div>
263
- </div>
264
- <h4 class="ruled">
265
- <span class="method-type" title="Public Instance method">Public Instance</span>
266
- <strong><a name="M000065" href="#M000065" title="Permalink to Public Instance method: pid_for">pid_for(port)</a></strong>
267
- </h4>
268
-
269
-
270
- <div class="sourcecode">
271
- <p class="source-link">[ <a href="javascript:toggleSource('M000065_source')" id="l_M000065_source">show source</a> ]</p>
272
- <div id="M000065_source" class="dyn-source">
273
- <pre>
274
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 70</span>
275
- 70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pid_for</span>(<span class="ruby-identifier">port</span>)
276
- 71: <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">pid_file_for</span>(<span class="ruby-identifier">port</span>)).<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">to_i</span>
277
- 72: <span class="ruby-keyword kw">end</span>
278
- </pre>
279
- </div>
280
- </div>
281
- <h4 class="ruled">
282
- <span class="method-type" title="Public Instance method">Public Instance</span>
283
- <strong><a name="M000062" href="#M000062" title="Permalink to Public Instance method: restart">restart()</a></strong>
284
- </h4>
285
-
286
- <p>
287
- Stop and <a href="Cluster.html#M000058">start</a> the servers.
288
- </p>
289
-
290
- <div class="sourcecode">
291
- <p class="source-link">[ <a href="javascript:toggleSource('M000062_source')" id="l_M000062_source">show source</a> ]</p>
292
- <div id="M000062_source" class="dyn-source">
293
- <pre>
294
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 56</span>
295
- 56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restart</span>
296
- 57: <span class="ruby-identifier">stop</span>
297
- 58: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.1</span> <span class="ruby-comment cmt"># Let's breath a bit shall we ?</span>
298
- 59: <span class="ruby-identifier">start</span>
299
- 60: <span class="ruby-keyword kw">end</span>
300
- </pre>
301
- </div>
302
- </div>
303
- <h4 class="ruled">
304
- <span class="method-type" title="Public Instance method">Public Instance</span>
305
- <strong><a name="M000058" href="#M000058" title="Permalink to Public Instance method: start">start()</a></strong>
306
- </h4>
307
-
308
- <p>
309
- Start the servers
310
- </p>
311
-
312
- <div class="sourcecode">
313
- <p class="source-link">[ <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show source</a> ]</p>
314
- <div id="M000058_source" class="dyn-source">
315
- <pre>
316
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 32</span>
317
- 32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
318
- 33: <span class="ruby-identifier">with_each_server</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">port</span><span class="ruby-operator">|</span> <span class="ruby-identifier">start_on_port</span> <span class="ruby-identifier">port</span> }
319
- 34: <span class="ruby-keyword kw">end</span>
320
- </pre>
321
- </div>
322
- </div>
323
- <h4 class="ruled">
324
- <span class="method-type" title="Public Instance method">Public Instance</span>
325
- <strong><a name="M000059" href="#M000059" title="Permalink to Public Instance method: start_on_port">start_on_port(port)</a></strong>
326
- </h4>
327
-
328
- <p>
329
- Start the server on a single port
330
- </p>
331
-
332
- <div class="sourcecode">
333
- <p class="source-link">[ <a href="javascript:toggleSource('M000059_source')" id="l_M000059_source">show source</a> ]</p>
334
- <div id="M000059_source" class="dyn-source">
335
- <pre>
336
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 37</span>
337
- 37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_on_port</span>(<span class="ruby-identifier">port</span>)
338
- 38: <span class="ruby-identifier">log</span> <span class="ruby-node">&quot;Starting #{address}:#{port} ... &quot;</span>
339
- 39:
340
- 40: <span class="ruby-identifier">run</span> <span class="ruby-identifier">:start</span>, <span class="ruby-ivar">@options</span>, <span class="ruby-identifier">port</span>
341
- 41: <span class="ruby-keyword kw">end</span>
342
- </pre>
343
- </div>
344
- </div>
345
- <h4 class="ruled">
346
- <span class="method-type" title="Public Instance method">Public Instance</span>
347
- <strong><a name="M000060" href="#M000060" title="Permalink to Public Instance method: stop">stop()</a></strong>
348
- </h4>
349
-
350
- <p>
351
- Stop the servers
352
- </p>
353
-
354
- <div class="sourcecode">
355
- <p class="source-link">[ <a href="javascript:toggleSource('M000060_source')" id="l_M000060_source">show source</a> ]</p>
356
- <div id="M000060_source" class="dyn-source">
357
- <pre>
358
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 44</span>
359
- 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
360
- 45: <span class="ruby-identifier">with_each_server</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">port</span><span class="ruby-operator">|</span> <span class="ruby-identifier">stop_on_port</span> <span class="ruby-identifier">port</span> }
361
- 46: <span class="ruby-keyword kw">end</span>
362
- </pre>
363
- </div>
364
- </div>
365
- <h4 class="ruled">
366
- <span class="method-type" title="Public Instance method">Public Instance</span>
367
- <strong><a name="M000061" href="#M000061" title="Permalink to Public Instance method: stop_on_port">stop_on_port(port)</a></strong>
368
- </h4>
369
-
370
- <p>
371
- Stop the server running on <tt>port</tt>
372
- </p>
373
-
374
- <div class="sourcecode">
375
- <p class="source-link">[ <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show source</a> ]</p>
376
- <div id="M000061_source" class="dyn-source">
377
- <pre>
378
- <span class="ruby-comment cmt"># File lib/thin/cluster.rb, line 49</span>
379
- 49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop_on_port</span>(<span class="ruby-identifier">port</span>)
380
- 50: <span class="ruby-identifier">log</span> <span class="ruby-node">&quot;Stopping #{address}:#{port} ... &quot;</span>
381
- 51:
382
- 52: <span class="ruby-identifier">run</span> <span class="ruby-identifier">:stop</span>, <span class="ruby-ivar">@options</span>, <span class="ruby-identifier">port</span>
383
- 53: <span class="ruby-keyword kw">end</span>
384
- </pre>
385
- </div>
386
- </div>
387
-
388
- </div>
389
- </div>
390
-
391
-
392
- </div>
393
- </div>
394
- <div id="footer">
395
- <hr />
396
- &copy; <a href="http://macournoyer.com">Marc-Andr&eacute; Cournoyer</a>
397
- </div>
398
- </body>
399
- </html>
@@ -1,223 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- thin &raquo; Class: Thin::Connection
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/">about</a></li>
53
- <li><a href="/thin/download/">download</a></li>
54
- <li><a href="/thin/usage/">usage</a></li>
55
- <li><a href="/thin/doc/">doc</a></li>
56
- <li><a href="http://groups.google.com/group/thin-ruby/">community</a></li>
57
- </ul>
58
- <div id="sidebar">
59
- <h2>Files</h2>
60
- <ul class="list">
61
- <li><a href="../../files/README.html" value="File: README">README</a></li>
62
- <li><a href="../../files/lib/rack/adapter/rails_rb.html" value="File: rails.rb">lib/rack/adapter/rails.rb</a></li>
63
- <li><a href="../../files/lib/rack/handler/thin_rb.html" value="File: thin.rb">lib/rack/handler/thin.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/connection_rb.html" value="File: connection.rb">lib/thin/connection.rb</a></li>
66
- <li><a href="../../files/lib/thin/daemonizing_rb.html" value="File: daemonizing.rb">lib/thin/daemonizing.rb</a></li>
67
- <li><a href="../../files/lib/thin/headers_rb.html" value="File: headers.rb">lib/thin/headers.rb</a></li>
68
- <li><a href="../../files/lib/thin/logging_rb.html" value="File: logging.rb">lib/thin/logging.rb</a></li>
69
- <li><a href="../../files/lib/thin/request_rb.html" value="File: request.rb">lib/thin/request.rb</a></li>
70
- <li><a href="../../files/lib/thin/response_rb.html" value="File: response.rb">lib/thin/response.rb</a></li>
71
- <li><a href="../../files/lib/thin/server_rb.html" value="File: server.rb">lib/thin/server.rb</a></li>
72
- <li><a href="../../files/lib/thin/statuses_rb.html" value="File: statuses.rb">lib/thin/statuses.rb</a></li>
73
- <li><a href="../../files/lib/thin/version_rb.html" value="File: version.rb">lib/thin/version.rb</a></li>
74
- <li><a href="../../files/lib/thin_rb.html" value="File: thin.rb">lib/thin.rb</a></li>
75
- <li><a href="../../files/bin/thin.html" value="File: thin">bin/thin</a></li>
76
- </ul>
77
-
78
- <h2>Classes</h2>
79
- <ul class="list">
80
- <li><a href="../../classes/Rack.html" title="Module: Rack">Rack</a></li>
81
- <li><a href="../../classes/Rack/Adapter.html" title="Module: Rack::Adapter">Rack::Adapter</a></li>
82
- <li><a href="../../classes/Rack/Adapter/Rails.html" title="Class: Rack::Adapter::Rails">Rack::Adapter::Rails</a></li>
83
- <li><a href="../../classes/Rack/Adapter/Rails/CGIWrapper.html" title="Class: Rack::Adapter::Rails::CGIWrapper">Rack::Adapter::Rails::CGIWrapper</a></li>
84
- <li><a href="../../classes/Rack/Handler.html" title="Module: Rack::Handler">Rack::Handler</a></li>
85
- <li><a href="../../classes/Rack/Handler/Thin.html" title="Class: Rack::Handler::Thin">Rack::Handler::Thin</a></li>
86
- <li><a href="../../classes/Thin.html" title="Module: Thin">Thin</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/InvalidRequest.html" title="Class: Thin::InvalidRequest">Thin::InvalidRequest</a></li>
92
- <li><a href="../../classes/Thin/StopServer.html" title="Class: Thin::StopServer">Thin::StopServer</a></li>
93
- <li><a href="../../classes/Thin/Response.html" title="Class: Thin::Response">Thin::Response</a></li>
94
- <li><a href="../../classes/Thin/Headers.html" title="Class: Thin::Headers">Thin::Headers</a></li>
95
- <li><a href="../../classes/Thin/Server.html" title="Class: Thin::Server">Thin::Server</a></li>
96
- <li><a href="../../classes/Thin/Request.html" title="Class: Thin::Request">Thin::Request</a></li>
97
- <li><a href="../../classes/Thin/Connection.html" title="Class: Thin::Connection">Thin::Connection</a></li>
98
- <li><a href="../../classes/Thin/Cluster.html" title="Class: Thin::Cluster">Thin::Cluster</a></li>
99
- <li><a href="../../classes/Process.html" title="Module: Process">Process</a></li>
100
- </ul>
101
- </div>
102
- <div id="container">
103
- <div id="header">
104
- <a href="/thin/" title="Home">
105
- <img id="logo" src="../../logo.gif" />
106
- </a>
107
- <h2 id="tag_line">A fast and very simple Ruby web server</h2>
108
- </div>
109
-
110
- <div id="content">
111
- <h2>Class: Thin::Connection</h2>
112
-
113
-
114
- <div id="Thin::Connection" class="page_shade">
115
- <div class="page">
116
- <h3>Class Thin::Connection &lt; EventMachine::Connection</h3>
117
-
118
- <span class="path">(in files
119
- <a href="../../files/lib/thin/connection_rb.html">lib/thin/connection.rb</a>
120
- )</span>
121
-
122
- <p>
123
- A request sent by the client to the server.
124
- </p>
125
-
126
-
127
-
128
-
129
- <h4>Includes</h4>
130
- <ul>
131
- <li><a href="Logging.html">Logging</a></li>
132
- </ul>
133
-
134
- <h2 class="ruled">Methods</h2>
135
- <h4 class="ruled">
136
- <span class="method-type" title="Public Instance method">Public Instance</span>
137
- <strong><a name="M000050" href="#M000050" title="Permalink to Public Instance method: post_init">post_init()</a></strong>
138
- </h4>
139
-
140
-
141
- <div class="sourcecode">
142
- <p class="source-link">[ <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show source</a> ]</p>
143
- <div id="M000050_source" class="dyn-source">
144
- <pre>
145
- <span class="ruby-comment cmt"># File lib/thin/connection.rb, line 9</span>
146
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_init</span>
147
- 10: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>
148
- 11: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
149
- 12: <span class="ruby-keyword kw">end</span>
150
- </pre>
151
- </div>
152
- </div>
153
- <h4 class="ruled">
154
- <span class="method-type" title="Public Instance method">Public Instance</span>
155
- <strong><a name="M000052" href="#M000052" title="Permalink to Public Instance method: process">process()</a></strong>
156
- </h4>
157
-
158
-
159
- <div class="sourcecode">
160
- <p class="source-link">[ <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show source</a> ]</p>
161
- <div id="M000052_source" class="dyn-source">
162
- <pre>
163
- <span class="ruby-comment cmt"># File lib/thin/connection.rb, line 23</span>
164
- 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>
165
- 24: <span class="ruby-identifier">env</span> = <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">env</span>
166
- 25:
167
- 26: <span class="ruby-comment cmt"># Add client info to the request env</span>
168
- 27: <span class="ruby-identifier">env</span>[<span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">REMOTE_ADDR</span>] = <span class="ruby-identifier">env</span>[<span class="ruby-constant">Request</span><span class="ruby-operator">::</span><span class="ruby-constant">FORWARDED_FOR</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">unpack_sockaddr_in</span>(<span class="ruby-identifier">get_peername</span>)[<span class="ruby-value">1</span>]
169
- 28:
170
- 29: <span class="ruby-comment cmt"># Process the request</span>
171
- 30: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">status</span>, <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">headers</span>, <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
172
- 31:
173
- 32: <span class="ruby-comment cmt"># Send the response</span>
174
- 33: <span class="ruby-identifier">trace</span> { <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">to_s</span> }
175
- 34: <span class="ruby-identifier">send_data</span> <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">to_s</span>
176
- 35:
177
- 36: <span class="ruby-identifier">close_connection_after_writing</span>
178
- 37:
179
- 38: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
180
- 39: <span class="ruby-identifier">log</span> <span class="ruby-node">&quot;Unexpected error while processing request: #{e.message}&quot;</span>
181
- 40: <span class="ruby-identifier">log_error</span> <span class="ruby-identifier">e</span>
182
- 41: <span class="ruby-identifier">close_connection</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
183
- 42: <span class="ruby-keyword kw">ensure</span>
184
- 43: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
185
- 44: <span class="ruby-keyword kw">end</span>
186
- </pre>
187
- </div>
188
- </div>
189
- <h4 class="ruled">
190
- <span class="method-type" title="Public Instance method">Public Instance</span>
191
- <strong><a name="M000051" href="#M000051" title="Permalink to Public Instance method: receive_data">receive_data(data)</a></strong>
192
- </h4>
193
-
194
-
195
- <div class="sourcecode">
196
- <p class="source-link">[ <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show source</a> ]</p>
197
- <div id="M000051_source" class="dyn-source">
198
- <pre>
199
- <span class="ruby-comment cmt"># File lib/thin/connection.rb, line 14</span>
200
- 14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">receive_data</span>(<span class="ruby-identifier">data</span>)
201
- 15: <span class="ruby-identifier">trace</span> { <span class="ruby-identifier">data</span> }
202
- 16: <span class="ruby-identifier">process</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>)
203
- 17: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidRequest</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
204
- 18: <span class="ruby-identifier">log</span> <span class="ruby-value str">&quot;Invalid request&quot;</span>
205
- 19: <span class="ruby-identifier">log_error</span> <span class="ruby-identifier">e</span>
206
- 20: <span class="ruby-identifier">close_connection</span>
207
- 21: <span class="ruby-keyword kw">end</span>
208
- </pre>
209
- </div>
210
- </div>
211
-
212
- </div>
213
- </div>
214
-
215
-
216
- </div>
217
- </div>
218
- <div id="footer">
219
- <hr />
220
- &copy; <a href="http://macournoyer.com">Marc-Andr&eacute; Cournoyer</a>
221
- </div>
222
- </body>
223
- </html>