mongrel 0.2.2 → 0.3

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.
Files changed (68) hide show
  1. data/README +27 -25
  2. data/Rakefile +2 -3
  3. data/bin/mongrel_rails +114 -0
  4. data/doc/rdoc/classes/Mongrel.html +30 -0
  5. data/doc/rdoc/classes/Mongrel.src/M000001.html +18 -0
  6. data/doc/rdoc/classes/Mongrel/Const.html +2 -2
  7. data/doc/rdoc/classes/Mongrel/DirHandler.html +84 -21
  8. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000009.html +7 -18
  9. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000010.html +26 -9
  10. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000011.html +27 -26
  11. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000012.html +31 -0
  12. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000013.html +38 -0
  13. data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
  14. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000028.html → M000033.html} +4 -4
  15. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000029.html → M000034.html} +4 -4
  16. data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
  17. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000017.html → M000019.html} +4 -4
  18. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000018.html → M000020.html} +7 -7
  19. data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -5
  20. data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000023.html → M000025.html} +3 -3
  21. data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
  22. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000002.html +5 -6
  23. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000003.html +7 -7
  24. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html +8 -20
  25. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000005.html +20 -6
  26. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000006.html +5 -5
  27. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000007.html +5 -6
  28. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000001.html → M000008.html} +6 -6
  29. data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
  30. data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000030.html → M000035.html} +17 -17
  31. data/doc/rdoc/classes/Mongrel/HttpResponse.html +66 -21
  32. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000026.html +8 -6
  33. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000027.html +7 -12
  34. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000028.html +19 -0
  35. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000029.html +18 -0
  36. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000030.html +20 -0
  37. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000031.html +21 -0
  38. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000032.html +20 -0
  39. data/doc/rdoc/classes/Mongrel/HttpServer.html +28 -28
  40. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000014.html +18 -10
  41. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000015.html +51 -5
  42. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000016.html +9 -4
  43. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000017.html +18 -0
  44. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000018.html +18 -0
  45. data/doc/rdoc/classes/Mongrel/URIClassifier.html +31 -21
  46. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000021.html +18 -15
  47. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000022.html +25 -42
  48. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000023.html +36 -0
  49. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000024.html +84 -0
  50. data/doc/rdoc/created.rid +1 -1
  51. data/doc/rdoc/files/README.html +32 -42
  52. data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
  53. data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
  54. data/doc/rdoc/fr_method_index.html +35 -30
  55. data/examples/simpletest.rb +16 -6
  56. data/ext/http11/http11.c +19 -3
  57. data/ext/http11/tst_search.c +2 -3
  58. data/lib/mongrel.rb +108 -20
  59. data/test/test_uriclassifier.rb +22 -1
  60. metadata +25 -19
  61. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000008.html +0 -20
  62. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000024.html +0 -21
  63. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000025.html +0 -20
  64. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +0 -31
  65. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000013.html +0 -64
  66. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000019.html +0 -39
  67. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000020.html +0 -51
  68. data/lib/#mongrel.rb# +0 -493
@@ -5,15 +5,17 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>reset (Mongrel::HttpResponse)</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 237</span>
14
- 237: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
- 238: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 239: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
- 240: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 220</span>
14
+ 220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
+ 221: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
+ 222: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
+ 223: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
+ 224: <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
+ 225: <span class="ruby-keyword kw">end</span></pre>
18
20
  </body>
19
21
  </html>
@@ -5,21 +5,16 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>finished (Mongrel::HttpResponse)</title>
8
+ <title>start (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 244</span>
14
- 244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
- 245: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 246: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
- 247:
18
- 248: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
19
- 249: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status]}\r\nContent-Length: #{@body.length}\r\nConnection: close\r\n&quot;</span>)
20
- 250: <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>)
21
- 251: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
22
- 252: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
23
- 253: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 231</span>
14
+ 231: <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
+ 232: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
16
+ 233: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
+ 234: <span class="ruby-identifier">finished</span>
18
+ 235: <span class="ruby-keyword kw">end</span></pre>
24
19
  </body>
