mongrel 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/README +10 -2
  2. data/Rakefile +1 -1
  3. data/doc/rdoc/classes/Mongrel.html +11 -1
  4. data/doc/rdoc/classes/Mongrel/Const.html +342 -0
  5. data/doc/rdoc/classes/Mongrel/DirHandler.html +201 -0
  6. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000008.html +20 -0
  7. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000009.html +31 -0
  8. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000010.html +22 -0
  9. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000011.html +39 -0
  10. data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
  11. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000023.html → M000028.html} +4 -4
  12. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000024.html → M000029.html} +4 -4
  13. data/doc/rdoc/classes/Mongrel/HeaderOut.html +28 -10
  14. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000013.html → M000017.html} +4 -4
  15. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000018.html +21 -0
  16. data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -18
  17. data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000019.html → M000023.html} +3 -3
  18. data/doc/rdoc/classes/Mongrel/HttpRequest.html +8 -8
  19. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000030.html +31 -0
  20. data/doc/rdoc/classes/Mongrel/HttpResponse.html +89 -15
  21. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000020.html → M000024.html} +7 -7
  22. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000021.html → M000025.html} +6 -6
  23. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000026.html +19 -0
  24. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000022.html → M000027.html} +11 -11
  25. data/doc/rdoc/classes/Mongrel/HttpServer.html +32 -76
  26. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +18 -5
  27. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000013.html +64 -0
  28. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000010.html → M000014.html} +9 -8
  29. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000011.html → M000015.html} +4 -4
  30. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000016.html +18 -0
  31. data/doc/rdoc/classes/Mongrel/URIClassifier.html +25 -23
  32. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000015.html → M000019.html} +0 -0
  33. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000016.html → M000020.html} +3 -2
  34. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000017.html → M000021.html} +0 -0
  35. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000018.html → M000022.html} +1 -1
  36. data/doc/rdoc/created.rid +1 -1
  37. data/doc/rdoc/files/README.html +14 -2
  38. data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
  39. data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
  40. data/doc/rdoc/fr_class_index.html +2 -0
  41. data/doc/rdoc/fr_method_index.html +23 -18
  42. data/examples/simpletest.rb +2 -1
  43. data/ext/http11/http11.c +10 -9
  44. data/ext/http11/http11_parser.c +10 -10
  45. data/ext/http11/http11_parser.h +5 -1
  46. data/lib/#mongrel.rb# +493 -0
  47. data/lib/mongrel.rb +242 -48
  48. metadata +28 -19
  49. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000014.html +0 -21
  50. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000025.html +0 -30
  51. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +0 -26
  52. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000009.html +0 -58
@@ -10,12 +10,12 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 108</span>
14
- 108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
- 109: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
- 110: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
- 111: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
- 112: <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
- 113: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 218</span>
14
+ 218: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
+ 219: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
+ 220: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
+ 221: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
+ 222: <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
+ 223: <span class="ruby-keyword kw">end</span></pre>
20
20
  </body>
21
21
  </html>
@@ -10,11 +10,11 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 115</span>
14
- 115: <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
- 116: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
16
- 117: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
- 118: <span class="ruby-identifier">finished</span>
18
- 119: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 229</span>
14
+ 229: <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
+ 230: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
16
+ 231: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
+ 232: <span class="ruby-identifier">finished</span>
18
+ 233: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
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 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>
18
+ </body>
19
+ </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 121</span>
14
- 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
- 122: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 123: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
- 124:
18
- 125: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
19
- 126: <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
- 127: <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
- 128: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
22
- 129: <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
- 130: <span class="ruby-keyword kw">end</span></pre>
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>
24
24
  </body>
25
25
  </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#M000009">HttpServer.process_client</a> function to do
88
+ href="HttpServer.html#M000013">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="#M000008">new</a>&nbsp;&nbsp;
123
- <a href="#M000009">process_client</a>&nbsp;&nbsp;
124
- <a href="#M000011">register</a>&nbsp;&nbsp;
125
- <a href="#M000010">run</a>&nbsp;&nbsp;
126
- <a href="#M000012">unregister</a>&nbsp;&nbsp;
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;
127
127
  </div>
