mongrel 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -3
- data/Rakefile +7 -5
- data/bin/mongrel_rails +5 -4
- data/bin/mongrel_rails_service +237 -0
- data/bin/mongrel_rails_svc +194 -0
- data/doc/rdoc/classes/Mongrel.html +1 -4
- data/doc/rdoc/classes/Mongrel/Const.html +13 -3
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000033.html → M000028.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000034.html → M000029.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000041.html +39 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000034.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000035.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000036.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000037.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000044.html → M000038.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000045.html → M000039.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.html +47 -28
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000022.html +33 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000023.html +57 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000024.html +46 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000025.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000026.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000027.html +19 -0
- data/doc/rdoc/classes/Mongrel/{HttpHandler.html → StopServer.html} +4 -33
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +22 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000035.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000036.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000037.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000038.html → M000033.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +9 -7
- data/doc/rdoc/files/lib/mongrel_rb.html +3 -3
- data/doc/rdoc/fr_class_index.html +1 -4
- data/doc/rdoc/fr_method_index.html +20 -37
- data/examples/mongrel_simple_ctrl.rb +92 -0
- data/examples/mongrel_simple_service.rb +116 -0
- data/examples/simpletest.rb +3 -1
- data/ext/http11/http11_parser.c +176 -263
- data/lib/mongrel.rb +56 -343
- data/lib/mongrel/cgi.rb +147 -0
- data/lib/mongrel/handlers.rb +180 -0
- metadata +28 -46
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -346
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +0 -48
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +0 -27
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -26
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html +0 -19
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -283
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +0 -40
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000056.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000057.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000058.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +0 -38
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +0 -64
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +0 -23
@@ -5,17 +5,16 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>finished (Mongrel::HttpResponse)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
-
228: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 280</span>
|
14
|
+
280: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
|
15
|
+
281: <span class="ruby-identifier">send_status</span>
|
16
|
+
282: <span class="ruby-identifier">send_header</span>
|
17
|
+
283: <span class="ruby-identifier">send_body</span>
|
18
|
+
284: <span class="ruby-keyword kw">end</span></pre>
|
20
19
|
</body>
|
21
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#M000023">HttpServer.process_client</a> function to do
|
89
89
|
the heavy lifting with the IO and Ruby.
|
90
90
|
</p>
|
91
91
|
<p>
|
@@ -119,11 +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="#
|
122
|
+
<a href="#M000022">new</a>
|
123
|
+
<a href="#M000023">process_client</a>
|
124
|
+
<a href="#M000025">register</a>
|
125
|
+
<a href="#M000024">run</a>
|
126
|
+
<a href="#M000027">stop</a>
|
127
|
+
<a href="#M000026">unregister</a>
|
127
128
|
</div>
|
128
129
|
</div>
|
129
130
|
|
@@ -158,12 +159,12 @@ finally useful.
|
|
158
159
|
<div id="methods">
|
159
160
|
<h3 class="section-bar">Public Class methods</h3>
|
160
161
|
|
161
|
-
<div id="method-
|
162
|
-
<a name="
|
162
|
+
<div id="method-M000022" class="method-detail">
|
163
|
+
<a name="M000022"></a>
|
163
164
|
|
164
165
|
<div class="method-heading">
|
165
|
-
<a href="HttpServer.src/
|
166
|
-
onclick="popupCode('HttpServer.src/
|
166
|
+
<a href="HttpServer.src/M000022.html" target="Code" class="method-signature"
|
167
|
+
onclick="popupCode('HttpServer.src/M000022.html');return false;">
|
167
168
|
<span class="method-name">new</span><span class="method-args">(host, port, num_processors=20, timeout=120)</span>
|
168
169
|
</a>
|
169
170
|
</div>
|
@@ -195,12 +196,12 @@ href="../Mongrel.html">Mongrel</a> will make this more dynamic (hopefully).
|
|
195
196
|
|
196
197
|
<h3 class="section-bar">Public Instance methods</h3>
|
197
198
|
|
198
|
-
<div id="method-
|
199
|
-
<a name="
|
199
|
+
<div id="method-M000023" class="method-detail">
|
200
|
+
<a name="M000023"></a>
|
200
201
|
|
201
202
|
<div class="method-heading">
|
202
|
-
<a href="HttpServer.src/
|
203
|
-
onclick="popupCode('HttpServer.src/
|
203
|
+
<a href="HttpServer.src/M000023.html" target="Code" class="method-signature"
|
204
|
+
onclick="popupCode('HttpServer.src/M000023.html');return false;">
|
204
205
|
<span class="method-name">process_client</span><span class="method-args">(client)</span>
|
205
206
|
</a>
|
206
207
|
</div>
|
@@ -217,12 +218,12 @@ crack at it.
|
|
217
218
|
</div>
|
218
219
|
</div>
|
219
220
|
|
220
|
-
<div id="method-
|
221
|
-
<a name="
|
221
|
+
<div id="method-M000025" class="method-detail">
|
222
|
+
<a name="M000025"></a>
|
222
223
|
|
223
224
|
<div class="method-heading">
|
224
|
-
<a href="HttpServer.src/
|
225
|
-
onclick="popupCode('HttpServer.src/
|
225
|
+
<a href="HttpServer.src/M000025.html" target="Code" class="method-signature"
|
226
|
+
onclick="popupCode('HttpServer.src/M000025.html');return false;">
|
226
227
|
<span class="method-name">register</span><span class="method-args">(uri, handler)</span>
|
227
228
|
</a>
|
228
229
|
</div>
|
@@ -233,18 +234,18 @@ Simply registers a handler with the internal <a
|
|
233
234
|
href="URIClassifier.html">URIClassifier</a>. When the URI is found in the
|
234
235
|
prefix of a request then your handler’s HttpHandler::process method
|
235
236
|
is called. See <a
|
236
|
-
href="URIClassifier.html#
|
237
|
+
href="URIClassifier.html#M000031">Mongrel::URIClassifier#register</a> for
|
237
238
|
more information.
|
238
239
|
</p>
|
239
240
|
</div>
|
240
241
|
</div>
|
241
242
|
|
242
|
-
<div id="method-
|
243
|
-
<a name="
|
243
|
+
<div id="method-M000024" class="method-detail">
|
244
|
+
<a name="M000024"></a>
|
244
245
|
|
245
246
|
<div class="method-heading">
|
246
|
-
<a href="HttpServer.src/
|
247
|
-
onclick="popupCode('HttpServer.src/
|
247
|
+
<a href="HttpServer.src/M000024.html" target="Code" class="method-signature"
|
248
|
+
onclick="popupCode('HttpServer.src/M000024.html');return false;">
|
248
249
|
<span class="method-name">run</span><span class="method-args">()</span>
|
249
250
|
</a>
|
250
251
|
</div>
|
@@ -258,12 +259,30 @@ later.
|
|
258
259
|
</div>
|
259
260
|
</div>
|
260
261
|
|
261
|
-
<div id="method-
|
262
|
-
<a name="
|
262
|
+
<div id="method-M000027" class="method-detail">
|
263
|
+
<a name="M000027"></a>
|
263
264
|
|
264
265
|
<div class="method-heading">
|
265
|
-
<a href="HttpServer.src/
|
266
|
-
onclick="popupCode('HttpServer.src/
|
266
|
+
<a href="HttpServer.src/M000027.html" target="Code" class="method-signature"
|
267
|
+
onclick="popupCode('HttpServer.src/M000027.html');return false;">
|
268
|
+
<span class="method-name">stop</span><span class="method-args">()</span>
|
269
|
+
</a>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div class="method-description">
|
273
|
+
<p>
|
274
|
+
Stops the acceptor thread and then causes the worker threads to finish off
|
275
|
+
the request queue before finally exiting.
|
276
|
+
</p>
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
<div id="method-M000026" class="method-detail">
|
281
|
+
<a name="M000026"></a>
|
282
|
+
|
283
|
+
<div class="method-heading">
|
284
|
+
<a href="HttpServer.src/M000026.html" target="Code" class="method-signature"
|
285
|
+
onclick="popupCode('HttpServer.src/M000026.html');return false;">
|
267
286
|
<span class="method-name">unregister</span><span class="method-args">(uri)</span>
|
268
287
|
</a>
|
269
288
|
</div>
|
@@ -271,7 +290,7 @@ later.
|
|
271
290
|
<div class="method-description">
|
272
291
|
<p>
|
273
292
|
Removes any handler registered at the given URI. See <a
|
274
|
-
href="URIClassifier.html#
|
293
|
+
href="URIClassifier.html#M000032">Mongrel::URIClassifier#unregister</a> for
|
275
294
|
more information.
|
276
295
|
</p>
|
277
296
|
</div>
|
@@ -0,0 +1,33 @@
|
|
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 324</span>
|
14
|
+
324: <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
|
+
325: <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
|
+
326:
|
17
|
+
327: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
18
|
+
328: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
|
19
|
+
329: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
20
|
+
330: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
21
|
+
331: <span class="ruby-ivar">@processors</span> = []
|
22
|
+
332: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
|
23
|
+
333:
|
24
|
+
334: <span class="ruby-identifier">num_processors</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
25
|
+
335: <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
|
+
336: <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
|
+
337: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
28
|
+
338: <span class="ruby-keyword kw">end</span>
|
29
|
+
339: <span class="ruby-keyword kw">end</span>
|
30
|
+
340: }
|
31
|
+
341: <span class="ruby-keyword kw">end</span></pre>
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
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>process_client (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 349</span>
|
14
|
+
349: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
15
|
+
350: <span class="ruby-keyword kw">begin</span>
|
16
|
+
351: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
17
|
+
352: <span class="ruby-identifier">params</span> = {}
|
18
|
+
353: <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
|
+
354:
|
20
|
+
355: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
21
|
+
356: <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
|
+
357: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
23
|
+
358: <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
|
+
359:
|
25
|
+
360: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
|
26
|
+
361: <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
|
+
362: <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
|
+
363: <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
|
+
364: <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
|
+
365: <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
|
+
366: <span class="ruby-keyword kw">else</span>
|
32
|
+
367: <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
|
+
368: <span class="ruby-keyword kw">end</span>
|
34
|
+
369:
|
35
|
+
370: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
36
|
+
371: <span class="ruby-keyword kw">else</span>
|
37
|
+
372: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
38
|
+
373: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
39
|
+
374: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
40
|
+
375: <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
|
+
376: <span class="ruby-keyword kw">end</span>
|
42
|
+
377: <span class="ruby-keyword kw">end</span>
|
43
|
+
378: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
44
|
+
379: <span class="ruby-comment cmt"># ignored</span>
|
45
|
+
380: <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
|
+
381: <span class="ruby-comment cmt"># ignored</span>
|
47
|
+
382: <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
|
+
383: <span class="ruby-comment cmt"># ignored</span>
|
49
|
+
384: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
50
|
+
385: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR(#{details.class}): #{details}"</span>
|
51
|
+
386: <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
|
+
387: <span class="ruby-keyword kw">ensure</span>
|
53
|
+
388: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
54
|
+
389: <span class="ruby-keyword kw">end</span>
|
55
|
+
390: <span class="ruby-keyword kw">end</span></pre>
|
56
|
+
</body>
|
57
|
+
</html>
|
@@ -0,0 +1,46 @@
|
|
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>run (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 394</span>
|
14
|
+
394: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
15
|
+
395: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
|
16
|
+
396: <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
|
+
397: <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>
|
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>
|
42
|
+
422:
|
43
|
+
423: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
|
44
|
+
424: <span class="ruby-keyword kw">end</span></pre>
|
45
|
+
</body>
|
46
|
+
</html>
|
@@ -10,9 +10,9 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 430</span>
|
14
|
+
430: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
|
15
|
+
431: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
|
16
|
+
432: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 436</span>
|
14
|
+
436: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
15
|
+
437: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
16
|
+
438: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -0,0 +1,19 @@
|
|
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>stop (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 442</span>
|
14
|
+
442: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
15
|
+
443: <span class="ruby-ivar">@acceptor</span>[<span class="ruby-identifier">:stopped</span>] = <span class="ruby-keyword kw">true</span>
|
16
|
+
444: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">raise</span>(<span class="ruby-constant">StopServer</span>.<span class="ruby-identifier">new</span>)
|
17
|
+
445: <span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
7
|
<head>
|
8
|
-
<title>Class: Mongrel::
|
8
|
+
<title>Class: Mongrel::StopServer</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
11
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<table class="header-table">
|
51
51
|
<tr class="top-aligned-row">
|
52
52
|
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Mongrel::
|
53
|
+
<td class="class-name-in-header">Mongrel::StopServer</td>
|
54
54
|
</tr>
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
@@ -65,7 +65,7 @@
|
|
65
65
|
<tr class="top-aligned-row">
|
66
66
|
<td><strong>Parent:</strong></td>
|
67
67
|
<td>
|
68
|
-
|
68
|
+
Exception
|
69
69
|
</td>
|
70
70
|
</tr>
|
71
71
|
</table>
|
@@ -80,10 +80,7 @@
|
|
80
80
|
|
81
81
|
<div id="description">
|
82
82
|
<p>
|
83
|
-
|
84
|
-
giving just the minimum necessary for you to handle a request and shoot
|
85
|
-
back a response. Look at the <a href="HttpRequest.html">HttpRequest</a> and
|
86
|
-
<a href="HttpResponse.html">HttpResponse</a> objects for how to use them.
|
83
|
+
Used to stop the <a href="HttpServer.html">HttpServer</a> via Thread.raise.
|
87
84
|
</p>
|
88
85
|
|
89
86
|
</div>
|
@@ -91,13 +88,6 @@ back a response. Look at the <a href="HttpRequest.html">HttpRequest</a> and
|
|
91
88
|
|
92
89
|
</div>
|
93
90
|
|
94
|
-
<div id="method-list">
|
95
|
-
<h3 class="section-bar">Methods</h3>
|
96
|
-
|
97
|
-
<div class="name-list">
|
98
|
-
<a href="#M000039">process</a>
|
99
|
-
</div>
|
100
|
-
</div>
|
101
91
|
|
102
92
|
</div>
|
103
93
|
|
@@ -114,25 +104,6 @@ back a response. Look at the <a href="HttpRequest.html">HttpRequest</a> and
|
|
114
104
|
|
115
105
|
|
116
106
|
<!-- if method_list -->
|
117
|
-
<div id="methods">
|
118
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
119
|
-
|
120
|
-
<div id="method-M000039" class="method-detail">
|
121
|
-
<a name="M000039"></a>
|
122
|
-
|
123
|
-
<div class="method-heading">
|
124
|
-
<a href="HttpHandler.src/M000039.html" target="Code" class="method-signature"
|
125
|
-
onclick="popupCode('HttpHandler.src/M000039.html');return false;">
|
126
|
-
<span class="method-name">process</span><span class="method-args">(request, response)</span>
|
127
|
-
</a>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
</div>
|
132
|
-
</div>
|
133
|
-
|
134
|
-
|
135
|
-
</div>
|
136
107
|
|
137
108
|
|
138
109
|
</div>
|
@@ -86,10 +86,10 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
89
|
+
<a href="#M000030">new</a>
|
90
|
+
<a href="#M000031">register</a>
|
91
|
+
<a href="#M000033">resolve</a>
|
92
|
+
<a href="#M000032">unregister</a>
|
93
93
|
</div>
|
94
94
|
</div>
|
95
95
|
|
@@ -111,12 +111,12 @@
|
|
111
111
|
<div id="methods">
|
112
112
|
<h3 class="section-bar">Public Class methods</h3>
|
113
113
|
|
114
|
-
<div id="method-
|
115
|
-
<a name="
|
114
|
+
<div id="method-M000030" class="method-detail">
|
115
|
+
<a name="M000030"></a>
|
116
116
|
|
117
117
|
<div class="method-heading">
|
118
|
-
<a href="URIClassifier.src/
|
119
|
-
onclick="popupCode('URIClassifier.src/
|
118
|
+
<a href="URIClassifier.src/M000030.html" target="Code" class="method-signature"
|
119
|
+
onclick="popupCode('URIClassifier.src/M000030.html');return false;">
|
120
120
|
<span class="method-name">URIClassifier.new → URIClassifier<br />
|
121
121
|
</span>
|
122
122
|
</a>
|
@@ -143,12 +143,12 @@ portion.
|
|
143
143
|
|
144
144
|
<h3 class="section-bar">Public Instance methods</h3>
|
145
145
|
|
146
|
-
<div id="method-
|
147
|
-
<a name="
|
146
|
+
<div id="method-M000031" class="method-detail">
|
147
|
+
<a name="M000031"></a>
|
148
148
|
|
149
149
|
<div class="method-heading">
|
150
|
-
<a href="URIClassifier.src/
|
151
|
-
onclick="popupCode('URIClassifier.src/
|
150
|
+
<a href="URIClassifier.src/M000031.html" target="Code" class="method-signature"
|
151
|
+
onclick="popupCode('URIClassifier.src/M000031.html');return false;">
|
152
152
|
<span class="method-name">uc.register("/someuri", SampleHandler.new) → nil<br />
|
153
153
|
</span>
|
154
154
|
</a>
|
@@ -173,12 +173,12 @@ to get right with a Hash.
|
|
173
173
|
</div>
|
174
174
|
</div>
|
175
175
|
|
176
|
-
<div id="method-
|
177
|
-
<a name="
|
176
|
+
<div id="method-M000033" class="method-detail">
|
177
|
+
<a name="M000033"></a>
|
178
178
|
|
179
179
|
<div class="method-heading">
|
180
|
-
<a href="URIClassifier.src/
|
181
|
-
onclick="popupCode('URIClassifier.src/
|
180
|
+
<a href="URIClassifier.src/M000033.html" target="Code" class="method-signature"
|
181
|
+
onclick="popupCode('URIClassifier.src/M000033.html');return false;">
|
182
182
|
<span class="method-name">uc.resolve("/someuri") → "/someuri", "", handler<br />
|
183
183
|
uc.resolve("/someuri/pathinfo") → "/someuri", "/pathinfo", handler<br />
|
184
184
|
uc.resolve("/notfound/orhere") → nil, nil, nil<br />
|
@@ -192,9 +192,8 @@ uc.resolve("/path/from/root") → "/", "/path/from/root", handler # if uc.re
|
|
192
192
|
<p>
|
193
193
|
Attempts to resolve either the whole URI or at the longest prefix,
|
194
194
|
returning the prefix (as script_info), path (as path_info), and registered
|
195
|
-
handler (usually an
|
196
|
-
|
197
|
-
returns nil,nil,nil.
|
195
|
+
handler (usually an HttpHandler). If it doesn’t find a handler
|
196
|
+
registered at the longest match then it returns nil,nil,nil.
|
198
197
|
</p>
|
199
198
|
<p>
|
200
199
|
Because the resolver uses a trie you are able to register a handler at
|
@@ -225,12 +224,12 @@ Don‘t try other string-like stuff yet.
|
|
225
224
|
</div>
|
226
225
|
</div>
|
227
226
|
|
228
|
-
<div id="method-
|
229
|
-
<a name="
|
227
|
+
<div id="method-M000032" class="method-detail">
|
228
|
+
<a name="M000032"></a>
|
230
229
|
|
231
230
|
<div class="method-heading">
|
232
|
-
<a href="URIClassifier.src/
|
233
|
-
onclick="popupCode('URIClassifier.src/
|
231
|
+
<a href="URIClassifier.src/M000032.html" target="Code" class="method-signature"
|
232
|
+
onclick="popupCode('URIClassifier.src/M000032.html');return false;">
|
234
233
|
<span class="method-name">uc.unregister("/someuri")<br />
|
235
234
|
</span>
|
236
235
|
</a>
|