mongrel 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +28 -1
- data/Rakefile +2 -2
- data/bin/mongrel_rails +102 -65
- data/bin/mongrel_rails_service +16 -7
- data/bin/mongrel_rails_svc +184 -87
- data/doc/rdoc/classes/Mongrel.html +1 -0
- data/doc/rdoc/classes/Mongrel/Const.html +3 -3
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000028.html → M000014.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000029.html → M000015.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000015.html → M000001.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000016.html → M000002.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000017.html → M000003.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000018.html → M000004.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000019.html → M000005.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000020.html → M000006.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000021.html → M000007.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000041.html → M000029.html} +25 -25
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000034.html → M000016.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000035.html → M000017.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000036.html → M000018.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000037.html → M000019.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000038.html → M000020.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000039.html → M000021.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000040.html → M000022.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpServer.html +34 -35
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +36 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000023.html → M000009.html} +43 -43
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000024.html → M000010.html} +31 -31
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000025.html → M000011.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000026.html → M000012.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000013.html +23 -0
- data/doc/rdoc/classes/{FactoryError.html → Mongrel/TimeoutWorker.html} +7 -34
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +63 -20
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000023.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000024.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000030.html → M000025.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000031.html → M000026.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000032.html → M000027.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000033.html → M000028.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +35 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +4 -1
- data/doc/rdoc/fr_class_index.html +1 -2
- data/doc/rdoc/fr_file_index.html +0 -1
- data/doc/rdoc/fr_method_index.html +29 -41
- data/lib/mongrel.rb +37 -9
- data/lib/mongrel/command.rb +13 -34
- data/lib/mongrel/plugins.rb +156 -0
- data/lib/mongrel/rails.rb +70 -0
- data/test/plugins/commands/test1.rb +19 -0
- data/test/test_plugins.rb +45 -0
- data/test/test_uriclassifier.rb +5 -1
- metadata +38 -49
- data/doc/rdoc/classes/FactoryError.src/M000001.html +0 -23
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000022.html +0 -33
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000027.html +0 -19
- data/doc/rdoc/classes/PluginFactory.html +0 -409
- data/doc/rdoc/classes/PluginFactory.src/M000002.html +0 -18
- data/doc/rdoc/classes/PluginFactory.src/M000003.html +0 -18
- data/doc/rdoc/classes/PluginFactory.src/M000004.html +0 -22
- data/doc/rdoc/classes/PluginFactory.src/M000005.html +0 -22
- data/doc/rdoc/classes/PluginFactory.src/M000006.html +0 -33
- data/doc/rdoc/classes/PluginFactory.src/M000007.html +0 -32
- data/doc/rdoc/classes/PluginFactory.src/M000008.html +0 -18
- data/doc/rdoc/classes/PluginFactory.src/M000009.html +0 -24
- data/doc/rdoc/classes/PluginFactory.src/M000010.html +0 -40
- data/doc/rdoc/classes/PluginFactory.src/M000011.html +0 -39
- data/doc/rdoc/classes/PluginFactory.src/M000012.html +0 -24
- data/doc/rdoc/classes/PluginFactory.src/M000013.html +0 -70
- data/doc/rdoc/classes/PluginFactory.src/M000014.html +0 -34
- data/doc/rdoc/files/lib/pluginfactory_rb.html +0 -132
- data/lib/pluginfactory.rb +0 -384
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 259</span>
|
|
14
|
+
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
|
|
15
|
+
260: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
16
|
+
261: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
262: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
|
18
|
+
263: <span class="ruby-ivar">@header</span> = <span class="ruby-constant">HeaderOut</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>)
|
|
19
|
+
264: <span class="ruby-keyword kw">end</span></pre>
|
|
20
20
|
</body>
|
|
21
21
|
</html>
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 270</span>
|
|
14
|
+
270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">status</span>=<span class="ruby-value">200</span>)
|
|
15
|
+
271: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
|
|
16
|
+
272: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
|
|
17
|
+
273: <span class="ruby-identifier">finished</span>
|
|
18
|
+
274: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 278</span>
|
|
14
|
+
278: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
|
15
|
+
279: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
280: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
17
|
+
281: <span class="ruby-keyword kw">end</span></pre>
|
|
18
18
|
</body>
|
|
19
19
|
</html>
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 283</span>
|
|
14
|
+
283: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
|
|
15
|
+
284: <span class="ruby-identifier">status</span> = <span class="ruby-node">"HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status]}\r\nContent-Length: #{@body.length}\r\nConnection: close\r\n"</span>
|
|
16
|
+
285: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">status</span>)
|
|
17
|
+
286: <span class="ruby-keyword kw">end</span></pre>
|
|
18
18
|
</body>
|
|
19
19
|
</html>
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 288</span>
|
|
14
|
+
288: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
|
|
15
|
+
289: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
290: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">read</span>)
|
|
17
|
+
291: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"\r\n"</span>)
|
|
18
|
+
292: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 294</span>
|
|
14
|
+
294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
|
|
15
|
+
295: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
296: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
|
|
17
|
+
297: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
|
|
18
|
+
298: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 302</span>
|
|
14
|
+
302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
|
|
15
|
+
303: <span class="ruby-identifier">send_status</span>
|
|
16
|
+
304: <span class="ruby-identifier">send_header</span>
|
|
17
|
+
305: <span class="ruby-identifier">send_body</span>
|
|
18
|
+
306: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -85,7 +85,7 @@ Mognrel::HttpParser and <a
|
|
|
85
85
|
href="URIClassifier.html">Mongrel::URIClassifier</a> make up the majority
|
|
86
86
|
of how the server functions. It’s a very simple class that just has a
|
|
87
87
|
thread accepting connections and a simple <a
|
|
88
|
-
href="HttpServer.html#
|
|
88
|
+
href="HttpServer.html#M000009">HttpServer.process_client</a> function to do
|
|
89
89
|
the heavy lifting with the IO and Ruby.
|
|
90
90
|
</p>
|
|
91
91
|
<p>
|
|
@@ -119,12 +119,12 @@ finally useful.
|
|
|
119
119
|
<h3 class="section-bar">Methods</h3>
|
|
120
120
|
|
|
121
121
|
<div class="name-list">
|
|
122
|
-
<a href="#
|
|
123
|
-
<a href="#
|
|
124
|
-
<a href="#
|
|
125
|
-
<a href="#
|
|
126
|
-
<a href="#
|
|
127
|
-
<a href="#
|
|
122
|
+
<a href="#M000008">new</a>
|
|
123
|
+
<a href="#M000009">process_client</a>
|
|
124
|
+
<a href="#M000011">register</a>
|
|
125
|
+
<a href="#M000010">run</a>
|
|
126
|
+
<a href="#M000013">stop</a>
|
|
127
|
+
<a href="#M000012">unregister</a>
|
|
128
128
|
</div>
|
|
129
129
|
</div>
|
|
130
130
|
|
|
@@ -159,12 +159,12 @@ finally useful.
|
|
|
159
159
|
<div id="methods">
|
|
160
160
|
<h3 class="section-bar">Public Class methods</h3>
|
|
161
161
|
|
|
162
|
-
<div id="method-
|
|
163
|
-
<a name="
|
|
162
|
+
<div id="method-M000008" class="method-detail">
|
|
163
|
+
<a name="M000008"></a>
|
|
164
164
|
|
|
165
165
|
<div class="method-heading">
|
|
166
|
-
<a href="HttpServer.src/
|
|
167
|
-
onclick="popupCode('HttpServer.src/
|
|
166
|
+
<a href="HttpServer.src/M000008.html" target="Code" class="method-signature"
|
|
167
|
+
onclick="popupCode('HttpServer.src/M000008.html');return false;">
|
|
168
168
|
<span class="method-name">new</span><span class="method-args">(host, port, num_processors=20, timeout=120)</span>
|
|
169
169
|
</a>
|
|
170
170
|
</div>
|
|
@@ -188,20 +188,19 @@ responses the server can make.
|
|
|
188
188
|
few systems. If you find that you overload <a
|
|
189
189
|
href="../Mongrel.html">Mongrel</a> too much try changing it higher. If you
|
|
190
190
|
find that responses are way too slow try lowering it (after you’ve
|
|
191
|
-
tuned your stuff of course).
|
|
192
|
-
href="../Mongrel.html">Mongrel</a> will make this more dynamic (hopefully).
|
|
191
|
+
tuned your stuff of course).
|
|
193
192
|
</p>
|
|
194
193
|
</div>
|
|
195
194
|
</div>
|
|
196
195
|
|
|
197
196
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
198
197
|
|
|
199
|
-
<div id="method-
|
|
200
|
-
<a name="
|
|
198
|
+
<div id="method-M000009" class="method-detail">
|
|
199
|
+
<a name="M000009"></a>
|
|
201
200
|
|
|
202
201
|
<div class="method-heading">
|
|
203
|
-
<a href="HttpServer.src/
|
|
204
|
-
onclick="popupCode('HttpServer.src/
|
|
202
|
+
<a href="HttpServer.src/M000009.html" target="Code" class="method-signature"
|
|
203
|
+
onclick="popupCode('HttpServer.src/M000009.html');return false;">
|
|
205
204
|
<span class="method-name">process_client</span><span class="method-args">(client)</span>
|
|
206
205
|
</a>
|
|
207
206
|
</div>
|
|
@@ -218,12 +217,12 @@ crack at it.
|
|
|
218
217
|
</div>
|
|
219
218
|
</div>
|
|
220
219
|
|
|
221
|
-
<div id="method-
|
|
222
|
-
<a name="
|
|
220
|
+
<div id="method-M000011" class="method-detail">
|
|
221
|
+
<a name="M000011"></a>
|
|
223
222
|
|
|
224
223
|
<div class="method-heading">
|
|
225
|
-
<a href="HttpServer.src/
|
|
226
|
-
onclick="popupCode('HttpServer.src/
|
|
224
|
+
<a href="HttpServer.src/M000011.html" target="Code" class="method-signature"
|
|
225
|
+
onclick="popupCode('HttpServer.src/M000011.html');return false;">
|
|
227
226
|
<span class="method-name">register</span><span class="method-args">(uri, handler)</span>
|
|
228
227
|
</a>
|
|
229
228
|
</div>
|
|
@@ -234,18 +233,18 @@ Simply registers a handler with the internal <a
|
|
|
234
233
|
href="URIClassifier.html">URIClassifier</a>. When the URI is found in the
|
|
235
234
|
prefix of a request then your handler’s HttpHandler::process method
|
|
236
235
|
is called. See <a
|
|
237
|
-
href="URIClassifier.html#
|
|
236
|
+
href="URIClassifier.html#M000026">Mongrel::URIClassifier#register</a> for
|
|
238
237
|
more information.
|
|
239
238
|
</p>
|
|
240
239
|
</div>
|
|
241
240
|
</div>
|
|
242
241
|
|
|
243
|
-
<div id="method-
|
|
244
|
-
<a name="
|
|
242
|
+
<div id="method-M000010" class="method-detail">
|
|
243
|
+
<a name="M000010"></a>
|
|
245
244
|
|
|
246
245
|
<div class="method-heading">
|
|
247
|
-
<a href="HttpServer.src/
|
|
248
|
-
onclick="popupCode('HttpServer.src/
|
|
246
|
+
<a href="HttpServer.src/M000010.html" target="Code" class="method-signature"
|
|
247
|
+
onclick="popupCode('HttpServer.src/M000010.html');return false;">
|
|
249
248
|
<span class="method-name">run</span><span class="method-args">()</span>
|
|
250
249
|
</a>
|
|
251
250
|
</div>
|
|
@@ -259,12 +258,12 @@ later.
|
|
|
259
258
|
</div>
|
|
260
259
|
</div>
|
|
261
260
|
|
|
262
|
-
<div id="method-
|
|
263
|
-
<a name="
|
|
261
|
+
<div id="method-M000013" class="method-detail">
|
|
262
|
+
<a name="M000013"></a>
|
|
264
263
|
|
|
265
264
|
<div class="method-heading">
|
|
266
|
-
<a href="HttpServer.src/
|
|
267
|
-
onclick="popupCode('HttpServer.src/
|
|
265
|
+
<a href="HttpServer.src/M000013.html" target="Code" class="method-signature"
|
|
266
|
+
onclick="popupCode('HttpServer.src/M000013.html');return false;">
|
|
268
267
|
<span class="method-name">stop</span><span class="method-args">()</span>
|
|
269
268
|
</a>
|
|
270
269
|
</div>
|
|
@@ -277,12 +276,12 @@ the request queue before finally exiting.
|
|
|
277
276
|
</div>
|
|
278
277
|
</div>
|
|
279
278
|
|
|
280
|
-
<div id="method-
|
|
281
|
-
<a name="
|
|
279
|
+
<div id="method-M000012" class="method-detail">
|
|
280
|
+
<a name="M000012"></a>
|
|
282
281
|
|
|
283
282
|
<div class="method-heading">
|
|
284
|
-
<a href="HttpServer.src/
|
|
285
|
-
onclick="popupCode('HttpServer.src/
|
|
283
|
+
<a href="HttpServer.src/M000012.html" target="Code" class="method-signature"
|
|
284
|
+
onclick="popupCode('HttpServer.src/M000012.html');return false;">
|
|
286
285
|
<span class="method-name">unregister</span><span class="method-args">(uri)</span>
|
|
287
286
|
</a>
|
|
288
287
|
</div>
|
|
@@ -290,7 +289,7 @@ the request queue before finally exiting.
|
|
|
290
289
|
<div class="method-description">
|
|
291
290
|
<p>
|
|
292
291
|
Removes any handler registered at the given URI. See <a
|
|
293
|
-
href="URIClassifier.html#
|
|
292
|
+
href="URIClassifier.html#M000027">Mongrel::URIClassifier#unregister</a> for
|
|
294
293
|
more information.
|
|
295
294
|
</p>
|
|
296
295
|
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>new (Mongrel::HttpServer)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 345</span>
|
|
14
|
+
345: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">num_processors</span>=<span class="ruby-value">20</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-value">120</span>)
|
|
15
|
+
346: <span class="ruby-ivar">@socket</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>)
|
|
16
|
+
347:
|
|
17
|
+
348: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
|
18
|
+
349: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
|
|
19
|
+
350: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
|
20
|
+
351: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
|
21
|
+
352: <span class="ruby-ivar">@processors</span> = []
|
|
22
|
+
353:
|
|
23
|
+
354: <span class="ruby-comment cmt"># create the worker threads</span>
|
|
24
|
+
355: <span class="ruby-identifier">num_processors</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
|
25
|
+
356: <span class="ruby-ivar">@processors</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
|
26
|
+
357: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">client</span> = <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">deq</span>
|
|
27
|
+
358: <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">timeout</span>) <span class="ruby-keyword kw">do</span>
|
|
28
|
+
359: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
|
29
|
+
360: <span class="ruby-keyword kw">end</span>
|
|
30
|
+
361: <span class="ruby-keyword kw">end</span>
|
|
31
|
+
362: <span class="ruby-keyword kw">end</span>
|
|
32
|
+
363: <span class="ruby-keyword kw">end</span>
|
|
33
|
+
364:
|
|
34
|
+
365: <span class="ruby-keyword kw">end</span></pre>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
@@ -10,48 +10,48 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 373</span>
|
|
14
|
+
373: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
|
15
|
+
374: <span class="ruby-keyword kw">begin</span>
|
|
16
|
+
375: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
376: <span class="ruby-identifier">params</span> = {}
|
|
18
|
+
377: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
|
19
|
+
378:
|
|
20
|
+
379: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
|
21
|
+
380: <span class="ruby-identifier">nread</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>)
|
|
22
|
+
381: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
|
23
|
+
382: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handler</span> = <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REQUEST_URI</span>])
|
|
24
|
+
383:
|
|
25
|
+
384: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
|
|
26
|
+
385: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">path_info</span>
|
|
27
|
+
386: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SCRIPT_NAME</span>] = <span class="ruby-identifier">script_name</span>
|
|
28
|
+
387: <span class="ruby-identifier">request</span> = <span class="ruby-constant">HttpRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>[<span class="ruby-identifier">nread</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>], <span class="ruby-identifier">client</span>)
|
|
29
|
+
388: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
|
30
|
+
389: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
|
31
|
+
390: <span class="ruby-keyword kw">else</span>
|
|
32
|
+
391: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span>)
|
|
33
|
+
392: <span class="ruby-keyword kw">end</span>
|
|
34
|
+
393:
|
|
35
|
+
394: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
|
36
|
+
395: <span class="ruby-keyword kw">else</span>
|
|
37
|
+
396: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
|
38
|
+
397: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
|
39
|
+
398: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
|
40
|
+
399: <span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
|
41
|
+
400: <span class="ruby-keyword kw">end</span>
|
|
42
|
+
401: <span class="ruby-keyword kw">end</span>
|
|
43
|
+
402: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
|
44
|
+
403: <span class="ruby-comment cmt"># ignored</span>
|
|
45
|
+
404: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
|
|
46
|
+
405: <span class="ruby-comment cmt"># ignored</span>
|
|
47
|
+
406: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
|
|
48
|
+
407: <span class="ruby-comment cmt"># ignored</span>
|
|
49
|
+
408: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
|
50
|
+
409: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR(#{details.class}): #{details}"</span>
|
|
51
|
+
410: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
|
52
|
+
411: <span class="ruby-keyword kw">ensure</span>
|
|
53
|
+
412: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
|
54
|
+
413: <span class="ruby-keyword kw">end</span>
|
|
55
|
+
414: <span class="ruby-keyword kw">end</span></pre>
|
|
56
56
|
</body>
|
|
57
57
|
</html>
|
|
@@ -10,37 +10,37 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
398:
|
|
19
|
-
399: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>]
|
|
20
|
-
400: <span class="ruby-keyword kw">begin</span>
|
|
21
|
-
401: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
|
|
22
|
-
402: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
|
|
23
|
-
403: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Server stopped. Exiting."</span>
|
|
24
|
-
404: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
|
25
|
-
405: <span class="ruby-keyword kw">break</span>
|
|
26
|
-
406: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
|
|
27
|
-
407: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Too many open files. Try increasing ulimits."</span>
|
|
28
|
-
408: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
|
|
29
|
-
409: <span class="ruby-keyword kw">end</span>
|
|
30
|
-
410: <span class="ruby-keyword kw">end</span>
|
|
31
|
-
411:
|
|
32
|
-
412: <span class="ruby-comment cmt"># now that processing is done we feed enough false onto the request queue to get</span>
|
|
33
|
-
413: <span class="ruby-comment cmt"># each processor to exit and stop processing.</span>
|
|
34
|
-
414: <span class="ruby-ivar">@processors</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> { <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">false</span> }
|
|
35
|
-
415:
|
|
36
|
-
416: <span class="ruby-comment cmt"># finally we wait until the queue is empty</span>
|
|
37
|
-
417: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
38
|
-
418: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Shutdown waiting for #{@req_queue.length} requests"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
39
|
-
419: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
|
|
40
|
-
420: <span class="ruby-keyword kw">end</span>
|
|
41
|
-
421: <span class="ruby-keyword kw">end</span>
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 418</span>
|
|
14
|
+
418: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
|
15
|
+
419: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
|
|
16
|
+
420: <span class="ruby-ivar">@acceptor</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
|
17
|
+
421: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>] = <span class="ruby-keyword kw">false</span>
|
|
42
18
|
422:
|
|
43
|
-
423:
|
|
44
|
-
424:
|
|
19
|
+
423: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>]
|
|
20
|
+
424: <span class="ruby-keyword kw">begin</span>
|
|
21
|
+
425: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
|
|
22
|
+
426: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
|
|
23
|
+
427: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Server stopped. Exiting."</span>
|
|
24
|
+
428: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
|
25
|
+
429: <span class="ruby-keyword kw">break</span>
|
|
26
|
+
430: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
|
|
27
|
+
431: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Too many open files. Try increasing ulimits."</span>
|
|
28
|
+
432: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
|
|
29
|
+
433: <span class="ruby-keyword kw">end</span>
|
|
30
|
+
434: <span class="ruby-keyword kw">end</span>
|
|
31
|
+
435:
|
|
32
|
+
436: <span class="ruby-comment cmt"># now that processing is done we feed enough false onto the request queue to get</span>
|
|
33
|
+
437: <span class="ruby-comment cmt"># each processor to exit and stop processing.</span>
|
|
34
|
+
438: <span class="ruby-ivar">@processors</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> { <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">false</span> }
|
|
35
|
+
439:
|
|
36
|
+
440: <span class="ruby-comment cmt"># finally we wait until the queue is empty</span>
|
|
37
|
+
441: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
38
|
+
442: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Shutdown waiting for #{@req_queue.length} requests"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
39
|
+
443: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
|
|
40
|
+
444: <span class="ruby-keyword kw">end</span>
|
|
41
|
+
445: <span class="ruby-keyword kw">end</span>
|
|
42
|
+
446:
|
|
43
|
+
447: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
|
|
44
|
+
448: <span class="ruby-keyword kw">end</span></pre>
|
|
45
45
|
</body>
|
|
46
46
|
</html>
|