128
128
  </div>
129
129
 
@@ -135,50 +135,6 @@ finally useful.
135
135
  <div id="section">
136
136
 
137
137
 
138
- <div id="constants-list">
139
- <h3 class="section-bar">Constants</h3>
140
-
141
- <div class="name-list">
142
- <table summary="Constants">
143
- <tr class="top-aligned-row context-row">
144
- <td class="context-item-name">ERROR_404_RESPONSE</td>
145
- <td>=</td>
146
- <td class="context-item-value">&quot;HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Mongrel/0.2\r\n\r\nNOT FOUND&quot;</td>
147
- <td width="3em">&nbsp;</td>
148
- <td class="context-item-desc">
149
- The standard empty 404 response for bad requests. Use Error4040Handler for
150
- custom stuff.
151
-
152
- </td>
153
- </tr>
154
- <tr class="top-aligned-row context-row">
155
- <td class="context-item-name">ERROR_503_RESPONSE</td>
156
- <td>=</td>
157
- <td class="context-item-value">&quot;HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY&quot;</td>
158
- </tr>
159
- <tr class="top-aligned-row context-row">
160
- <td class="context-item-name">CHUNK_SIZE</td>
161
- <td>=</td>
162
- <td class="context-item-value">(16 * 1024)</td>
163
- <td width="3em">&nbsp;</td>
164
- <td class="context-item-desc">
165
- The basic max request size we&#8217;ll try to read.
166
-
167
- </td>
168
- </tr>
169
- <tr class="top-aligned-row context-row">
170
- <td class="context-item-name">PATH_INFO</td>
171
- <td>=</td>
172
- <td class="context-item-value">&quot;PATH_INFO&quot;</td>
173
- </tr>
174
- <tr class="top-aligned-row context-row">
175
- <td class="context-item-name">SCRIPT_NAME</td>
176
- <td>=</td>
177
- <td class="context-item-value">&quot;SCRIPT_NAME&quot;</td>
178
- </tr>
179
- </table>
180
- </div>
181
- </div>
182
138
 
183
139
 
184
140
 
@@ -202,12 +158,12 @@ The basic max request size we&#8217;ll try to read.
202
158
  <div id="methods">
203
159
  <h3 class="section-bar">Public Class methods</h3>
204
160
 
205
- <div id="method-M000008" class="method-detail">
206
- <a name="M000008"></a>
161
+ <div id="method-M000012" class="method-detail">
162
+ <a name="M000012"></a>
207
163
 
208
164
  <div class="method-heading">
209
- <a href="HttpServer.src/M000008.html" target="Code" class="method-signature"
210
- onclick="popupCode('HttpServer.src/M000008.html');return false;">
165
+ <a href="HttpServer.src/M000012.html" target="Code" class="method-signature"
166
+ onclick="popupCode('HttpServer.src/M000012.html');return false;">
211
167
  <span class="method-name">new</span><span class="method-args">(host, port, num_processors=20)</span>
212
168
  </a>
213
169
  </div>
@@ -239,12 +195,12 @@ href="../Mongrel.html">Mongrel</a> will make this more dynamic (hopefully).
239
195
 
240
196
  <h3 class="section-bar">Public Instance methods</h3>
241
197
 
242
- <div id="method-M000009" class="method-detail">
243
- <a name="M000009"></a>
198
+ <div id="method-M000013" class="method-detail">
199
+ <a name="M000013"></a>
244
200
 
245
201
  <div class="method-heading">
246
- <a href="HttpServer.src/M000009.html" target="Code" class="method-signature"
247
- onclick="popupCode('HttpServer.src/M000009.html');return false;">
202
+ <a href="HttpServer.src/M000013.html" target="Code" class="method-signature"
203
+ onclick="popupCode('HttpServer.src/M000013.html');return false;">
248
204
  <span class="method-name">process_client</span><span class="method-args">(client)</span>
249
205
  </a>
250
206
  </div>
@@ -253,20 +209,20 @@ href="../Mongrel.html">Mongrel</a> will make this more dynamic (hopefully).
253
209
  <p>
254
210
  Does the majority of the IO processing. It has been written in Ruby using