25
20
  </html>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>reset (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 239</span>
14
+ 239: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
+ 240: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 241: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
+ 242: <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,18 @@
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>send_status (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 244</span>
14
+ 244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
15
+ 245: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status]}\r\nContent-Length: #{@body.length}\r\nConnection: close\r\n&quot;</span>)
16
+ 246: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </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>send_header (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 248</span>
14
+ 248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
15
+ 249: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 250: <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
+ 251: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
18
+ 252: <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,21 @@
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>send_body (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 254</span>
14
+ 254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
15
+ 255: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
16
+ 256:
17
+ 257: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
18
+ 258: <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
+ 259: <span class="ruby-keyword kw">end</span></pre>
20
+ </body>
21
+ </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 263</span>
14
+ 263: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
+ 264: <span class="ruby-identifier">send_status</span>
16
+ 265: <span class="ruby-identifier">send_header</span>
17
+ 266: <span class="ruby-identifier">send_body</span>
18
+ 267: <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&#8217;s a very simple class that just has a
87
87
  thread accepting connections and a simple <a
88
- href="HttpServer.html#M000013">HttpServer.process_client</a> function to do
88
+ href="HttpServer.html#M000015">HttpServer.process_client</a> function to do
89
89
  the heavy lifting with the IO and Ruby.
90
90
  </p>
91
91
  <p>
@@ -119,11 +119,11 @@ finally useful.
119
119
  <h3 class="section-bar">Methods</h3>
120
120
 
121
121
  <div class="name-list">
122
- <a href="#M000012">new</a>&nbsp;&nbsp;
123
- <a href="#M000013">process_client</a>&nbsp;&nbsp;
124
- <a href="#M000015">register</a>&nbsp;&nbsp;
125
- <a href="#M000014">run</a>&nbsp;&nbsp;
126
- <a href="#M000016">unregister</a>&nbsp;&nbsp;
122
+ <a href="#M000014">new</a>&nbsp;&nbsp;
123
+ <a href="#M000015">process_client</a>&nbsp;&nbsp;
124
+ <a href="#M000017">register</a>&nbsp;&nbsp;
125
+ <a href="#M000016">run</a>&nbsp;&nbsp;
126
+ <a href="#M000018">unregister</a>&nbsp;&nbsp;
127
127
  </div>
128
128
  </div>
129
129
 
@@ -158,12 +158,12 @@ finally useful.
158
158
  <div id="methods">
159
159
  <h3 class="section-bar">Public Class methods</h3>
160
160
 
161
- <div id="method-M000012" class="method-detail">
162
- <a name="M000012"></a>
161
+ <div id="method-M000014" class="method-detail">
162
+ <a name="M000014"></a>
163
163
 
164
164
  <div class="method-heading">
165
- <a href="HttpServer.src/M000012.html" target="Code" class="method-signature"
166
- onclick="popupCode('HttpServer.src/M000012.html');return false;">
165
+ <a href="HttpServer.src/M000014.html" target="Code" class="method-signature"
166
+ onclick="popupCode('HttpServer.src/M000014.html');return false;">
167
167
  <span class="method-name">new</span><span class="method-args">(host, port, num_processors=20)</span>
168
168
  </a>
169
169
  </div>
@@ -195,12 +195,12 @@ href="../Mongrel.html">Mongrel</a> will make this more dynamic (hopefully).
195
195
 
196
196
  <h3 class="section-bar">Public Instance methods</h3>
197
197
 
198
- <div id="method-M000013" class="method-detail">
199
- <a name="M000013"></a>
198
+ <div id="method-M000015" class="method-detail">
199
+ <a name="M000015"></a>
200
200
 
201
201
  <div class="method-heading">
202
- <a href="HttpServer.src/M000013.html" target="Code" class="method-signature"
203
- onclick="popupCode('HttpServer.src/M000013.html');return false;">
202
+ <a href="HttpServer.src/M000015.html" target="Code" class="method-signature"
203
+ onclick="popupCode('HttpServer.src/M000015.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-M000015" class="method-detail">
221
- <a name="M000015"></a>
220
+ <div id="method-M000017" class="method-detail">
221
+ <a name="M000017"></a>
222
222
 
223
223
  <div class="method-heading">
224
- <a href="HttpServer.src/M000015.html" target="Code" class="method-signature"
225
- onclick="popupCode('HttpServer.src/M000015.html');return false;">
224
+ <a href="HttpServer.src/M000017.html" target="Code" class="method-signature"
225
+ onclick="popupCode('HttpServer.src/M000017.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&#8217;s HttpHandler::process method
235
235
  is called. See <a
236
- href="URIClassifier.html#M000020">Mongrel::URIClassifier#register</a> for
236
+ href="URIClassifier.html#M000022">Mongrel::URIClassifier#register</a> for
237
237
  more information.
238
238
  </p>
239
239
  </div>
240
240
  </div>
241
241
 
242
- <div id="method-M000014" class="method-detail">
243
- <a name="M000014"></a>
242
+ <div id="method-M000016" class="method-detail">
243
+ <a name="M000016"></a>
244
244
 
245
245
  <div class="method-heading">
246
- <a href="HttpServer.src/M000014.html" target="Code" class="method-signature"
247
- onclick="popupCode('HttpServer.src/M000014.html');return false;">
246
+ <a href="HttpServer.src/M000016.html" target="Code" class="method-signature"
247
+ onclick="popupCode('HttpServer.src/M000016.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-M000016" class="method-detail">
262
- <a name="M000016"></a>
261
+ <div id="method-M000018" class="method-detail">
262
+ <a name="M000018"></a>
263
263
 
264
264
  <div class="method-heading">
265
- <a href="HttpServer.src/M000016.html" target="Code" class="method-signature"
266
- onclick="popupCode('HttpServer.src/M000016.html');return false;">
265
+ <a href="HttpServer.src/M000018.html" target="Code" class="method-signature"
266
+ onclick="popupCode('HttpServer.src/M000018.html');return false;">
267
267
  <span class="method-name">unregister</span><span class="method-args">(uri)</span>
268
268
  </a>
269
269
  </div>
@@ -271,7 +271,7 @@ later.
271
271
  <div class="method-description">
272
272
  <p>
273
273
  Removes any handler registered at the given URI. See <a
274
- href="URIClassifier.html#M000021">Mongrel::URIClassifier#unregister</a> for
274
+ href="URIClassifier.html#M000023">Mongrel::URIClassifier#unregister</a> for
275
275
  more information.
276
276
  </p>
277
277
  </div>
@@ -5,19 +5,27 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>run (Mongrel::HttpServer)</title>
8
+ <title>new (Mongrel::HttpServer)</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 378</span>
14
- 378: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
- 379: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
- 380: <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
- 381: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
18
- 382: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
19
- 383: <span class="ruby-keyword kw">end</span>
20
- 384: <span class="ruby-keyword kw">end</span>
21
- 385: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 317</span>
14
+ 317: <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
+ 318: <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
+ 319:
17
+ 320: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
+ 321: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
+ 322: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
+ 323: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
+ 324: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
22
+ 325:
23
+ 326: <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>
24
+ 327: <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>
25
+ 328: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
26
+ 329: <span class="ruby-keyword kw">end</span>
27
+ 330: <span class="ruby-keyword kw">end</span>
28
+ 331: }
29
+ 332: <span class="ruby-keyword kw">end</span></pre>
22
30
  </body>
23
31
  </html>
@@ -5,14 +5,60 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>register (Mongrel::HttpServer)</title>
8
+ <title>process_client (Mongrel::HttpServer)</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 391</span>
14
- 391: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
15
- 392: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
16
- 393: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 340</span>
14
+ 340: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
+ 341: <span class="ruby-keyword kw">begin</span>
16
+ 342: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
+ 343: <span class="ruby-identifier">params</span> = {}
18
+ 344: <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
+ 345:
20
+ 346: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
+ 347: <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
+ 348: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
+ 349: <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
+ 350:
25
+ 351: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
+ 352: <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
+ 353: <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
+ 354: <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
+ 355: <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
+ 356: <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
+ 357: <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
+ 358: <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
+ 359: <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
+ 360:
35
+ 361: <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
+ 362: <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
+ 363: <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
+ 364: <span class="ruby-keyword kw">else</span>
39
+ 365: <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
+ 366: <span class="ruby-keyword kw">end</span>
41
+ 367:
42
+ 368: <span class="ruby-keyword kw">break</span>
43
+ 369: <span class="ruby-keyword kw">else</span>
44
+ 370: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
45
+ 371: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
46
+ 372: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
47
+ 373: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</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
+ 374: <span class="ruby-keyword kw">end</span>
49
+ 375: <span class="ruby-keyword kw">end</span>
50
+ 376: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
51
+ 377: <span class="ruby-comment cmt"># ignored</span>
52
+ 378: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
53
+ 379: <span class="ruby-comment cmt"># ignored</span>
54
+ 380: <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
+ 381: <span class="ruby-comment cmt"># ignored</span>
56
+ 382: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
57
+ 383: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
58
+ 384: <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">&quot;\n&quot;</span>)
59
+ 385: <span class="ruby-keyword kw">ensure</span>
60
+ 386: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
61
+ 387: <span class="ruby-keyword kw">end</span>
62
+ 388: <span class="ruby-keyword kw">end</span></pre>
17
63
  </body>
18
64
  </html>
@@ -5,14 +5,19 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>unregister (Mongrel::HttpServer)</title>
8
+ <title>run (Mongrel::HttpServer)</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 397</span>
14
- 397: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
15
- 398: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 392</span>
14
+ 392: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
+ 393: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
+ 394: <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
+ 395: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
18
+ 396: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
19
+ 397: <span class="ruby-keyword kw">end</span>
20
+ 398: <span class="ruby-keyword kw">end</span>
16
21
  399: <span class="ruby-keyword kw">end</span></pre>
17
22
  </body>
18
23
  </html>
@@ -0,0 +1,18 @@
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>register (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 405</span>
14
+ 405: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
15
+ 406: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
16
+ 407: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
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>unregister (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 411</span>
14
+ 411: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
15
+ 412: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
16
+ 413: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>