mongrel 0.3.9 → 0.3.10
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/Rakefile +38 -15
- data/bin/mongrel_rails +13 -11
- data/doc/rdoc/classes/Mongrel.html +6 -1
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +49 -49
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html +11 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html +34 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html +21 -6
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000054.html → M000060.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000055.html → M000061.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000056.html → M000062.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000063.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000064.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000065.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +177 -0
- data/doc/rdoc/classes/Mongrel/Camping.src/M000019.html +22 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +165 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000020.html +18 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000021.html +27 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +50 -50
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html +11 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html +28 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html +5 -9
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000009.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html +9 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000013.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000014.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000015.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +15 -15
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000013.html → M000016.html} +6 -6
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000014.html → M000017.html} +11 -11
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000015.html → M000018.html} +32 -32
- data/doc/rdoc/classes/Mongrel/Const.html +3 -3
- data/doc/rdoc/classes/Mongrel/DirHandler.html +31 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000023.html → M000029.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000024.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000025.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000026.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000027.html → M000033.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000028.html → M000034.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000060.html → M000066.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000061.html → M000067.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000035.html → M000041.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000036.html → M000042.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000037.html → M000043.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000022.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000017.html → M000023.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000018.html → M000024.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000019.html → M000025.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000020.html → M000026.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000021.html → M000027.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000016.html → M000028.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000062.html → M000068.html} +24 -24
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +8 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000039.html → M000045.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000040.html → M000046.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000047.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000048.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000049.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000050.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +33 -33
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000029.html → M000035.html} +22 -22
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000030.html → M000036.html} +43 -43
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000037.html} +34 -34
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000038.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000033.html → M000039.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000034.html → M000040.html} +9 -9
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +30 -30
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000045.html → M000051.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000046.html → M000052.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000047.html → M000053.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000048.html → M000054.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000049.html → M000055.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000050.html → M000056.html} +0 -0
- data/doc/rdoc/classes/RailsHandler.html +30 -10
- data/doc/rdoc/classes/RailsHandler.src/{M000001.html → M000003.html} +8 -8
- data/doc/rdoc/classes/RailsHandler.src/{M000002.html → M000004.html} +34 -34
- data/doc/rdoc/classes/RailsHandler.src/M000005.html +23 -0
- data/doc/rdoc/classes/TCPServer.html +173 -0
- data/doc/rdoc/classes/TCPServer.src/M000001.html +19 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/command_rb.html +3 -2
- data/doc/rdoc/files/lib/mongrel/{plugins_rb.html → init_rb.html} +5 -4
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -1
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -2
- data/doc/rdoc/fr_class_index.html +3 -0
- data/doc/rdoc/fr_file_index.html +3 -1
- data/doc/rdoc/fr_method_index.html +68 -62
- data/examples/camping/blog.rb +22 -37
- data/examples/camping/tepee.rb +3 -23
- data/lib/mongrel.rb +3 -4
- data/lib/mongrel/camping.rb +64 -0
- data/lib/mongrel/command.rb +3 -2
- data/lib/mongrel/{plugins.rb → init.rb} +1 -1
- data/lib/mongrel/rails.rb +16 -6
- data/lib/mongrel/tcphack.rb +12 -0
- data/tools/rakehelp.rb +10 -12
- metadata +74 -58
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -34
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000003.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000004.html +0 -41
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000005.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000038.html +0 -21
|
@@ -5,16 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>new (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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 260</span>
|
|
14
|
+
260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
|
|
15
|
+
261: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
16
|
+
262: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
263: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
|
18
|
+
264: <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
|
+
265: <span class="ruby-keyword kw">end</span></pre>
|
|
19
20
|
</body>
|
|
20
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 271</span>
|
|
14
|
+
271: <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
|
+
272: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
|
|
16
|
+
273: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
|
|
17
|
+
274: <span class="ruby-identifier">finished</span>
|
|
18
|
+
275: <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 279</span>
|
|
14
|
+
279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
|
15
|
+
280: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
281: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
17
|
+
282: <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 284</span>
|
|
14
|
+
284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
|
|
15
|
+
285: <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
|
+
286: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">status</span>)
|
|
17
|
+
287: <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 289</span>
|
|
14
|
+
289: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
|
|
15
|
+
290: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
291: <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
|
+
292: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"\r\n"</span>)
|
|
18
|
+
293: <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 295</span>
|
|
14
|
+
295: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
|
|
15
|
+
296: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
16
|
+
297: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
|
|
17
|
+
298: <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
|
+
299: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
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>finished (Mongrel::HttpResponse)</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 303</span>
|
|
14
|
+
303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
|
|
15
|
+
304: <span class="ruby-identifier">send_status</span>
|
|
16
|
+
305: <span class="ruby-identifier">send_header</span>
|
|
17
|
+
306: <span class="ruby-identifier">send_body</span>
|
|
18
|
+
307: <span class="ruby-keyword kw">end</span></pre>
|
|
19
|
+
</body>
|
|
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#M000036">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="#M000035">new</a>
|
|
123
|
+
<a href="#M000036">process_client</a>
|
|
124
|
+
<a href="#M000038">register</a>
|
|
125
|
+
<a href="#M000037">run</a>
|
|
126
|
+
<a href="#M000040">stop</a>
|
|
127
|
+
<a href="#M000039">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-M000035" class="method-detail">
|
|
163
|
+
<a name="M000035"></a>
|
|
164
164
|
|
|
165
165
|
<div class="method-heading">
|
|
166
|
-
<a href="HttpServer.src/
|
|
167
|
-
onclick="popupCode('HttpServer.src/
|
|
166
|
+
<a href="HttpServer.src/M000035.html" target="Code" class="method-signature"
|
|
167
|
+
onclick="popupCode('HttpServer.src/M000035.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>
|
|
@@ -195,12 +195,12 @@ tuned your stuff of course).
|
|
|
195
195
|
|
|
196
196
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
197
197
|
|
|
198
|
-
<div id="method-
|
|
199
|
-
<a name="
|
|
198
|
+
<div id="method-M000036" class="method-detail">
|
|
199
|
+
<a name="M000036"></a>
|
|
200
200
|
|
|
201
201
|
<div class="method-heading">
|
|
202
|
-
<a href="HttpServer.src/
|
|
203
|
-
onclick="popupCode('HttpServer.src/
|
|
202
|
+
<a href="HttpServer.src/M000036.html" target="Code" class="method-signature"
|
|
203
|
+
onclick="popupCode('HttpServer.src/M000036.html');return false;">
|
|
204
204
|
<span class="method-name">process_client</span><span class="method-args">(client)</span>
|
|
205
205
|
</a>
|
|
206
206
|
</div>
|
|
@@ -217,12 +217,12 @@ crack at it.
|
|
|
217
217
|
</div>
|
|
218
218
|
</div>
|
|
219
219
|
|
|
220
|
-
<div id="method-
|
|
221
|
-
<a name="
|
|
220
|
+
<div id="method-M000038" class="method-detail">
|
|
221
|
+
<a name="M000038"></a>
|
|
222
222
|
|
|
223
223
|
<div class="method-heading">
|
|
224
|
-
<a href="HttpServer.src/
|
|
225
|
-
onclick="popupCode('HttpServer.src/
|
|
224
|
+
<a href="HttpServer.src/M000038.html" target="Code" class="method-signature"
|
|
225
|
+
onclick="popupCode('HttpServer.src/M000038.html');return false;">
|
|
226
226
|
<span class="method-name">register</span><span class="method-args">(uri, handler)</span>
|
|
227
227
|
</a>
|
|
228
228
|
</div>
|
|
@@ -233,18 +233,18 @@ Simply registers a handler with the internal <a
|
|
|
233
233
|
href="URIClassifier.html">URIClassifier</a>. When the URI is found in the
|
|
234
234
|
prefix of a request then your handler’s HttpHandler::process method
|
|
235
235
|
is called. See <a
|
|
236
|
-
href="URIClassifier.html#
|
|
236
|
+
href="URIClassifier.html#M000054">Mongrel::URIClassifier#register</a> for
|
|
237
237
|
more information.
|
|
238
238
|
</p>
|
|
239
239
|
</div>
|
|
240
240
|
</div>
|
|
241
241
|
|
|
242
|
-
<div id="method-
|
|
243
|
-
<a name="
|
|
242
|
+
<div id="method-M000037" class="method-detail">
|
|
243
|
+
<a name="M000037"></a>
|
|
244
244
|
|
|
245
245
|
<div class="method-heading">
|
|
246
|
-
<a href="HttpServer.src/
|
|
247
|
-
onclick="popupCode('HttpServer.src/
|
|
246
|
+
<a href="HttpServer.src/M000037.html" target="Code" class="method-signature"
|
|
247
|
+
onclick="popupCode('HttpServer.src/M000037.html');return false;">
|
|
248
248
|
<span class="method-name">run</span><span class="method-args">()</span>
|
|
249
249
|
</a>
|
|
250
250
|
</div>
|
|
@@ -258,12 +258,12 @@ later.
|
|
|
258
258
|
</div>
|
|
259
259
|
</div>
|
|
260
260
|
|
|
261
|
-
<div id="method-
|
|
262
|
-
<a name="
|
|
261
|
+
<div id="method-M000040" class="method-detail">
|
|
262
|
+
<a name="M000040"></a>
|
|
263
263
|
|
|
264
264
|
<div class="method-heading">
|
|
265
|
-
<a href="HttpServer.src/
|
|
266
|
-
onclick="popupCode('HttpServer.src/
|
|
265
|
+
<a href="HttpServer.src/M000040.html" target="Code" class="method-signature"
|
|
266
|
+
onclick="popupCode('HttpServer.src/M000040.html');return false;">
|
|
267
267
|
<span class="method-name">stop</span><span class="method-args">()</span>
|
|
268
268
|
</a>
|
|
269
269
|
</div>
|
|
@@ -276,12 +276,12 @@ the request queue before finally exiting.
|
|
|
276
276
|
</div>
|
|
277
277
|
</div>
|
|
278
278
|
|
|
279
|
-
<div id="method-
|
|
280
|
-
<a name="
|
|
279
|
+
<div id="method-M000039" class="method-detail">
|
|
280
|
+
<a name="M000039"></a>
|
|
281
281
|
|
|
282
282
|
<div class="method-heading">
|
|
283
|
-
<a href="HttpServer.src/
|
|
284
|
-
onclick="popupCode('HttpServer.src/
|
|
283
|
+
<a href="HttpServer.src/M000039.html" target="Code" class="method-signature"
|
|
284
|
+
onclick="popupCode('HttpServer.src/M000039.html');return false;">
|
|
285
285
|
<span class="method-name">unregister</span><span class="method-args">(uri)</span>
|
|
286
286
|
</a>
|
|
287
287
|
</div>
|
|
@@ -289,7 +289,7 @@ the request queue before finally exiting.
|
|
|
289
289
|
<div class="method-description">
|
|
290
290
|
<p>
|
|
291
291
|
Removes any handler registered at the given URI. See <a
|
|
292
|
-
href="URIClassifier.html#
|
|
292
|
+
href="URIClassifier.html#M000055">Mongrel::URIClassifier#unregister</a> for
|
|
293
293
|
more information.
|
|
294
294
|
</p>
|
|
295
295
|
</div>
|
|
@@ -10,27 +10,27 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 346</span>
|
|
14
|
+
346: <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
|
+
347: <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
|
+
348:
|
|
17
|
+
349: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
|
18
|
+
350: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
|
|
19
|
+
351: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
|
20
|
+
352: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
|
21
|
+
353: <span class="ruby-ivar">@processors</span> = []
|
|
22
|
+
354:
|
|
23
|
+
355: <span class="ruby-comment cmt"># create the worker threads</span>
|
|
24
|
+
356: <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
|
+
357: <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
|
+
358: <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
|
+
359: <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
|
+
360: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
|
29
|
+
361: <span class="ruby-keyword kw">end</span>
|
|
30
|
+
362: <span class="ruby-keyword kw">end</span>
|
|
31
|
+
363: <span class="ruby-keyword kw">end</span>
|
|
32
|
+
364: <span class="ruby-keyword kw">end</span>
|
|
33
|
+
365:
|
|
34
|
+
366: <span class="ruby-keyword kw">end</span></pre>
|
|
35
35
|
</body>
|
|
36
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 374</span>
|
|
14
|
+
374: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
|
15
|
+
375: <span class="ruby-keyword kw">begin</span>
|
|
16
|
+
376: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
377: <span class="ruby-identifier">params</span> = {}
|
|
18
|
+
378: <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
|
+
379:
|
|
20
|
+
380: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
|
21
|
+
381: <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
|
+
382: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
|
23
|
+
383: <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
|
+
384:
|
|
25
|
+
385: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
|
|
26
|
+
386: <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
|
+
387: <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
|
+
388: <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
|
+
389: <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
|
+
390: <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
|
+
391: <span class="ruby-keyword kw">else</span>
|
|
32
|
+
392: <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
|
+
393: <span class="ruby-keyword kw">end</span>
|
|
34
|
+
394:
|
|
35
|
+
395: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
|
36
|
+
396: <span class="ruby-keyword kw">else</span>
|
|
37
|
+
397: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
|
38
|
+
398: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
|
39
|
+
399: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
|
40
|
+
400: <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
|
+
401: <span class="ruby-keyword kw">end</span>
|
|
42
|
+
402: <span class="ruby-keyword kw">end</span>
|
|
43
|
+
403: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
|
44
|
+
404: <span class="ruby-comment cmt"># ignored</span>
|
|
45
|
+
405: <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
|
+
406: <span class="ruby-comment cmt"># ignored</span>
|
|
47
|
+
407: <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
|
+
408: <span class="ruby-comment cmt"># ignored</span>
|
|
49
|
+
409: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
|
50
|
+
410: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR(#{details.class}): #{details}"</span>
|
|
51
|
+
411: <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
|
+
412: <span class="ruby-keyword kw">ensure</span>
|
|
53
|
+
413: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
|
54
|
+
414: <span class="ruby-keyword kw">end</span>
|
|
55
|
+
415: <span class="ruby-keyword kw">end</span></pre>
|
|
56
56
|
</body>
|
|
57
57
|
</html>
|
|
@@ -10,39 +10,39 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 419</span>
|
|
14
|
+
419: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
|
15
|
+
420: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
|
|
16
|
+
421: <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
|
+
422: <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
|
+
423:
|
|
19
|
+
424: <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
|
+
425: <span class="ruby-keyword kw">begin</span>
|
|
21
|
+
426: <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
|
+
427: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
|
|
23
|
+
428: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Server stopped. Exiting."</span>
|
|
24
|
+
429: <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
|
+
430: <span class="ruby-keyword kw">break</span>
|
|
26
|
+
431: <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
|
+
432: <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
|
+
433: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
|
|
29
|
+
434: <span class="ruby-keyword kw">end</span>
|
|
30
|
+
435: <span class="ruby-keyword kw">end</span>
|
|
31
|
+
436:
|
|
32
|
+
437: <span class="ruby-comment cmt"># now that processing is done we feed enough false onto the request queue to get</span>
|
|
33
|
+
438: <span class="ruby-comment cmt"># each processor to exit and stop processing.</span>
|
|
34
|
+
439: <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
|
+
440:
|
|
36
|
+
441: <span class="ruby-comment cmt"># finally we wait until the queue is empty</span>
|
|
37
|
+
442: <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
|
+
443: <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
|
+
444: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
|
|
40
|
+
445: <span class="ruby-keyword kw">end</span>
|
|
41
|
+
446: <span class="ruby-keyword kw">end</span>
|
|
42
|
+
447:
|
|
43
|
+
448: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
|
|
44
|
+
449:
|
|
45
|
+
450: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
|
|
46
|
+
451: <span class="ruby-keyword kw">end</span></pre>
|
|
47
47
|
</body>
|
|
48
48
|
</html>
|