255
211
  about 7 different IO processing strategies and no matter how it&#8217;s
256
- done the performance just does not improve. Ruby&#8217;s use of select to
257
- implement threads means that it will most likely never improve, so the only
258
- remaining approach is to write all or some of this function in C. That will
259
- be the focus of future releases.
212
+ done the performance just does not improve. It is currently carefully
213
+ constructed to make sure that it gets the best possible performance, but
214
+ anyone who thinks they can make it faster is more than welcome to take a
215
+ crack at it.
260
216
  </p>
261
217
  </div>
262
218
  </div>
263
219
 
264
- <div id="method-M000011" class="method-detail">
265
- <a name="M000011"></a>
220
+ <div id="method-M000015" class="method-detail">
221
+ <a name="M000015"></a>
266
222
 
267
223
  <div class="method-heading">
268
- <a href="HttpServer.src/M000011.html" target="Code" class="method-signature"
269
- onclick="popupCode('HttpServer.src/M000011.html');return false;">
224
+ <a href="HttpServer.src/M000015.html" target="Code" class="method-signature"
225
+ onclick="popupCode('HttpServer.src/M000015.html');return false;">
270
226
  <span class="method-name">register</span><span class="method-args">(uri, handler)</span>
271
227
  </a>
272
228
  </div>
@@ -277,18 +233,18 @@ Simply registers a handler with the internal <a
277
233
  href="URIClassifier.html">URIClassifier</a>. When the URI is found in the
278
234
  prefix of a request then your handler&#8217;s HttpHandler::process method
279
235
  is called. See <a
280
- href="URIClassifier.html#M000016">Mongrel::URIClassifier#register</a> for
236
+ href="URIClassifier.html#M000020">Mongrel::URIClassifier#register</a> for
281
237
  more information.
282
238
  </p>
283
239
  </div>
284
240
  </div>
285
241
 
286
- <div id="method-M000010" class="method-detail">
287
- <a name="M000010"></a>
242
+ <div id="method-M000014" class="method-detail">
243
+ <a name="M000014"></a>
288
244
 
289
245
  <div class="method-heading">
290
- <a href="HttpServer.src/M000010.html" target="Code" class="method-signature"
291
- onclick="popupCode('HttpServer.src/M000010.html');return false;">
246
+ <a href="HttpServer.src/M000014.html" target="Code" class="method-signature"
247
+ onclick="popupCode('HttpServer.src/M000014.html');return false;">
292
248
  <span class="method-name">run</span><span class="method-args">()</span>
293
249
  </a>
294
250
  </div>
@@ -302,12 +258,12 @@ later.
302
258
  </div>
303
259
  </div>
304
260
 
305
- <div id="method-M000012" class="method-detail">
306
- <a name="M000012"></a>
261
+ <div id="method-M000016" class="method-detail">
262
+ <a name="M000016"></a>
307
263
 
308
264
  <div class="method-heading">
309
- <a href="HttpServer.src/M000012.html" target="Code" class="method-signature"
310
- onclick="popupCode('HttpServer.src/M000012.html');return false;">
265
+ <a href="HttpServer.src/M000016.html" target="Code" class="method-signature"
266
+ onclick="popupCode('HttpServer.src/M000016.html');return false;">
311
267
  <span class="method-name">unregister</span><span class="method-args">(uri)</span>
312
268
  </a>
313
269
  </div>
@@ -315,7 +271,7 @@ later.
315
271
  <div class="method-description">
316
272
  <p>
317
273
  Removes any handler registered at the given URI. See <a
318
- href="URIClassifier.html#M000017">Mongrel::URIClassifier#unregister</a> for
274
+ href="URIClassifier.html#M000021">Mongrel::URIClassifier#unregister</a> for
319
275
  more information.
320
276
  </p>
321
277
  </div>
@@ -5,14 +5,27 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>unregister (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 294</span>
14
- 294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
15
- 295: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
16
- 296: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 303</span>
14
+ 303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">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
+ 304: <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
+ 305:
17
+ 306: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
+ 307: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
+ 308: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
+ 309: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
+ 310: <span class="ruby-ivar">@num_procesors</span> = <span class="ruby-identifier">num_processors</span>
22
+ 311:
23
+ 312: <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>
24
+ 313: <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
+ 314: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
26
+ 315: <span class="ruby-keyword kw">end</span>
27
+ 316: <span class="ruby-keyword kw">end</span>
28
+ 317: }
29
+ 318: <span class="ruby-keyword kw">end</span></pre>
17
30
  </body>
