mongrel 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -2
- data/Rakefile +1 -1
- data/doc/rdoc/classes/Mongrel.html +11 -1
- data/doc/rdoc/classes/Mongrel/Const.html +342 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.html +201 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000008.html +20 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000009.html +31 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000010.html +22 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000011.html +39 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000023.html → M000028.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000024.html → M000029.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +28 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000013.html → M000017.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000018.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000019.html → M000023.html} +3 -3
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000030.html +31 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +89 -15
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000020.html → M000024.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000021.html → M000025.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000026.html +19 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000022.html → M000027.html} +11 -11
- data/doc/rdoc/classes/Mongrel/HttpServer.html +32 -76
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +18 -5
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000013.html +64 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000010.html → M000014.html} +9 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000011.html → M000015.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000016.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +25 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000015.html → M000019.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000016.html → M000020.html} +3 -2
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000017.html → M000021.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000018.html → M000022.html} +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +14 -2
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
- data/doc/rdoc/fr_class_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +23 -18
- data/examples/simpletest.rb +2 -1
- data/ext/http11/http11.c +10 -9
- data/ext/http11/http11_parser.c +10 -10
- data/ext/http11/http11_parser.h +5 -1
- data/lib/#mongrel.rb# +493 -0
- data/lib/mongrel.rb +242 -48
- metadata +28 -19
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000014.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000025.html +0 -30
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +0 -26
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000009.html +0 -58
@@ -1,21 +0,0 @@
|
|
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>[]= (Mongrel::HeaderOut)</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 92</span>
|
14
|
-
92: <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
|
-
93: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>)
|
16
|
-
94: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">": "</span>)
|
17
|
-
95: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">value</span>)
|
18
|
-
96: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"\r\n"</span>)
|
19
|
-
97: <span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Mongrel::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 67</span>
|
14
|
-
67: <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
|
-
68: <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
|
-
69: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
17
|
-
70: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
18
|
-
71:
|
19
|
-
72: <span class="ruby-comment cmt"># fix up the CGI requirements</span>
|
20
|
-
73: <span class="ruby-identifier">params</span>[<span class="ruby-value str">'CONTENT_LENGTH'</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value str">'HTTP_CONTENT_LENGTH'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
21
|
-
74:
|
22
|
-
75: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
|
23
|
-
76: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
|
24
|
-
77: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value str">'HTTP_CONTENT_LENGTH'</span>].<span class="ruby-identifier">to_i</span>
|
25
|
-
78: <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>
|
26
|
-
79: <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>)
|
27
|
-
80: <span class="ruby-keyword kw">end</span>
|
28
|
-
81: <span class="ruby-keyword kw">end</span></pre>
|
29
|
-
</body>
|
30
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Mongrel::HttpServer)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 211</span>
|
14
|
-
211: <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>)
|
15
|
-
212: <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
|
-
213: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
17
|
-
214: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
|
18
|
-
215: <span class="ruby-identifier">num_processors</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
19
|
-
216: <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>
|
20
|
-
217: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
21
|
-
218: <span class="ruby-keyword kw">end</span>
|
22
|
-
219: <span class="ruby-keyword kw">end</span>
|
23
|
-
220: }
|
24
|
-
221: <span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,58 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>process_client (Mongrel::HttpServer)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 230</span>
|
14
|
-
230: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
15
|
-
231: <span class="ruby-keyword kw">begin</span>
|
16
|
-
232: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
17
|
-
233: <span class="ruby-identifier">params</span> = {}
|
18
|
-
234: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">CHUNK_SIZE</span>)
|
19
|
-
235:
|
20
|
-
236: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
21
|
-
237: <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
|
-
238: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
23
|
-
239: <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">PATH_INFO</span>])
|
24
|
-
240:
|
25
|
-
241: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
|
26
|
-
242: <span class="ruby-identifier">params</span>[<span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">path_info</span>
|
27
|
-
243: <span class="ruby-identifier">params</span>[<span class="ruby-constant">SCRIPT_NAME</span>] = <span class="ruby-identifier">script_name</span>
|
28
|
-
244:
|
29
|
-
245: <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>)
|
30
|
-
246: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
31
|
-
247: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
32
|
-
248: <span class="ruby-keyword kw">else</span>
|
33
|
-
249: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">ERROR_404_RESPONSE</span>)
|
34
|
-
250: <span class="ruby-keyword kw">end</span>
|
35
|
-
251:
|
36
|
-
252: <span class="ruby-keyword kw">break</span>
|
37
|
-
253: <span class="ruby-keyword kw">else</span>
|
38
|
-
254: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
|
39
|
-
255: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
|
40
|
-
256: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
|
41
|
-
257: <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">CHUNK_SIZE</span>)
|
42
|
-
258: <span class="ruby-keyword kw">end</span>
|
43
|
-
259: <span class="ruby-keyword kw">end</span>
|
44
|
-
260: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
45
|
-
261: <span class="ruby-comment cmt"># ignored</span>
|
46
|
-
262: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
|
47
|
-
263: <span class="ruby-comment cmt"># ignored</span>
|
48
|
-
264: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
|
49
|
-
265: <span class="ruby-comment cmt"># ignored</span>
|
50
|
-
266: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
51
|
-
267: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR(#{details.class}): #{details}"</span>
|
52
|
-
268: <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>)
|
53
|
-
269: <span class="ruby-keyword kw">ensure</span>
|
54
|
-
270: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
55
|
-
271: <span class="ruby-keyword kw">end</span>
|
56
|
-
272: <span class="ruby-keyword kw">end</span></pre>
|
57
|
-
</body>
|
58
|
-
</html>
|