mongrel 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Rakefile +20 -2
- data/bin/mongrel_rails +7 -53
- data/doc/rdoc/classes/Mongrel.html +1 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +300 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +23 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +27 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +22 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +26 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +19 -0
- data/doc/rdoc/classes/Mongrel/Const.html +1 -1
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +6 -6
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +28 -28
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +26 -26
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +17 -17
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +24 -24
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000047.html → M000055.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000048.html → M000056.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000033.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000034.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000049.html → M000057.html} +17 -17
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000041.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000042.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000043.html +5 -4
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html +6 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +24 -24
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +48 -48
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +9 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000031.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000032.html +4 -4
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +2 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +17 -9
- data/lib/mongrel.rb +89 -3
- data/lib/mongrel/command.rb +1 -1
- data/tools/rakehelp.rb +17 -9
- metadata +17 -7
@@ -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 434</span>
|
14
|
+
434: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
|
15
|
+
435: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
|
16
|
+
436: <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 439</span>
|
14
|
+
439: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
15
|
+
440: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
|
16
|
+
441: <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 174</span>
|
14
|
+
174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">out</span>)
|
15
|
+
175: <span class="ruby-ivar">@out</span> = <span class="ruby-identifier">out</span>
|
16
|
+
176: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -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 179</span>
|
14
|
+
179: <span class="ruby-keyword kw">def</span><span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span>)
|
15
|
+
180: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>)
|
16
|
+
181: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">": "</span>)
|
17
|
+
182: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">value</span>)
|
18
|
+
183: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"\r\n"</span>)
|
19
|
+
184: <span class="ruby-keyword kw">end</span></pre>
|
20
20
|
</body>
|
21
21
|
</html>
|
@@ -10,8 +10,8 @@
|
|
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
|
-
|
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">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
15
|
+
280: <span class="ruby-keyword kw">end</span></pre>
|
16
16
|
</body>
|
17
17
|
</html>
|
@@ -103,7 +103,7 @@ efficiently handling large file uploads.
|
|
103
103
|
<h3 class="section-bar">Methods</h3>
|
104
104
|
|
105
105
|
<div class="name-list">
|
106
|
-
<a href="#
|
106
|
+
<a href="#M000057">new</a>
|
107
107
|
</div>
|
108
108
|
</div>
|
109
109
|
|
@@ -143,12 +143,12 @@ efficiently handling large file uploads.
|
|
143
143
|
<div id="methods">
|
144
144
|
<h3 class="section-bar">Public Class methods</h3>
|
145
145
|
|
146
|
-
<div id="method-
|
147
|
-
<a name="
|
146
|
+
<div id="method-M000057" class="method-detail">
|
147
|
+
<a name="M000057"></a>
|
148
148
|
|
149
149
|
<div class="method-heading">
|
150
|
-
<a href="HttpRequest.src/
|
151
|
-
onclick="popupCode('HttpRequest.src/
|
150
|
+
<a href="HttpRequest.src/M000057.html" target="Code" class="method-signature"
|
151
|
+
onclick="popupCode('HttpRequest.src/M000057.html');return false;">
|
152
152
|
<span class="method-name">new</span><span class="method-args">(params, initial_body, socket)</span>
|
153
153
|
</a>
|
154
154
|
</div>
|
@@ -10,22 +10,22 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 145</span>
|
14
|
+
145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">initial_body</span>, <span class="ruby-identifier">socket</span>)
|
15
|
+
146: <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">initial_body</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
|
16
|
+
147: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
17
|
+
148: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
18
|
+
149:
|
19
|
+
150: <span class="ruby-comment cmt"># fix up the CGI requirements</span>
|
20
|
+
151: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_LENGTH</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
21
|
+
152: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_TYPE</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_TYPE</span>]
|
22
|
+
153:
|
23
|
+
154: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
|
24
|
+
155: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
|
25
|
+
156: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
|
26
|
+
157: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">clen</span>
|
27
|
+
158: <span class="ruby-ivar">@body</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">clen</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span>)
|
28
|
+
159: <span class="ruby-keyword kw">end</span>
|
29
|
+
160: <span class="ruby-keyword kw">end</span></pre>
|
30
30
|
</body>
|
31
31
|
</html>
|
@@ -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 223</span>
|
14
|
+
223: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
|
15
|
+
224: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
16
|
+
225: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
17
|
+
226: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
18
|
+
227: <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
|
+
228: <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 234</span>
|
14
|
+
234: <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
|
+
235: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
|
16
|
+
236: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
|
17
|
+
237: <span class="ruby-identifier">finished</span>
|
18
|
+
238: <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 242</span>
|
14
|
+
242: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
15
|
+
243: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
16
|
+
244: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
17
|
+
245: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,9 +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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 247</span>
|
14
|
+
247: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
|
15
|
+
248: <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
|
+
249: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">status</span>)
|
17
|
+
250: <span class="ruby-keyword kw">end</span></pre>
|
17
18
|
</body>
|
18
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 252</span>
|
14
|
+
252: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
|
15
|
+
253: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
16
|
+
254: <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
|
+
255: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"\r\n"</span>)
|
18
|
+
256: <span class="ruby-keyword kw">end</span></pre>
|
19
19
|
</body>
|
20
20
|
</html>
|
@@ -10,12 +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
|
-
|
19
|
-
260: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 258</span>
|
14
|
+
258: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
|
15
|
+
259: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
16
|
+
260: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
|
17
|
+
261: <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
|
+
262: <span class="ruby-keyword kw">end</span></pre>
|
20
19
|
</body>
|
21
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 266</span>
|
14
|
+
266: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
|
15
|
+
267: <span class="ruby-identifier">send_status</span>
|
16
|
+
268: <span class="ruby-identifier">send_header</span>
|
17
|
+
269: <span class="ruby-identifier">send_body</span>
|
18
|
+
270: <span class="ruby-keyword kw">end</span></pre>
|
19
19
|
</body>
|
20
20
|
</html>
|
@@ -10,29 +10,29 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 320</span>
|
14
|
+
320: <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
|
+
321: <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
|
+
322:
|
17
|
+
323: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
18
|
+
324: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
|
19
|
+
325: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
20
|
+
326: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
21
|
+
327: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
|
22
|
+
328: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
|
23
|
+
329:
|
24
|
+
330: <span class="ruby-ivar">@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> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
25
|
+
331: <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>
|
26
|
+
332: <span class="ruby-keyword kw">begin</span>
|
27
|
+
333: <span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-ivar">@timeout</span>) <span class="ruby-keyword kw">do</span>
|
28
|
+
334: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
29
|
+
335: <span class="ruby-keyword kw">end</span>
|
30
|
+
336: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
31
|
+
337: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"WARNING: Request took longer than #@timeout second timeout"</span>
|
32
|
+
338: <span class="ruby-keyword kw">end</span>
|
33
|
+
339: <span class="ruby-keyword kw">end</span>
|
34
|
+
340: <span class="ruby-keyword kw">end</span>
|
35
|
+
341: }
|
36
|
+
342: <span class="ruby-keyword kw">end</span></pre>
|
37
37
|
</body>
|
38
38
|
</html>
|
@@ -10,55 +10,55 @@
|
|
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
|
-
385: <span class="ruby-comment cmt"># ignored</span>
|
52
|
-
386: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 350</span>
|
14
|
+
350: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
15
|
+
351: <span class="ruby-keyword kw">begin</span>
|
16
|
+
352: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
17
|
+
353: <span class="ruby-identifier">params</span> = {}
|
18
|
+
354: <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
|
+
355:
|
20
|
+
356: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
21
|
+
357: <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
|
+
358: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
23
|
+
359: <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
|
+
360:
|
25
|
+
361: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
|
26
|
+
362: <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
|
+
363: <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
|
+
364: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE_VALUE</span>
|
29
|
+
365: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REMOTE_ADDR</span>]=<span class="ruby-identifier">client</span>.<span class="ruby-identifier">peeraddr</span>[<span class="ruby-value">3</span>]
|
30
|
+
366: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_NAME</span>]=<span class="ruby-ivar">@host</span>
|
31
|
+
367: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PORT</span>]=<span class="ruby-ivar">@port</span>
|
32
|
+
368: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL_VALUE</span>
|
33
|
+
369: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_SOFTWARE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MONGREL_VERSION</span>
|
34
|
+
370:
|
35
|
+
371: <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>)
|
36
|
+
372: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
37
|
+
373: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
38
|
+
374: <span class="ruby-keyword kw">else</span>
|
39
|
+
375: <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>)
|
40
|
+
376: <span class="ruby-keyword kw">end</span>
|
41
|
+
377:
|
42
|
+
378: <span class="ruby-keyword kw">break</span>
|
43
|
+
379: <span class="ruby-keyword kw">else</span>
|
44
|
+
380: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
45
|
+
381: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
46
|
+
382: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
47
|
+
383: <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>)
|
48
|
+
384: <span class="ruby-keyword kw">end</span>
|
49
|
+
385: <span class="ruby-keyword kw">end</span>
|
50
|
+
386: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
53
51
|
387: <span class="ruby-comment cmt"># ignored</span>
|
54
|
-
388: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">
|
52
|
+
388: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
|
55
53
|
389: <span class="ruby-comment cmt"># ignored</span>
|
56
|
-
390: <span class="ruby-keyword kw">rescue</span>
|
57
|
-
391: <span class="ruby-
|
58
|
-
392:
|
59
|
-
393:
|
60
|
-
394: <span class="ruby-identifier">
|
61
|
-
395: <span class="ruby-keyword kw">
|
62
|
-
396:
|
54
|
+
390: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
|
55
|
+
391: <span class="ruby-comment cmt"># ignored</span>
|
56
|
+
392: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
57
|
+
393: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR(#{details.class}): #{details}"</span>
|
58
|
+
394: <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>)
|
59
|
+
395: <span class="ruby-keyword kw">ensure</span>
|
60
|
+
396: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
61
|
+
397: <span class="ruby-keyword kw">end</span>
|
62
|
+
398: <span class="ruby-keyword kw">end</span></pre>
|
63
63
|
</body>
|
64
64
|
</html>
|
@@ -10,14 +10,14 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 402</span>
|
14
|
+
402: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
15
|
+
403: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
|
16
|
+
404: <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
|
+
405: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
18
|
+
406: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
|
19
|
+
407: <span class="ruby-keyword kw">end</span>
|
20
|
+
408: <span class="ruby-keyword kw">end</span>
|
21
|
+
409: <span class="ruby-keyword kw">end</span></pre>
|
22
22
|
</body>
|
23
23
|
</html>
|