18
31
  </html>
@@ -0,0 +1,64 @@
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 326</span>
14
+ 326: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
+ 327: <span class="ruby-keyword kw">begin</span>
16
+ 328: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
+ 329: <span class="ruby-identifier">params</span> = {}
18
+ 330: <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
+ 331:
20
+ 332: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
+ 333: <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
+ 334: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
+ 335: <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
+ 336:
25
+ 337: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
+ 338: <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
+ 339: <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
+ 340: <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
+ 341: <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>
30
+ 342: <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
+ 343: <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
+ 344: <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
+ 345: <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
+ 346:
35
+ 347: <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
+ 348: <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
+ 349: <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
+ 350: <span class="ruby-keyword kw">else</span>
39
+ 351: <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
+ 352: <span class="ruby-keyword kw">end</span>
41
+ 353:
42
+ 354: <span class="ruby-keyword kw">break</span>
43
+ 355: <span class="ruby-keyword kw">else</span>
44
+ 356: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
45
+ 357: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
46
+ 358: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
47
+ 359: <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
+ 360: <span class="ruby-keyword kw">end</span>
49
+ 361: <span class="ruby-keyword kw">end</span>
50
+ 362: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
51
+ 363: <span class="ruby-comment cmt"># ignored</span>
52
+ 364: <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
+ 365: <span class="ruby-comment cmt"># ignored</span>
54
+ 366: <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
+ 367: <span class="ruby-comment cmt"># ignored</span>
56
+ 368: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
57
+ 369: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
58
+ 370: <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
+ 371: <span class="ruby-keyword kw">ensure</span>
60
+ 372: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
61
+ 373: <span class="ruby-keyword kw">end</span>
62
+ 374: <span class="ruby-keyword kw">end</span></pre>
63
+ </body>
64
+ </html>
@@ -10,13 +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 276</span>
14
- 276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
- 277: <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>
16
- 278: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
17
- 279: <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>
18
- 280: <span class="ruby-keyword kw">end</span>
19
- 281: <span class="ruby-keyword kw">end</span>
20
- 282: <span class="ruby-keyword kw">end</span></pre>
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>
21
22
  </body>
22
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 288</span>
14
- 288: <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
- 289: <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
- 290: <span class="ruby-keyword kw">end</span></pre>
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>
17
17
  </body>
18
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 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>)
16
+ 399: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -86,10 +86,10 @@
86
86
  <h3 class="section-bar">Methods</h3>
87
87
 
88
88
  <div class="name-list">
89
- <a href="#M000015">new</a>&nbsp;&nbsp;
90
- <a href="#M000016">register</a>&nbsp;&nbsp;
91
- <a href="#M000018">resolve</a>&nbsp;&nbsp;
92
- <a href="#M000017">unregister</a>&nbsp;&nbsp;
89
+ <a href="#M000019">new</a>&nbsp;&nbsp;
90
+ <a href="#M000020">register</a>&nbsp;&nbsp;
91
+ <a href="#M000022">resolve</a>&nbsp;&nbsp;
92
+ <a href="#M000021">unregister</a>&nbsp;&nbsp;
93
93
  </div>
94
94
  </div>
95
95
 
@@ -111,12 +111,12 @@
111
111
  <div id="methods">
112
112
  <h3 class="section-bar">Public Class methods</h3>
113
113
 
114
- <div id="method-M000015" class="method-detail">
115
- <a name="M000015"></a>
114
+ <div id="method-M000019" class="method-detail">
115
+ <a name="M000019"></a>
116
116
 
117
117
  <div class="method-heading">
118
- <a href="URIClassifier.src/M000015.html" target="Code" class="method-signature"
119
- onclick="popupCode('URIClassifier.src/M000015.html');return false;">
118
+ <a href="URIClassifier.src/M000019.html" target="Code" class="method-signature"
119
+ onclick="popupCode('URIClassifier.src/M000019.html');return false;">
120
120
  <span class="method-name">URIClassifier.new &rarr; URIClassifier<br />
