mongrel 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ end
30
30
 
31
31
  setup_extension("http11", "http11")
32
32
 
33
- version="0.3.4"
33
+ version="0.3.5"
34
34
  summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
35
35
  test_file = "test/test_ws.rb"
36
36
  author="Zed A. Shaw"
@@ -97,14 +97,15 @@ so I need testers to help work out the various corner cases.
97
97
  <h3 class="section-bar">Methods</h3>
98
98
 
99
99
  <div class="name-list">
100
- <a href="#M000051">args</a>&nbsp;&nbsp;
101
- <a href="#M000052">env_table</a>&nbsp;&nbsp;
100
+ <a href="#M000052">args</a>&nbsp;&nbsp;
101
+ <a href="#M000053">env_table</a>&nbsp;&nbsp;
102
102
  <a href="#M000048">header</a>&nbsp;&nbsp;
103
103
  <a href="#M000047">new</a>&nbsp;&nbsp;
104
- <a href="#M000049">out</a>&nbsp;&nbsp;
105
- <a href="#M000050">status</a>&nbsp;&nbsp;
106
- <a href="#M000053">stdinput</a>&nbsp;&nbsp;
107
- <a href="#M000054">stdoutput</a>&nbsp;&nbsp;
104
+ <a href="#M000050">out</a>&nbsp;&nbsp;
105
+ <a href="#M000049">send_cookies</a>&nbsp;&nbsp;
106
+ <a href="#M000051">status</a>&nbsp;&nbsp;
107
+ <a href="#M000054">stdinput</a>&nbsp;&nbsp;
108
+ <a href="#M000055">stdoutput</a>&nbsp;&nbsp;
108
109
  </div>
109
110
  </div>
110
111
 
@@ -116,6 +117,25 @@ so I need testers to help work out the various corner cases.
116
117
  <div id="section">
117
118
 
118
119
 
120
+ <div id="constants-list">
121
+ <h3 class="section-bar">Constants</h3>
122
+
123
+ <div class="name-list">
124
+ <table summary="Constants">
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">REMOVED_KEYS</td>
127
+ <td>=</td>
128
+ <td class="context-item-value">[ &quot;nph&quot;,&quot;status&quot;,&quot;server&quot;,&quot;connection&quot;,&quot;type&quot;, &quot;charset&quot;,&quot;length&quot;,&quot;language&quot;,&quot;expires&quot;]</td>
129
+ <td width="3em">&nbsp;</td>
130
+ <td class="context-item-desc">
131
+ these are stripped out of any keys passed to <a
132
+ href="CGIWrapper.html#M000048">CGIWrapper.header</a> function
133
+
134
+ </td>
135
+ </tr>
136
+ </table>
137
+ </div>
138
+ </div>
119
139
 
120
140
 
121
141
 
@@ -155,12 +175,12 @@ so I need testers to help work out the various corner cases.
155
175
 
156
176
  <h3 class="section-bar">Public Instance methods</h3>
157
177
 
158
- <div id="method-M000051" class="method-detail">
159
- <a name="M000051"></a>
178
+ <div id="method-M000052" class="method-detail">
179
+ <a name="M000052"></a>
160
180
 
161
181
  <div class="method-heading">
162
- <a href="CGIWrapper.src/M000051.html" target="Code" class="method-signature"
163
- onclick="popupCode('CGIWrapper.src/M000051.html');return false;">
182
+ <a href="CGIWrapper.src/M000052.html" target="Code" class="method-signature"
183
+ onclick="popupCode('CGIWrapper.src/M000052.html');return false;">
164
184
  <span class="method-name">args</span><span class="method-args">()</span>
165
185
  </a>
166
186
  </div>
@@ -172,19 +192,19 @@ Used to wrap the normal args variable used inside CGI.
172
192
  </div>
173
193
  </div>
174
194
 
175
- <div id="method-M000052" class="method-detail">
176
- <a name="M000052"></a>
195
+ <div id="method-M000053" class="method-detail">
196
+ <a name="M000053"></a>
177
197
 
178
198
  <div class="method-heading">
179
- <a href="CGIWrapper.src/M000052.html" target="Code" class="method-signature"
180
- onclick="popupCode('CGIWrapper.src/M000052.html');return false;">
199
+ <a href="CGIWrapper.src/M000053.html" target="Code" class="method-signature"
200
+ onclick="popupCode('CGIWrapper.src/M000053.html');return false;">
181
201
  <span class="method-name">env_table</span><span class="method-args">()</span>
182
202
  </a>
183
203
  </div>
184
204
 
185
205
  <div class="method-description">
186
206
  <p>
187
- Used to wrap the normal <a href="CGIWrapper.html#M000052">env_table</a>
207
+ Used to wrap the normal <a href="CGIWrapper.html#M000053">env_table</a>
188
208
  variable used inside CGI.
189
209
  </p>
190
210
  </div>
@@ -203,18 +223,23 @@ variable used inside CGI.
203
223
  <div class="method-description">
204
224
  <p>
205
225
  The header is typically called to send back the header. In our case we
