mongrel 0.3.12 → 0.3.12.1
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 +1 -1
- data/bin/mongrel_rails +12 -6
- data/doc/rdoc/classes/Class.src/M000001.html +10 -10
- data/doc/rdoc/classes/Class.src/M000002.html +46 -46
- data/doc/rdoc/classes/Class.src/M000003.html +7 -7
- data/doc/rdoc/classes/Class.src/M000004.html +6 -6
- data/doc/rdoc/classes/IO.src/M000005.html +5 -5
- data/doc/rdoc/classes/IO.src/M000006.html +5 -5
- data/doc/rdoc/classes/Kernel.src/M000025.html +5 -5
- data/doc/rdoc/classes/Kernel.src/M000026.html +11 -11
- data/doc/rdoc/classes/Mongrel.html +1 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +1 -1
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +10 -10
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +9 -9
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +18 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +16 -16
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +19 -19
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +10 -11
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +8 -8
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +7 -7
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +14 -13
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +5 -33
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +33 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000115.html +18 -0
- data/doc/rdoc/classes/Mongrel/Const.html +11 -1
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html +5 -5
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000117.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +0 -185
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +3 -1
- data/doc/rdoc/classes/Mongrel/{StopServer.html → HttpParserError.html} +5 -11
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html +15 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html +7 -19
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000121.html +32 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +12 -12
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +11 -11
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +9 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +10 -10
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +51 -50
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +10 -10
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +45 -45
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +14 -14
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +4 -4
- data/doc/rdoc/classes/ObjectTracker.src/M000019.html +20 -22
- data/doc/rdoc/classes/RequestLog/Access.src/M000122.html +19 -0
- data/doc/rdoc/classes/RequestLog/Files.src/{M000121.html → M000123.html} +5 -5
- data/doc/rdoc/classes/RequestLog/Objects.src/{M000122.html → M000124.html} +5 -5
- data/doc/rdoc/classes/RequestLog/Params.src/{M000123.html → M000125.html} +5 -5
- data/doc/rdoc/classes/Stats.html +1 -1
- data/doc/rdoc/classes/Stats.src/M000012.html +2 -2
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel/command_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
- data/examples/random_thrash.rb +19 -0
- data/ext/http11/http11.c +57 -12
- data/ext/http11/http11_parser.c +58 -52
- data/lib/mongrel.rb +37 -10
- data/lib/mongrel/command.rb +1 -1
- data/lib/mongrel/debug.rb +39 -125
- data/lib/mongrel/handlers.rb +2 -2
- data/lib/mongrel/rails.rb +2 -1
- data/lib/mongrel/stats.rb +2 -2
- data/test/test_configurator.rb +2 -2
- data/test/test_debug.rb +2 -4
- data/test/test_http11.rb +76 -7
- data/test/test_stats.rb +6 -4
- data/test/test_uriclassifier.rb +0 -14
- metadata +12 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -383
- data/doc/rdoc/classes/Mongrel/Configurator.html +0 -563
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +0 -152
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +0 -222
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html +0 -28
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +0 -371
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +0 -301
- data/doc/rdoc/classes/RequestLog.html +0 -113
- data/doc/rdoc/classes/RequestLog/Files.html +0 -144
- data/doc/rdoc/classes/RequestLog/Objects.html +0 -144
- data/doc/rdoc/classes/RequestLog/Params.html +0 -144
- data/doc/rdoc/fr_class_index.html +0 -60
- data/doc/rdoc/fr_file_index.html +0 -40
- data/doc/rdoc/fr_method_index.html +0 -149
- data/doc/rdoc/index.html +0 -24
- data/lib/http11.bundle +0 -0
|
@@ -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 212</span>
|
|
14
|
+
212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">out</span>)
|
|
15
|
+
213: <span class="ruby-ivar">@out</span> = <span class="ruby-identifier">out</span>
|
|
16
|
+
214: <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 217</span>
|
|
14
|
+
217: <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
|
+
218: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HEADER_FORMAT</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>])
|
|
16
|
+
219: <span class="ruby-keyword kw">end</span></pre>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -31,8 +31,10 @@ VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data)
|
|
|
31
31
|
http->data = (void *)req_hash;
|
|
32
32
|
http_parser_execute(http, RSTRING(data)->ptr, RSTRING(data)->len);
|
|
33
33
|
|
|
34
|
+
VALIDATE_MAX_LENGTH(http_parser_nread(http), HEADER);
|
|
35
|
+
|
|
34
36
|
if(http_parser_has_error(http)) {
|
|
35
|
-
rb_raise(
|
|
37
|
+
rb_raise(eHttpParserError, "Invalid HTTP format, parsing fails.");
|
|
36
38
|
} else {
|
|
37
39
|
return INT2FIX(http_parser_nread(http));
|
|
38
40
|
}
|
|
@@ -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::HttpParserError</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,13 +50,13 @@
|
|
|
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::HttpParserError</td>
|
|
54
54
|
</tr>
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../files/
|
|
59
|
-
|
|
58
|
+
<a href="../../files/ext/http11/http11_c.html">
|
|
59
|
+
ext/http11/http11.c
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
<tr class="top-aligned-row">
|
|
66
66
|
<td><strong>Parent:</strong></td>
|
|
67
67
|
<td>
|
|
68
|
-
|
|
68
|
+
IOError
|
|
69
69
|
</td>
|
|
70
70
|
</tr>
|
|
71
71
|
</table>
|
|
@@ -78,12 +78,6 @@
|
|
|
78
78
|
|
|
79
79
|
<div id="contextContent">
|
|
80
80
|
|
|
81
|
-
<div id="description">
|
|
82
|
-
<p>
|
|
83
|
-
Used to stop the <a href="HttpServer.html">HttpServer</a> via Thread.raise.
|
|
84
|
-
</p>
|
|
85
|
-
|
|
86
|
-
</div>
|
|
87
81
|
|
|
88
82
|
|
|
89
83
|
</div>
|
|
@@ -5,16 +5,24 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>new (Mongrel::HttpRequest)</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 152</span>
|
|
14
|
+
152: <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
|
+
153: <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
|
+
154: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
|
17
|
+
155: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
18
|
+
156:
|
|
19
|
+
157: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
|
|
20
|
+
158: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
|
|
21
|
+
159: <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">CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
|
|
22
|
+
160: <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>
|
|
23
|
+
161: <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>)
|
|
24
|
+
162: <span class="ruby-keyword kw">end</span>
|
|
25
|
+
163:
|
|
26
|
+
164: <span class="ruby-keyword kw">end</span></pre>
|
|
19
27
|
</body>
|
|
20
28
|
</html>
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>escape (Mongrel::HttpRequest)</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 166</span>
|
|
14
|
+
166: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
|
|
15
|
+
167: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {
|
|
16
|
+
168: <span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>
|
|
17
|
+
169: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
|
|
18
|
+
170: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -5,28 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>unescape (Mongrel::HttpRequest)</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
|
-
183: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
|
|
20
|
-
184: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>
|
|
21
|
-
185: <span class="ruby-keyword kw">else</span>
|
|
22
|
-
186: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = [<span class="ruby-identifier">cur</span>, <span class="ruby-identifier">v</span>]
|
|
23
|
-
187: <span class="ruby-keyword kw">end</span>
|
|
24
|
-
188: <span class="ruby-keyword kw">else</span>
|
|
25
|
-
189: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
26
|
-
190: <span class="ruby-keyword kw">end</span>
|
|
27
|
-
191: }
|
|
28
|
-
192:
|
|
29
|
-
193: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>
|
|
30
|
-
194: <span class="ruby-keyword kw">end</span></pre>
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 173</span>
|
|
14
|
+
173: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>)
|
|
15
|
+
174: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'+'</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/((?:%[0-9a-fA-F]{2})+)/n</span>){
|
|
16
|
+
175: [<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'%'</span>)].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">'H*'</span>)
|
|
17
|
+
176: }
|
|
18
|
+
177: <span class="ruby-keyword kw">end</span></pre>
|
|
31
19
|
</body>
|
|
32
20
|
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
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>query_parse (Mongrel::HttpRequest)</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 180</span>
|
|
14
|
+
180: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query_parse</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-value str">'&;'</span>)
|
|
15
|
+
181: <span class="ruby-identifier">params</span> = {}
|
|
16
|
+
182: (<span class="ruby-identifier">qs</span><span class="ruby-operator">||</span><span class="ruby-value str">''</span>).<span class="ruby-identifier">split</span>(<span class="ruby-node">/[#{d}] */n</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">params</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
|
17
|
+
183: <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>=<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'='</span>,<span class="ruby-value">2</span>)
|
|
18
|
+
184: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>]
|
|
19
|
+
185: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
|
|
20
|
+
186: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>
|
|
21
|
+
187: <span class="ruby-keyword kw">else</span>
|
|
22
|
+
188: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = [<span class="ruby-identifier">cur</span>, <span class="ruby-identifier">v</span>]
|
|
23
|
+
189: <span class="ruby-keyword kw">end</span>
|
|
24
|
+
190: <span class="ruby-keyword kw">else</span>
|
|
25
|
+
191: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
26
|
+
192: <span class="ruby-keyword kw">end</span>
|
|
27
|
+
193: }
|
|
28
|
+
194:
|
|
29
|
+
195: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>
|
|
30
|
+
196: <span class="ruby-keyword kw">end</span></pre>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -10,17 +10,17 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 262</span>
|
|
14
|
+
262: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>, <span class="ruby-identifier">filter</span> = <span class="ruby-keyword kw">nil</span>)
|
|
15
|
+
263: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
16
|
+
264: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
265: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
|
18
|
+
266: <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
|
+
267: <span class="ruby-ivar">@header</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE</span>] = <span class="ruby-constant">HttpServer</span>.<span class="ruby-identifier">httpdate</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
|
20
|
+
268: <span class="ruby-ivar">@filter</span> = <span class="ruby-identifier">filter</span>
|
|
21
|
+
269: <span class="ruby-ivar">@body_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
22
|
+
270: <span class="ruby-ivar">@header_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
23
|
+
271: <span class="ruby-ivar">@status_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
24
|
+
272: <span class="ruby-keyword kw">end</span></pre>
|
|
25
25
|
</body>
|
|
26
26
|
</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 282</span>
|
|
14
|
+
282: <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>, <span class="ruby-identifier">finalize</span>=<span class="ruby-keyword kw">false</span>)
|
|
15
|
+
283: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
|
|
16
|
+
284: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
|
|
17
|
+
285: <span class="ruby-identifier">finished</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">finalize</span>
|
|
18
|
+
286: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -10,16 +10,16 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 291</span>
|
|
14
|
+
291: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
|
15
|
+
292: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body_sent</span>
|
|
16
|
+
293: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"You have already sent the request body."</span>
|
|
17
|
+
294: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@header_sent</span>
|
|
18
|
+
295: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"You have already sent the request headers."</span>
|
|
19
|
+
296: <span class="ruby-keyword kw">else</span>
|
|
20
|
+
297: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
21
|
+
298: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
22
|
+
299: <span class="ruby-keyword kw">end</span>
|
|
23
|
+
300: <span class="ruby-keyword kw">end</span></pre>
|
|
24
24
|
</body>
|
|
25
25
|
</html>
|
|
@@ -10,13 +10,13 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 302</span>
|
|
14
|
+
302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>(<span class="ruby-identifier">content_length</span>=<span class="ruby-keyword kw">nil</span>)
|
|
15
|
+
303: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status_sent</span>
|
|
16
|
+
304: <span class="ruby-identifier">content_length</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span>
|
|
17
|
+
305: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">STATUS_FORMAT</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">status</span>, <span class="ruby-constant">HTTP_STATUS_CODES</span>[<span class="ruby-ivar">@status</span>], <span class="ruby-identifier">content_length</span>])
|
|
18
|
+
306: <span class="ruby-ivar">@status_sent</span> = <span class="ruby-keyword kw">true</span>
|
|
19
|
+
307: <span class="ruby-keyword kw">end</span>
|
|
20
|
+
308: <span class="ruby-keyword kw">end</span></pre>
|
|
21
21
|
</body>
|
|
22
22
|
</html>
|
|
@@ -10,13 +10,13 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 310</span>
|
|
14
|
+
310: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
|
|
15
|
+
311: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@header_sent</span>
|
|
16
|
+
312: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
|
|
17
|
+
313: <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> <span class="ruby-operator">+</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">LINE_END</span>)
|
|
18
|
+
314: <span class="ruby-ivar">@header_sent</span> = <span class="ruby-keyword kw">true</span>
|
|
19
|
+
315: <span class="ruby-keyword kw">end</span>
|
|
20
|
+
316: <span class="ruby-keyword kw">end</span></pre>
|
|
21
21
|
</body>
|
|
22
22
|
</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 318</span>
|
|
14
|
+
318: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
|
|
15
|
+
319: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@body_sent</span>
|
|
16
|
+
320: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
|
|
17
|
+
321: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
|
|
18
|
+
322: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
|
|
19
|
+
323: <span class="ruby-ivar">@body_sent</span> = <span class="ruby-keyword kw">true</span>
|
|
20
|
+
324: <span class="ruby-keyword kw">end</span>
|
|
21
|
+
325: <span class="ruby-keyword kw">end</span></pre>
|
|
22
22
|
</body>
|
|
23
23
|
</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 327</span>
|
|
14
|
+
327: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">data</span>)
|
|
15
|
+
328: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">data</span>)
|
|
16
|
+
329: <span class="ruby-keyword kw">end</span></pre>
|
|
17
17
|
</body>
|
|
18
18
|
</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 333</span>
|
|
14
|
+
333: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
|
|
15
|
+
334: <span class="ruby-identifier">send_status</span>
|
|
16
|
+
335: <span class="ruby-identifier">send_header</span>
|
|
17
|
+
336: <span class="ruby-identifier">send_body</span>
|
|
18
|
+
337: <span class="ruby-keyword kw">end</span></pre>
|
|
19
19
|
</body>
|
|
20
20
|
</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 339</span>
|
|
14
|
+
339: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">done</span>
|
|
15
|
+
340: (<span class="ruby-ivar">@status_sent</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@header_sent</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@body_sent</span>)
|
|
16
|
+
341: <span class="ruby-keyword kw">end</span></pre>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -10,15 +10,15 @@
|
|
|
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
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 382</span>
|
|
14
|
+
382: <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">2</span><span class="ruby-operator">**</span><span class="ruby-value">30</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>), <span class="ruby-identifier">timeout</span>=<span class="ruby-value">0</span>)
|
|
15
|
+
383: <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
|
+
384: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
385: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
|
18
|
+
386: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
|
19
|
+
387: <span class="ruby-ivar">@workers</span> = <span class="ruby-constant">ThreadGroup</span>.<span class="ruby-identifier">new</span>
|
|
20
|
+
388: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
|
|
21
|
+
389: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
|
|
22
|
+
390: <span class="ruby-keyword kw">end</span></pre>
|
|
23
23
|
</body>
|
|
24
24
|
</html>
|
|
@@ -10,56 +10,57 @@
|
|
|
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
|
-
400:
|
|
19
|
-
401: <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>)
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 398</span>
|
|
14
|
+
398: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
|
15
|
+
399: <span class="ruby-keyword kw">begin</span>
|
|
16
|
+
400: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
401: <span class="ruby-identifier">params</span> = {}
|
|
20
18
|
402:
|
|
21
|
-
403: <span class="ruby-
|
|
22
|
-
404:
|
|
23
|
-
405:
|
|
24
|
-
406: <span class="ruby-
|
|
25
|
-
407:
|
|
26
|
-
408:
|
|
27
|
-
409: <span class="ruby-
|
|
28
|
-
410:
|
|
29
|
-
411:
|
|
30
|
-
412:
|
|
31
|
-
413: <span class="ruby-identifier">
|
|
32
|
-
414: <span class="ruby-identifier">
|
|
33
|
-
415:
|
|
34
|
-
416: <span class="ruby-identifier">
|
|
35
|
-
417:
|
|
36
|
-
418:
|
|
37
|
-
419:
|
|
38
|
-
420:
|
|
39
|
-
421: <span class="ruby-keyword kw">
|
|
40
|
-
422:
|
|
41
|
-
423: <span class="ruby-keyword kw">
|
|
42
|
-
424:
|
|
43
|
-
425:
|
|
44
|
-
426:
|
|
45
|
-
427: <span class="ruby-keyword kw">
|
|
46
|
-
428:
|
|
47
|
-
429: <span class="ruby-keyword kw">
|
|
48
|
-
430:
|
|
49
|
-
431: <span class="ruby-comment cmt">#
|
|
50
|
-
432:
|
|
51
|
-
433: <span class="ruby-
|
|
52
|
-
434: <span class="ruby-
|
|
53
|
-
435:
|
|
54
|
-
436:
|
|
55
|
-
437:
|
|
56
|
-
438: <span class="ruby-
|
|
57
|
-
439: <span class="ruby-keyword kw">rescue</span>
|
|
58
|
-
440: <span class="ruby-
|
|
59
|
-
441:
|
|
60
|
-
442:
|
|
61
|
-
443:
|
|
62
|
-
444:
|
|
63
|
-
445:
|
|
19
|
+
403: <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>)
|
|
20
|
+
404:
|
|
21
|
+
405: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
|
22
|
+
406: <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>)
|
|
23
|
+
407:
|
|
24
|
+
408: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
|
25
|
+
409: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handlers</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>])
|
|
26
|
+
410:
|
|
27
|
+
411: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handlers</span>
|
|
28
|
+
412: <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>
|
|
29
|
+
413: <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>
|
|
30
|
+
414: <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">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_X_FORWARDED_FOR</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">peeraddr</span>.<span class="ruby-identifier">last</span>
|
|
31
|
+
415: <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>)
|
|
32
|
+
416: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
|
33
|
+
417:
|
|
34
|
+
418: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
|
|
35
|
+
419: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
|
36
|
+
420: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span>
|
|
37
|
+
421: <span class="ruby-keyword kw">end</span>
|
|
38
|
+
422:
|
|
39
|
+
423: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span>
|
|
40
|
+
424: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">finished</span>
|
|
41
|
+
425: <span class="ruby-keyword kw">end</span>
|
|
42
|
+
426:
|
|
43
|
+
427: <span class="ruby-keyword kw">else</span>
|
|
44
|
+
428: <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>)
|
|
45
|
+
429: <span class="ruby-keyword kw">end</span>
|
|
46
|
+
430:
|
|
47
|
+
431: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
|
48
|
+
432: <span class="ruby-keyword kw">else</span>
|
|
49
|
+
433: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
|
50
|
+
434: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
|
51
|
+
435: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
|
52
|
+
436: <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>)
|
|
53
|
+
437: <span class="ruby-keyword kw">end</span>
|
|
54
|
+
438: <span class="ruby-keyword kw">end</span>
|
|
55
|
+
439: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EINVAL</span>
|
|
56
|
+
440: <span class="ruby-comment cmt"># ignored</span>
|
|
57
|
+
441: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpParserError</span>
|
|
58
|
+
442: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"BAD CLIENT: #$!"</span>
|
|
59
|
+
443: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
|
60
|
+
444: <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>)
|
|
61
|
+
445: <span class="ruby-keyword kw">ensure</span>
|
|
62
|
+
446: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
|
63
|
+
447: <span class="ruby-keyword kw">end</span>
|
|
64
|
+
448: <span class="ruby-keyword kw">end</span></pre>
|
|
64
65
|
</body>
|
|
65
66
|
</html>
|