121
121
  </span>
122
122
  </a>
@@ -143,12 +143,12 @@ portion.
143
143
 
144
144
  <h3 class="section-bar">Public Instance methods</h3>
145
145
 
146
- <div id="method-M000016" class="method-detail">
147
- <a name="M000016"></a>
146
+ <div id="method-M000020" class="method-detail">
147
+ <a name="M000020"></a>
148
148
 
149
149
  <div class="method-heading">
150
- <a href="URIClassifier.src/M000016.html" target="Code" class="method-signature"
151
- onclick="popupCode('URIClassifier.src/M000016.html');return false;">
150
+ <a href="URIClassifier.src/M000020.html" target="Code" class="method-signature"
151
+ onclick="popupCode('URIClassifier.src/M000020.html');return false;">
152
152
  <span class="method-name">uc.register("/someuri", SampleHandler.new) &rarr; nil<br />
153
153
  </span>
154
154
  </a>
@@ -159,8 +159,9 @@ portion.
159
159
  Registers the SampleHandler (one for all requests) with the
160
160
  &quot;/someuri&quot;. When URIClassifier::resolve is called with
161
161
  &quot;/someuri&quot; it&#8217;ll return SampleHandler immediately. When
162
- &quot;/someuri/pathhere&quot; is called it&#8217;ll find SomeHandler after
163
- a second search, and setup PATH_INFO=&quot;/pathhere&quot;.
162
+ called with &quot;/someuri/iwant&quot; it&#8217;ll also return SomeHandler
163
+ immediatly, with no additional searches, but it will return path info with
164
+ &quot;/iwant&quot;.
164
165
  </p>
165
166
  <p>
166
167
  You actually can reuse this class to register nearly anything and quickly
@@ -172,12 +173,12 @@ to get right with a Hash.
172
173
  </div>
173
174
  </div>
174
175
 
175
- <div id="method-M000018" class="method-detail">
176
- <a name="M000018"></a>
176
+ <div id="method-M000022" class="method-detail">
177
+ <a name="M000022"></a>
177
178
 
178
179
  <div class="method-heading">
179
- <a href="URIClassifier.src/M000018.html" target="Code" class="method-signature"
180
- onclick="popupCode('URIClassifier.src/M000018.html');return false;">
180
+ <a href="URIClassifier.src/M000022.html" target="Code" class="method-signature"
181
+ onclick="popupCode('URIClassifier.src/M000022.html');return false;">
181
182
  <span class="method-name">uc.resolve("/someuri") &rarr; "/someuri", "", handler<br />
182
183
  uc.resolve("/someuri/pathinfo") &rarr; "/someuri", "/pathinfo", handler<br />
183
184
  uc.resolve("/notfound/orhere") &rarr; nil, nil, nil<br />
@@ -208,17 +209,18 @@ chars, anything really. It also means that it&#8217;s very efficient to do
208
209
  this only taking as long as the URI has characters.
209
210
  </p>
210
211
  <p>
211
- It expects strings. Don&#8216;t try other string-line stuff yet.
212
+ It expects strings with no embedded &#8217;\0&#8217; characters.
213
+ Don&#8216;t try other string-line stuff yet.
212
214
  </p>
213
215
  </div>
214
216
  </div>
215
217
 
216
- <div id="method-M000017" class="method-detail">
217
- <a name="M000017"></a>
218
+ <div id="method-M000021" class="method-detail">
219
+ <a name="M000021"></a>
218
220
 
219
221
  <div class="method-heading">
220
- <a href="URIClassifier.src/M000017.html" target="Code" class="method-signature"
221
- onclick="popupCode('URIClassifier.src/M000017.html');return false;">
222
+ <a href="URIClassifier.src/M000021.html" target="Code" class="method-signature"
223
+ onclick="popupCode('URIClassifier.src/M000021.html');return false;">
222
224
  <span class="method-name">uc.unregister("/someuri")<br />
223
225
  </span>
224
226
  </a>