206
- collect it into a hash for later usage. Options passed to this function are
207
- capitalized properly (unlike CGI), sanitized and then just stored.
226
+ collect it into a hash for later usage.
227
+ </p>
228
+ <p>
229
+ nph &#8212; Mostly ignored. It&#8216;ll output the date. connection &#8212;
230
+ Completely ignored. Why is CGI doing this? length &#8212; Ignored since <a
231
+ href="../Mongrel.html">Mongrel</a> figures this out from what you write to
232
+ output.
208
233
  </p>
209
234
  </div>
210
235
  </div>
211
236
 
212
- <div id="method-M000049" class="method-detail">
213
- <a name="M000049"></a>
237
+ <div id="method-M000050" class="method-detail">
238
+ <a name="M000050"></a>
214
239
 
215
240
  <div class="method-heading">
216
- <a href="CGIWrapper.src/M000049.html" target="Code" class="method-signature"
217
- onclick="popupCode('CGIWrapper.src/M000049.html');return false;">
241
+ <a href="CGIWrapper.src/M000050.html" target="Code" class="method-signature"
242
+ onclick="popupCode('CGIWrapper.src/M000050.html');return false;">
218
243
  <span class="method-name">out</span><span class="method-args">(options = &quot;text/html&quot;) {||| &quot;&quot;)| ...}</span>
219
244
  </a>
220
245
  </div>
@@ -226,17 +251,38 @@ So, we just reuse header and then finalize the <a
226
251
  href="HttpResponse.html">HttpResponse</a> the right way. Status is taken
227
252
  from the various options and converted to what <a
228
253
  href="../Mongrel.html">Mongrel</a> needs via the <a
229
- href="CGIWrapper.html#M000050">CGIWrapper.status</a> function.
254
+ href="CGIWrapper.html#M000051">CGIWrapper.status</a> function.
230
255
  </p>
231
256
  </div>
232
257
  </div>
233
258
 
234
- <div id="method-M000050" class="method-detail">
235
- <a name="M000050"></a>
259
+ <div id="method-M000049" class="method-detail">
260
+ <a name="M000049"></a>
236
261
 
237
262
  <div class="method-heading">
238
- <a href="CGIWrapper.src/M000050.html" target="Code" class="method-signature"
239
- onclick="popupCode('CGIWrapper.src/M000050.html');return false;">
263
+ <a href="CGIWrapper.src/M000049.html" target="Code" class="method-signature"
264
+ onclick="popupCode('CGIWrapper.src/M000049.html');return false;">
265
+ <span class="method-name">send_cookies</span><span class="method-args">(to)</span>
266
+ </a>
267
+ </div>
268
+
269
+ <div class="method-description">
270
+ <p>
271
+ Takes any &#8216;cookie&#8217; setting and sends it over the <a
272
+ href="../Mongrel.html">Mongrel</a> header, then removes the setting from
273
+ the options. If cookie is an Array or Hash then it sends those on with
274
+ .to_s, otherwise it just calls .to_s on it and hopefully your
275
+ &quot;cookie&quot; can write itself correctly.
276
+ </p>
277
+ </div>
278
+ </div>
279
+
280
+ <div id="method-M000051" class="method-detail">
281
+ <a name="M000051"></a>
282
+
283
+ <div class="method-heading">
284
+ <a href="CGIWrapper.src/M000051.html" target="Code" class="method-signature"
285
+ onclick="popupCode('CGIWrapper.src/M000051.html');return false;">
240
286
  <span class="method-name">status</span><span class="method-args">()</span>
241
287
  </a>
242
288
  </div>
@@ -250,12 +296,12 @@ status message in the status we have to do a bit of parsing.
250
296
  </div>
251
297
  </div>
252
298
 
253
- <div id="method-M000053" class="method-detail">
254
- <a name="M000053"></a>
299
+ <div id="method-M000054" class="method-detail">
300
+ <a name="M000054"></a>
255
301
 
256
302
  <div class="method-heading">
257
- <a href="CGIWrapper.src/M000053.html" target="Code" class="method-signature"
258
- onclick="popupCode('CGIWrapper.src/M000053.html');return false;">
303
+ <a href="CGIWrapper.src/M000054.html" target="Code" class="method-signature"
304
+ onclick="popupCode('CGIWrapper.src/M000054.html');return false;">
259
305
  <span class="method-name">stdinput</span><span class="method-args">()</span>
260
306
  </a>
261
307
  </div>
@@ -267,12 +313,12 @@ Used to wrap the normal stdinput variable used inside CGI.
267
313
  </div>
268
314
  </div>
269
315
 
270
- <div id="method-M000054" class="method-detail">
271
- <a name="M000054"></a>
316
+ <div id="method-M000055" class="method-detail">
317
+ <a name="M000055"></a>
272
318
 
273
319
  <div class="method-heading">
274
- <a href="CGIWrapper.src/M000054.html" target="Code" class="method-signature"
275
- onclick="popupCode('CGIWrapper.src/M000054.html');return false;">
320
+ <a href="CGIWrapper.src/M000055.html" target="Code" class="method-signature"
321
+ onclick="popupCode('CGIWrapper.src/M000055.html');return false;">
276
322
  <span class="method-name">stdoutput</span><span class="method-args">()</span>
277
323
  </a>
278
324
  </div>
@@ -10,14 +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 605</span>
14
- 605: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
- 606: <span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span>
16
- 607: <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">response</span>
17
- 608: <span class="ruby-ivar">@args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
18
- 609: <span class="ruby-ivar">@input</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>)
19
- 610: <span class="ruby-ivar">@options</span> = {}
20
- 611: <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
21
- 612: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 608</span>
14
+ 608: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
+ 609: <span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span>
16
+ 610: <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">response</span>
17
+ 611: <span class="ruby-ivar">@args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
18
+ 612: <span class="ruby-ivar">@input</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>)
19
+ 613: <span class="ruby-ivar">@head</span> = {}
20
+ 614: <span class="ruby-ivar">@out_called</span> = <span class="ruby-keyword kw">false</span>
21
+ 615: <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
22
+ 616: <span class="ruby-keyword kw">end</span></pre>
22
23
  </body>
23
24
  </html>
@@ -10,18 +10,39 @@
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 617</span>
14
- 617: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">&quot;text/html&quot;</span>)
15
- 618: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
16
- 619: <span class="ruby-comment cmt"># passing in a header so need to keep the status around and other options</span>
17
- 620: <span class="ruby-ivar">@options</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
18
- 621: <span class="ruby-keyword kw">else</span>
19
- 622: <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;Content-Type&quot;</span>] = <span class="ruby-identifier">options</span>
20
- 623: <span class="ruby-keyword kw">end</span>
21
- 624:
22
- 625: <span class="ruby-comment cmt"># doing this fakes out the cgi library to think the headers are empty</span>
23
- 626: <span class="ruby-comment cmt"># we then do the real headers in the out function call later</span>
24
- 627: <span class="ruby-value str">&quot;&quot;</span>
25
- 628: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 625</span>
14
+ 625: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">&quot;text/html&quot;</span>)
15
+ 626:
16
+ 627: <span class="ruby-comment cmt"># if they pass in a string then just write the Content-Type</span>
17
+ 628: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
18
+ 629: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">options</span>
19
+ 630: <span class="ruby-keyword kw">else</span>
20
+ 631: <span class="ruby-comment cmt"># convert the given options into what Mongrel wants</span>
21
+ 632: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'type'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;text/html&quot;</span>
22
+ 633: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;; charset=&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'charset'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-value str">&quot;charset&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'charset'</span>]
23
+ 634:
24
+ 635: <span class="ruby-comment cmt"># setup date only if they use nph</span>
25
+ 636: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Date'</span>] = <span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-identifier">rfc1123_date</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'nph'</span>]
26
+ 637:
27
+ 638: <span class="ruby-comment cmt"># setup the server to use the default or what they set</span>
28
+ 639: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Server'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'server'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">env_table</span>[<span class="ruby-value str">'SERVER_SOFTWARE'</span>]
29
+ 640:
30
+ 641: <span class="ruby-comment cmt"># remaining possible options they can give</span>
31
+ 642: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Status'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'status'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'status'</span>]
32
+ 643: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Language'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'language'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'language'</span>]
33
+ 644: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Expires'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'expires'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'expires'</span>]
34
+ 645:
35
+ 646: <span class="ruby-comment cmt"># drop the keys we don't want anymore</span>
36
+ 647: <span class="ruby-constant">REMOVED_KEYS</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) }
37
+ 648:
38
+ 649: <span class="ruby-comment cmt"># finally just convert the rest raw (which puts 'cookie' directly)</span>
39
+ 650: <span class="ruby-comment cmt"># 'cookie' is translated later as we write the header out</span>
40
+ 651: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@head</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>}
41
+ 652: <span class="ruby-keyword kw">end</span>
42
+ 653:
43
+ 654: <span class="ruby-comment cmt"># doing this fakes out the cgi library to think the headers are empty</span>
44
+ 655: <span class="ruby-comment cmt"># we then do the real headers in the out function call later</span>
45
+ 656: <span class="ruby-value str">&quot;&quot;</span>
46
+ 657: <span class="ruby-keyword kw">end</span></pre>
26
47
  </body>
27
48
  </html>
@@ -5,18 +5,30 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>out (Mongrel::CGIWrapper)</title>
8
+ <title>send_cookies (Mongrel::CGIWrapper)</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 634</span>
14
- 634: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">out</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">&quot;text/html&quot;</span>)
15
- 635: <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span>)
16
- 636: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">start</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>, <span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
17
- 637: <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">head</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">capitalize</span>] = <span class="ruby-identifier">v</span>}
18
- 638: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-keyword kw">yield</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>)
19
- 639: <span class="ruby-keyword kw">end</span>
20
- 640: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 664</span>
14
+ 664: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_cookies</span>(<span class="ruby-identifier">to</span>)
15
+ 665: <span class="ruby-comment cmt"># convert the cookies based on the myriad of possible ways to set a cookie</span>
16
+ 666: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'cookie'</span>]
17
+ 667: <span class="ruby-identifier">cookie</span> = <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'cookie'</span>]
18
+ 668: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">cookie</span>
19
+ 669: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
20
+ 670: <span class="ruby-identifier">cookie</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> }
21
+ 671: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
22
+ 672: <span class="ruby-identifier">cookie</span>.<span class="ruby-identifier">each_value</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>}
23
+ 673: <span class="ruby-keyword kw">else</span>
24
+ 674: <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'cookie'</span>].<span class="ruby-identifier">to_s</span>
25
+ 675: <span class="ruby-keyword kw">end</span>
26
+ 676:
27
+ 677: <span class="ruby-ivar">@head</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'cookie'</span>)
28
+ 678:
29
+ 679: <span class="ruby-comment cmt"># @output_cookies seems to never be used, but we'll process it just in case</span>
30
+ 680: <span class="ruby-ivar">@output_cookies</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@output_cookies</span>
31
+ 681: <span class="ruby-keyword kw">end</span>
32
+ 682: <span class="ruby-keyword kw">end</span></pre>
21
33
  </body>
22
34
  </html>
@@ -5,22 +5,23 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>status (Mongrel::CGIWrapper)</title>
8
+ <title>out (Mongrel::CGIWrapper)</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 645</span>
14
- 645: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
15
- 646: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status</span>
16
- 647: <span class="ruby-ivar">@status</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;Status&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;status&quot;</span>]
17
- 648:
18
- 649: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@status</span>
19
- 650: <span class="ruby-ivar">@status</span>[<span class="ruby-value">0</span> <span class="ruby-operator">...</span> <span class="ruby-ivar">@status</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">' '</span>)] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;200&quot;</span>
20
- 651: <span class="ruby-keyword kw">else</span>
21
- 652: <span class="ruby-ivar">@status</span> = <span class="ruby-value str">&quot;200&quot;</span>
22
- 653: <span class="ruby-keyword kw">end</span>
23
- 654: <span class="ruby-keyword kw">end</span>
24
- 655: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 688</span>
14
+ 688: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">out</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">&quot;text/html&quot;</span>)
15
+ 689: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@out_called</span> <span class="ruby-comment cmt"># don't do this more than once</span>
16
+ 690:
17
+ 691: <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span>)
18
+ 692:
19
+ 693: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">start</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>, <span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
20
+ 694: <span class="ruby-identifier">send_cookies</span>(<span class="ruby-identifier">head</span>)
21
+ 695:
22
+ 696: <span class="ruby-ivar">@head</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">head</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>}
23
+ 697: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-keyword kw">yield</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>)
24
+ 698: <span class="ruby-keyword kw">end</span>
25
+ 699: <span class="ruby-keyword kw">end</span></pre>
25
26
  </body>
26
27
  </html>
@@ -5,14 +5,22 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>args (Mongrel::CGIWrapper)</title>
8
+ <title>status (Mongrel::CGIWrapper)</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 658</span>
14
- 658: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args</span>
15
- 659: <span class="ruby-ivar">@args</span>
16
- 660: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 704</span>
14
+ 704: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
15
+ 705: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status</span>
16
+ 706: <span class="ruby-ivar">@status</span> = <span class="ruby-ivar">@head</span>[<span class="ruby-value str">&quot;Status&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@head</span>[<span class="ruby-value str">&quot;status&quot;</span>]
17
+ 707:
18
+ 708: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@status</span>
19
+ 709: <span class="ruby-ivar">@status</span>[<span class="ruby-value">0</span> <span class="ruby-operator">...</span> <span class="ruby-ivar">@status</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">' '</span>)] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;200&quot;</span>
20
+ 710: <span class="ruby-keyword kw">else</span>
21
+ 711: <span class="ruby-ivar">@status</span> = <span class="ruby-value str">&quot;200&quot;</span>
22
+ 712: <span class="ruby-keyword kw">end</span>
23
+ 713: <span class="ruby-keyword kw">end</span>
24
+ 714: <span class="ruby-keyword kw">end</span></pre>
17
25
  </body>
18
26
  </html>
@@ -5,14 +5,14 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>env_table (Mongrel::CGIWrapper)</title>
8
+ <title>args (Mongrel::CGIWrapper)</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 663</span>
14
- 663: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env_table</span>
15
- 664: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
16
- 665: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 717</span>
14
+ 717: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args</span>
15
+ 718: <span class="ruby-ivar">@args</span>
16
+ 719: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -5,14 +5,14 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>stdinput (Mongrel::CGIWrapper)</title>
8
+ <title>env_table (Mongrel::CGIWrapper)</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 668</span>
14
- 668: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdinput</span>
15
- 669: <span class="ruby-ivar">@input</span>
16
- 670: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 722</span>
14
+ 722: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env_table</span>
15
+ 723: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
16
+ 724: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -5,15 +5,14 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>stdoutput (Mongrel::CGIWrapper)</title>
8
+ <title>stdinput (Mongrel::CGIWrapper)</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 673</span>
14
- 673: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdoutput</span>
15
- 674: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;WARNING: Your program is doing something not expected. Please tell Zed that stdoutput was used and what software you are running. Thanks.&quot;</span>
16
- 675: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span>
17
- 676: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 727</span>
14
+ 727: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdinput</span>
15
+ 728: <span class="ruby-ivar">@input</span>
16
+ 729: <span class="ruby-keyword kw">end</span></pre>
18
17
  </body>
19
18
  </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>stdoutput (Mongrel::CGIWrapper)</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 732</span>
14
+ 732: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdoutput</span>
15
+ 733: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;WARNING: Your program is doing something not expected. Please tell Zed that stdoutput was used and what software you are running. Thanks.&quot;</span>
16
+ 734: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span>
17
+ 735: <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -280,7 +280,7 @@ href="../Mongrel.html">Mongrel</a> man).
280
280
  <tr class="top-aligned-row context-row">
281
281
  <td class="context-item-name">MONGREL_VERSION</td>
282
282
  <td>=</td>
283
- <td class="context-item-value">'Mongrel 0.3.4'</td>
283
+ <td class="context-item-value">'Mongrel 0.3.5'</td>
284
284
  <td width="3em">&nbsp;</td>
285
285
  <td class="context-item-desc">
286
286
  Current <a href="../Mongrel.html">Mongrel</a> version (used for
@@ -22,7 +22,7 @@
22
22
  488: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">index</span>
23
23
  489: <span class="ruby-comment cmt"># serve the index</span>
24
24
  490: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">index</span>
25
- 491: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@listing_allows</span>
25
+ 491: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@listing_allowed</span>
26
26
  492: <span class="ruby-comment cmt"># serve the directory</span>
27
27
  493: <span class="ruby-identifier">req</span>
28
28
  494: <span class="ruby-keyword kw">else</span>
@@ -96,8 +96,8 @@ custom message for special URIs.
96
96
  <h3 class="section-bar">Methods</h3>
97
97
 
98
98
  <div class="name-list">
99
- <a href="#M000055">new</a>&nbsp;&nbsp;
100
- <a href="#M000056">process</a>&nbsp;&nbsp;
99
+ <a href="#M000056">new</a>&nbsp;&nbsp;
100
+ <a href="#M000057">process</a>&nbsp;&nbsp;
101
101
  </div>
102
102
  </div>
103
103
 
@@ -119,12 +119,12 @@ custom message for special URIs.
119
119
  <div id="methods">
120
120
  <h3 class="section-bar">Public Class methods</h3>
121
121
 
122
- <div id="method-M000055" class="method-detail">
123
- <a name="M000055"></a>
122
+ <div id="method-M000056" class="method-detail">
123
+ <a name="M000056"></a>
124
124
 
125
125
  <div class="method-heading">
126
- <a href="Error404Handler.src/M000055.html" target="Code" class="method-signature"
127
- onclick="popupCode('Error404Handler.src/M000055.html');return false;">
126
+ <a href="Error404Handler.src/M000056.html" target="Code" class="method-signature"
127
+ onclick="popupCode('Error404Handler.src/M000056.html');return false;">
128
128
  <span class="method-name">new</span><span class="method-args">(msg)</span>
129
129
  </a>
130
130
  </div>
@@ -139,12 +139,12 @@ it&#8217;s pretty efficient.
139
139
 
140
140
  <h3 class="section-bar">Public Instance methods</h3>
141
141
 
142
- <div id="method-M000056" class="method-detail">
143
- <a name="M000056"></a>
142
+ <div id="method-M000057" class="method-detail">
143
+ <a name="M000057"></a>
144
144
 
145
145
  <div class="method-heading">
146
- <a href="Error404Handler.src/M000056.html" target="Code" class="method-signature"
147
- onclick="popupCode('Error404Handler.src/M000056.html');return false;">
146
+ <a href="Error404Handler.src/M000057.html" target="Code" class="method-signature"
147
+ onclick="popupCode('Error404Handler.src/M000057.html');return false;">
148
148
  <span class="method-name">process</span><span class="method-args">(request, response)</span>
149
149
  </a>
150
150
  </div>
@@ -5,14 +5,14 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>process (Mongrel::Error404Handler)</title>
8
+ <title>new (Mongrel::Error404Handler)</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 439</span>
14
- 439: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
- 440: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
16
- 441: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 434</span>
14
+ 434: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
15
+ 435: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
16
+ 436: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -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>process (Mongrel::Error404Handler)</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 439</span>
14
+ 439: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
+ 440: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
16
+ 441: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -103,7 +103,7 @@ efficiently handling large file uploads.
103
103
  <h3 class="section-bar">Methods</h3>
104
104
 
105
105
  <div class="name-list">
106
- <a href="#M000057">new</a>&nbsp;&nbsp;
106
+ <a href="#M000058">new</a>&nbsp;&nbsp;
107
107
  </div>
108
108
  </div>
109
109
 
@@ -143,12 +143,12 @@ efficiently handling large file uploads.
143
143
  <div id="methods">
144
144
  <h3 class="section-bar">Public Class methods</h3>
145
145
 
146
- <div id="method-M000057" class="method-detail">
147
- <a name="M000057"></a>
146
+ <div id="method-M000058" class="method-detail">
147
+ <a name="M000058"></a>
148
148
 
149
149
  <div class="method-heading">
150
- <a href="HttpRequest.src/M000057.html" target="Code" class="method-signature"
151
- onclick="popupCode('HttpRequest.src/M000057.html');return false;">
150
+ <a href="HttpRequest.src/M000058.html" target="Code" class="method-signature"
151
+ onclick="popupCode('HttpRequest.src/M000058.html');return false;">
152
152
  <span class="method-name">new</span><span class="method-args">(params, initial_body, socket)</span>
153
153
  </a>
154
154
  </div>
@@ -1 +1 @@
1
- Thu Feb 16 02:01:03 EST 2006
1
+ Sat Feb 18 15:19:13 EST 2006
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu Feb 16 01:05:45 EST 2006</td>
59
+ <td>Sat Feb 18 15:10:16 EST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -22,12 +22,12 @@
22
22
  <div id="index-entries">
23
23
  <a href="classes/Mongrel/HeaderOut.html#M000034">[]= (Mongrel::HeaderOut)</a><br />
24
24
  <a href="classes/Mongrel/DirHandler.html#M000027">add_mime_type (Mongrel::DirHandler)</a><br />
25
- <a href="classes/Mongrel/CGIWrapper.html#M000051">args (Mongrel::CGIWrapper)</a><br />
25
+ <a href="classes/Mongrel/CGIWrapper.html#M000052">args (Mongrel::CGIWrapper)</a><br />
26
26
  <a href="classes/Mongrel/DirHandler.html#M000023">can_serve (Mongrel::DirHandler)</a><br />
27
27
  <a href="classes/PluginFactory.html#M000009">create (PluginFactory)</a><br />
28
28
  <a href="classes/PluginFactory.html#M000008">derivativeClasses (PluginFactory)</a><br />
29
29
  <a href="classes/PluginFactory.html#M000005">derivatives (PluginFactory)</a><br />
30
- <a href="classes/Mongrel/CGIWrapper.html#M000052">env_table (Mongrel::CGIWrapper)</a><br />
30
+ <a href="classes/Mongrel/CGIWrapper.html#M000053">env_table (Mongrel::CGIWrapper)</a><br />
31
31
  <a href="classes/Mongrel/HttpParser.html#M000019">error? (Mongrel::HttpParser)</a><br />
32
32
  <a href="classes/Mongrel/HttpParser.html#M000018">execute (Mongrel::HttpParser)</a><br />
33
33
  <a href="classes/PluginFactory.html#M000004">extend_object (PluginFactory)</a><br />
@@ -45,36 +45,37 @@
45
45
  <a href="classes/PluginFactory.html#M000014">makeRequirePath (PluginFactory)</a><br />
46
46
  <a href="classes/Mongrel/DirHandler.html#M000022">new (Mongrel::DirHandler)</a><br />
47
47
  <a href="classes/Mongrel/CGIWrapper.html#M000047">new (Mongrel::CGIWrapper)</a><br />
48
- <a href="classes/Mongrel/Error404Handler.html#M000055">new (Mongrel::Error404Handler)</a><br />
48
+ <a href="classes/Mongrel/Error404Handler.html#M000056">new (Mongrel::Error404Handler)</a><br />
49
49
  <a href="classes/Mongrel/HttpParser.html#M000015">new (Mongrel::HttpParser)</a><br />
50
50
  <a href="classes/Mongrel/HttpServer.html#M000028">new (Mongrel::HttpServer)</a><br />
51
- <a href="classes/Mongrel/HeaderOut.html#M000033">new (Mongrel::HeaderOut)</a><br />
52
51
  <a href="classes/Mongrel/HttpResponse.html#M000040">new (Mongrel::HttpResponse)</a><br />
52
+ <a href="classes/Mongrel/HeaderOut.html#M000033">new (Mongrel::HeaderOut)</a><br />
53
53
  <a href="classes/Mongrel/URIClassifier.html#M000035">new (Mongrel::URIClassifier)</a><br />
54
54
  <a href="classes/FactoryError.html#M000001">new (FactoryError)</a><br />
55
- <a href="classes/Mongrel/HttpRequest.html#M000057">new (Mongrel::HttpRequest)</a><br />
55
+ <a href="classes/Mongrel/HttpRequest.html#M000058">new (Mongrel::HttpRequest)</a><br />
56
56
  <a href="classes/Mongrel/HttpParser.html#M000021">nread (Mongrel::HttpParser)</a><br />
57
- <a href="classes/Mongrel/CGIWrapper.html#M000049">out (Mongrel::CGIWrapper)</a><br />
58
- <a href="classes/Mongrel/DirHandler.html#M000026">process (Mongrel::DirHandler)</a><br />
59
- <a href="classes/Mongrel/Error404Handler.html#M000056">process (Mongrel::Error404Handler)</a><br />
57
+ <a href="classes/Mongrel/CGIWrapper.html#M000050">out (Mongrel::CGIWrapper)</a><br />
60
58
  <a href="classes/Mongrel/HttpHandler.html#M000039">process (Mongrel::HttpHandler)</a><br />
59
+ <a href="classes/Mongrel/Error404Handler.html#M000057">process (Mongrel::Error404Handler)</a><br />
60
+ <a href="classes/Mongrel/DirHandler.html#M000026">process (Mongrel::DirHandler)</a><br />
61
61
  <a href="classes/Mongrel/HttpServer.html#M000029">process_client (Mongrel::HttpServer)</a><br />
62
62
  <a href="classes/Mongrel/URIClassifier.html#M000036">register (Mongrel::URIClassifier)</a><br />
63
63
  <a href="classes/Mongrel/HttpServer.html#M000031">register (Mongrel::HttpServer)</a><br />
64
64
  <a href="classes/PluginFactory.html#M000013">requireDerivative (PluginFactory)</a><br />
65
- <a href="classes/Mongrel/HttpResponse.html#M000042">reset (Mongrel::HttpResponse)</a><br />
66
65
  <a href="classes/Mongrel/HttpParser.html#M000016">reset (Mongrel::HttpParser)</a><br />
66
+ <a href="classes/Mongrel/HttpResponse.html#M000042">reset (Mongrel::HttpResponse)</a><br />
67
67
  <a href="classes/Mongrel/URIClassifier.html#M000038">resolve (Mongrel::URIClassifier)</a><br />
68
68
  <a href="classes/Mongrel/HttpServer.html#M000030">run (Mongrel::HttpServer)</a><br />
69
69
  <a href="classes/Mongrel/HttpResponse.html#M000045">send_body (Mongrel::HttpResponse)</a><br />
70
+ <a href="classes/Mongrel/CGIWrapper.html#M000049">send_cookies (Mongrel::CGIWrapper)</a><br />
70
71
  <a href="classes/Mongrel/DirHandler.html#M000024">send_dir_listing (Mongrel::DirHandler)</a><br />
71
72
  <a href="classes/Mongrel/DirHandler.html#M000025">send_file (Mongrel::DirHandler)</a><br />
72
73
  <a href="classes/Mongrel/HttpResponse.html#M000044">send_header (Mongrel::HttpResponse)</a><br />
73
74
  <a href="classes/Mongrel/HttpResponse.html#M000043">send_status (Mongrel::HttpResponse)</a><br />
74
75
  <a href="classes/Mongrel/HttpResponse.html#M000041">start (Mongrel::HttpResponse)</a><br />
75
- <a href="classes/Mongrel/CGIWrapper.html#M000050">status (Mongrel::CGIWrapper)</a><br />
76
- <a href="classes/Mongrel/CGIWrapper.html#M000053">stdinput (Mongrel::CGIWrapper)</a><br />
77
- <a href="classes/Mongrel/CGIWrapper.html#M000054">stdoutput (Mongrel::CGIWrapper)</a><br />
76
+ <a href="classes/Mongrel/CGIWrapper.html#M000051">status (Mongrel::CGIWrapper)</a><br />
77
+ <a href="classes/Mongrel/CGIWrapper.html#M000054">stdinput (Mongrel::CGIWrapper)</a><br />
78
+ <a href="classes/Mongrel/CGIWrapper.html#M000055">stdoutput (Mongrel::CGIWrapper)</a><br />
78
79
  <a href="classes/Mongrel/URIClassifier.html#M000037">unregister (Mongrel::URIClassifier)</a><br />
79
80
  <a href="classes/Mongrel/HttpServer.html#M000032">unregister (Mongrel::HttpServer)</a><br />
80
81
  </div>
@@ -112,7 +112,7 @@ module Mongrel
112
112
  SERVER_SOFTWARE='SERVER_SOFTWARE'
113
113
 
114
114
  # Current Mongrel version (used for SERVER_SOFTWARE and other response headers).
115
- MONGREL_VERSION='Mongrel 0.3.4'
115
+ MONGREL_VERSION='Mongrel 0.3.5'
116
116
 
117
117
  # The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
118
118
  ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: #{MONGREL_VERSION}\r\n\r\nNOT FOUND"
@@ -488,7 +488,7 @@ module Mongrel
488
488
  if File.exist? index
489
489
  # serve the index
490
490
  return index
491
- elsif @listing_allows
491
+ elsif @listing_allowed
492
492
  # serve the directory
493
493
  req
494
494
  else
@@ -597,44 +597,103 @@ module Mongrel
597
597
  # to get existing CGI based systems working. It should handle everything, but please
598
598
  # notify me if you see special warnings. This work is still very alpha so I need
599
599
  # testers to help work out the various corner cases.
600
-
601
600
  class CGIWrapper < ::CGI
602
601
  public :env_table
603
602
  attr_reader :options
604
-
603
+
604
+ # these are stripped out of any keys passed to CGIWrapper.header function
605
+ REMOVED_KEYS = [ "nph","status","server","connection","type",
606
+ "charset","length","language","expires"]
607
+
605
608
  def initialize(request, response, *args)
606
609
  @request = request
607
610
  @response = response
608
611
  @args = *args
609
612
  @input = StringIO.new(request.body)
610
- @options = {}
613
+ @head = {}
614
+ @out_called = false
611
615
  super(*args)
612
616
  end
613
617
 
614
618
  # The header is typically called to send back the header. In our case we
615
- # collect it into a hash for later usage. Options passed to this function
616
- # are capitalized properly (unlike CGI), sanitized and then just stored.
619
+ # collect it into a hash for later usage.
620
+ #
621
+ # nph -- Mostly ignored. It'll output the date.
622
+ # connection -- Completely ignored. Why is CGI doing this?
623
+ # length -- Ignored since Mongrel figures this out from what you write to output.
624
+ #
617
625
  def header(options = "text/html")
618
- if options.class == Hash
619
- # passing in a header so need to keep the status around and other options
620
- @options = @options.merge(options)
626
+
627
+ # if they pass in a string then just write the Content-Type
628
+ if options.class == String
629
+ @head['Content-Type'] = options
621
630
  else
622
- @options["Content-Type"] = options
631
+ # convert the given options into what Mongrel wants
632
+ @head['Content-Type'] = options['type'] || "text/html"
633
+ @head['Content-Type'] += "; charset=" + options['charset'] if options.has_key? "charset" if options['charset']
634
+
635
+ # setup date only if they use nph
636
+ @head['Date'] = CGI::rfc1123_date(Time.now) if options['nph']
637
+
638
+ # setup the server to use the default or what they set
639
+ @head['Server'] = options['server'] || env_table['SERVER_SOFTWARE']
640
+
641
+ # remaining possible options they can give
642
+ @head['Status'] = options['status'] if options['status']
643
+ @head['Content-Language'] = options['language'] if options['language']
644
+ @head['Expires'] = options['expires'] if options['expires']
645
+
646
+ # drop the keys we don't want anymore
647
+ REMOVED_KEYS.each {|k| options.delete(k) }
648
+
649
+ # finally just convert the rest raw (which puts 'cookie' directly)
650
+ # 'cookie' is translated later as we write the header out
651
+ options.each{|k,v| @head[k] = v}
623
652
  end
624
-
653
+
625
654
  # doing this fakes out the cgi library to think the headers are empty
626
655
  # we then do the real headers in the out function call later
627
656
  ""
628
657
  end
658
+
659
+ # Takes any 'cookie' setting and sends it over the Mongrel header,
660
+ # then removes the setting from the options. If cookie is an
661
+ # Array or Hash then it sends those on with .to_s, otherwise
662
+ # it just calls .to_s on it and hopefully your "cookie" can
663
+ # write itself correctly.
664
+ def send_cookies(to)
665
+ # convert the cookies based on the myriad of possible ways to set a cookie
666
+ if @head['cookie']
667
+ cookie = @head['cookie']
668
+ case cookie
669
+ when Array
670
+ cookie.each {|c| to['Set-Cookie'] = c.to_s }
671
+ when Hash
672
+ cookie.each_value {|c| to['Set-Cookie'] = c.to_s}
673
+ else
674
+ to['Set-Cookie'] = options['cookie'].to_s
675
+ end
676
+
677
+ @head.delete('cookie')
678
+
679
+ # @output_cookies seems to never be used, but we'll process it just in case
680
+ @output_cookies.each {|c| to['Set-Cookie'] = c.to_s } if @output_cookies
681
+ end
682
+ end
629
683
 
630
684
  # The dumb thing is people can call header or this or both and in any order.
631
685
  # So, we just reuse header and then finalize the HttpResponse the right way.
632
686
  # Status is taken from the various options and converted to what Mongrel needs
633
687
  # via the CGIWrapper.status function.
634
688
  def out(options = "text/html")
689
+ return if @out_called # don't do this more than once
690
+
635
691
  header(options)
692
+
636
693
  @response.start status do |head, out|
637
- @options.each {|k,v| head[k.capitalize] = v}
694
+ send_cookies(head)
695
+
696
+ @head.each {|k,v| head[k] = v}
638
697
  out.write(yield || "")
639
698
  end
640
699
  end
@@ -644,7 +703,7 @@ module Mongrel
644
703
  # message in the status we have to do a bit of parsing.
645
704
  def status
646
705
  if not @status
647
- @status = @options["Status"] || @options["status"]
706
+ @status = @head["Status"] || @head["status"]
648
707
 
649
708
  if @status
650
709
  @status[0 ... @status.index(' ')] || "200"
@@ -652,7 +711,7 @@ module Mongrel
652
711
  @status = "200"
653
712
  end
654
713
  end
655
- end
714
+ end
656
715
 
657
716
  # Used to wrap the normal args variable used inside CGI.
658
717
  def args
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: mongrel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.4
7
- date: 2006-02-16 00:00:00 -05:00
6
+ version: 0.3.5
7
+ date: 2006-02-18 00:00:00 -05:00
8
8
  summary: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.
9
9
  require_paths:
10
10
  - lib
@@ -79,14 +79,15 @@ files:
79
79
  - doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html
80
80
  - doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html
81
81
  - doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html
82
+ - doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html
82
83
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html
83
84
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html
84
85
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html
85
86
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html
86
87
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html
87
88
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html
88
- - doc/rdoc/classes/Mongrel/Error404Handler.src/M000055.html
89
89
  - doc/rdoc/classes/Mongrel/Error404Handler.src/M000056.html
90
+ - doc/rdoc/classes/Mongrel/Error404Handler.src/M000057.html
90
91
  - doc/rdoc/classes/Mongrel/HeaderOut.src/M000033.html
91
92
  - doc/rdoc/classes/Mongrel/HeaderOut.src/M000034.html
92
93
  - doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html
@@ -97,7 +98,7 @@ files:
97
98
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000019.html
98
99
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000020.html
99
100
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000021.html
100
- - doc/rdoc/classes/Mongrel/HttpRequest.src/M000057.html
101
+ - doc/rdoc/classes/Mongrel/HttpRequest.src/M000058.html
101
102
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html
102
103
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000041.html
103
104
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000042.html
@@ -1,18 +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::Error404Handler)</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 434</span>
14
- 434: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
15
- 435: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
16
- 436: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>