mongrel 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -3
- data/Rakefile +7 -5
- data/bin/mongrel_rails +5 -4
- data/bin/mongrel_rails_service +237 -0
- data/bin/mongrel_rails_svc +194 -0
- data/doc/rdoc/classes/Mongrel.html +1 -4
- data/doc/rdoc/classes/Mongrel/Const.html +13 -3
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000033.html → M000028.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000034.html → M000029.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000041.html +39 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000034.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000035.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000036.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000037.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000044.html → M000038.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000045.html → M000039.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.html +47 -28
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000022.html +33 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000023.html +57 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000024.html +46 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000025.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000026.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000027.html +19 -0
- data/doc/rdoc/classes/Mongrel/{HttpHandler.html → StopServer.html} +4 -33
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +22 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000035.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000036.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000037.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000038.html → M000033.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +9 -7
- data/doc/rdoc/files/lib/mongrel_rb.html +3 -3
- data/doc/rdoc/fr_class_index.html +1 -4
- data/doc/rdoc/fr_method_index.html +20 -37
- data/examples/mongrel_simple_ctrl.rb +92 -0
- data/examples/mongrel_simple_service.rb +116 -0
- data/examples/simpletest.rb +3 -1
- data/ext/http11/http11_parser.c +176 -263
- data/lib/mongrel.rb +56 -343
- data/lib/mongrel/cgi.rb +147 -0
- data/lib/mongrel/handlers.rb +180 -0
- metadata +28 -46
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -346
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +0 -48
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +0 -27
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -26
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html +0 -19
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -283
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +0 -40
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000056.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000057.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000058.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +0 -38
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +0 -64
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +0 -23
@@ -1,346 +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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Mongrel::CGIWrapper</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Mongrel::CGIWrapper</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/mongrel_rb.html">
|
59
|
-
lib/mongrel.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
::CGI
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
The beginning of a complete wrapper around <a
|
84
|
-
href="../Mongrel.html">Mongrel</a>’s internal HTTP processing system
|
85
|
-
but maintaining the original Ruby CGI module. Use this only as a crutch to
|
86
|
-
get existing CGI based systems working. It should handle everything, but
|
87
|
-
please notify me if you see special warnings. This work is still very alpha
|
88
|
-
so I need testers to help work out the various corner cases.
|
89
|
-
</p>
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
96
|
-
<div id="method-list">
|
97
|
-
<h3 class="section-bar">Methods</h3>
|
98
|
-
|
99
|
-
<div class="name-list">
|
100
|
-
<a href="#M000052">args</a>
|
101
|
-
<a href="#M000053">env_table</a>
|
102
|
-
<a href="#M000048">header</a>
|
103
|
-
<a href="#M000047">new</a>
|
104
|
-
<a href="#M000050">out</a>
|
105
|
-
<a href="#M000049">send_cookies</a>
|
106
|
-
<a href="#M000051">status</a>
|
107
|
-
<a href="#M000054">stdinput</a>
|
108
|
-
<a href="#M000055">stdoutput</a>
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
|
112
|
-
</div>
|
113
|
-
|
114
|
-
|
115
|
-
<!-- if includes -->
|
116
|
-
|
117
|
-
<div id="section">
|
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">[ "nph","status","server","connection","type", "charset","length","language","expires"]</td>
|
129
|
-
<td width="3em"> </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>
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
<div id="attribute-list">
|
143
|
-
<h3 class="section-bar">Attributes</h3>
|
144
|
-
|
145
|
-
<div class="name-list">
|
146
|
-
<table>
|
147
|
-
<tr class="top-aligned-row context-row">
|
148
|
-
<td class="context-item-name">options</td>
|
149
|
-
<td class="context-item-value"> [R] </td>
|
150
|
-
<td class="context-item-desc"></td>
|
151
|
-
</tr>
|
152
|
-
</table>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
<!-- if method_list -->
|
159
|
-
<div id="methods">
|
160
|
-
<h3 class="section-bar">Public Class methods</h3>
|
161
|
-
|
162
|
-
<div id="method-M000047" class="method-detail">
|
163
|
-
<a name="M000047"></a>
|
164
|
-
|
165
|
-
<div class="method-heading">
|
166
|
-
<a href="CGIWrapper.src/M000047.html" target="Code" class="method-signature"
|
167
|
-
onclick="popupCode('CGIWrapper.src/M000047.html');return false;">
|
168
|
-
<span class="method-name">new</span><span class="method-args">(request, response, *args)</span>
|
169
|
-
</a>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
<div class="method-description">
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
177
|
-
|
178
|
-
<div id="method-M000052" class="method-detail">
|
179
|
-
<a name="M000052"></a>
|
180
|
-
|
181
|
-
<div class="method-heading">
|
182
|
-
<a href="CGIWrapper.src/M000052.html" target="Code" class="method-signature"
|
183
|
-
onclick="popupCode('CGIWrapper.src/M000052.html');return false;">
|
184
|
-
<span class="method-name">args</span><span class="method-args">()</span>
|
185
|
-
</a>
|
186
|
-
</div>
|
187
|
-
|
188
|
-
<div class="method-description">
|
189
|
-
<p>
|
190
|
-
Used to wrap the normal args variable used inside CGI.
|
191
|
-
</p>
|
192
|
-
</div>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
<div id="method-M000053" class="method-detail">
|
196
|
-
<a name="M000053"></a>
|
197
|
-
|
198
|
-
<div class="method-heading">
|
199
|
-
<a href="CGIWrapper.src/M000053.html" target="Code" class="method-signature"
|
200
|
-
onclick="popupCode('CGIWrapper.src/M000053.html');return false;">
|
201
|
-
<span class="method-name">env_table</span><span class="method-args">()</span>
|
202
|
-
</a>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
<div class="method-description">
|
206
|
-
<p>
|
207
|
-
Used to wrap the normal <a href="CGIWrapper.html#M000053">env_table</a>
|
208
|
-
variable used inside CGI.
|
209
|
-
</p>
|
210
|
-
</div>
|
211
|
-
</div>
|
212
|
-
|
213
|
-
<div id="method-M000048" class="method-detail">
|
214
|
-
<a name="M000048"></a>
|
215
|
-
|
216
|
-
<div class="method-heading">
|
217
|
-
<a href="CGIWrapper.src/M000048.html" target="Code" class="method-signature"
|
218
|
-
onclick="popupCode('CGIWrapper.src/M000048.html');return false;">
|
219
|
-
<span class="method-name">header</span><span class="method-args">(options = "text/html")</span>
|
220
|
-
</a>
|
221
|
-
</div>
|
222
|
-
|
223
|
-
<div class="method-description">
|
224
|
-
<p>
|
225
|
-
The header is typically called to send back the header. In our case we
|
226
|
-
collect it into a hash for later usage.
|
227
|
-
</p>
|
228
|
-
<p>
|
229
|
-
nph — Mostly ignored. It‘ll output the date. connection —
|
230
|
-
Completely ignored. Why is CGI doing this? length — Ignored since <a
|
231
|
-
href="../Mongrel.html">Mongrel</a> figures this out from what you write to
|
232
|
-
output.
|
233
|
-
</p>
|
234
|
-
</div>
|
235
|
-
</div>
|
236
|
-
|
237
|
-
<div id="method-M000050" class="method-detail">
|
238
|
-
<a name="M000050"></a>
|
239
|
-
|
240
|
-
<div class="method-heading">
|
241
|
-
<a href="CGIWrapper.src/M000050.html" target="Code" class="method-signature"
|
242
|
-
onclick="popupCode('CGIWrapper.src/M000050.html');return false;">
|
243
|
-
<span class="method-name">out</span><span class="method-args">(options = "text/html") {||| "")| ...}</span>
|
244
|
-
</a>
|
245
|
-
</div>
|
246
|
-
|
247
|
-
<div class="method-description">
|
248
|
-
<p>
|
249
|
-
The dumb thing is people can call header or this or both and in any order.
|
250
|
-
So, we just reuse header and then finalize the <a
|
251
|
-
href="HttpResponse.html">HttpResponse</a> the right way. Status is taken
|
252
|
-
from the various options and converted to what <a
|
253
|
-
href="../Mongrel.html">Mongrel</a> needs via the <a
|
254
|
-
href="CGIWrapper.html#M000051">CGIWrapper.status</a> function.
|
255
|
-
</p>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
|
259
|
-
<div id="method-M000049" class="method-detail">
|
260
|
-
<a name="M000049"></a>
|
261
|
-
|
262
|
-
<div class="method-heading">
|
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 ‘cookie’ 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
|
-
"cookie" 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;">
|
286
|
-
<span class="method-name">status</span><span class="method-args">()</span>
|
287
|
-
</a>
|
288
|
-
</div>
|
289
|
-
|
290
|
-
<div class="method-description">
|
291
|
-
<p>
|
292
|
-
Computes the status once, but lazily so that people who call header twice
|
293
|
-
don’t get penalized. Because CGI insists on including the options
|
294
|
-
status message in the status we have to do a bit of parsing.
|
295
|
-
</p>
|
296
|
-
</div>
|
297
|
-
</div>
|
298
|
-
|
299
|
-
<div id="method-M000054" class="method-detail">
|
300
|
-
<a name="M000054"></a>
|
301
|
-
|
302
|
-
<div class="method-heading">
|
303
|
-
<a href="CGIWrapper.src/M000054.html" target="Code" class="method-signature"
|
304
|
-
onclick="popupCode('CGIWrapper.src/M000054.html');return false;">
|
305
|
-
<span class="method-name">stdinput</span><span class="method-args">()</span>
|
306
|
-
</a>
|
307
|
-
</div>
|
308
|
-
|
309
|
-
<div class="method-description">
|
310
|
-
<p>
|
311
|
-
Used to wrap the normal stdinput variable used inside CGI.
|
312
|
-
</p>
|
313
|
-
</div>
|
314
|
-
</div>
|
315
|
-
|
316
|
-
<div id="method-M000055" class="method-detail">
|
317
|
-
<a name="M000055"></a>
|
318
|
-
|
319
|
-
<div class="method-heading">
|
320
|
-
<a href="CGIWrapper.src/M000055.html" target="Code" class="method-signature"
|
321
|
-
onclick="popupCode('CGIWrapper.src/M000055.html');return false;">
|
322
|
-
<span class="method-name">stdoutput</span><span class="method-args">()</span>
|
323
|
-
</a>
|
324
|
-
</div>
|
325
|
-
|
326
|
-
<div class="method-description">
|
327
|
-
<p>
|
328
|
-
The stdoutput should be completely bypassed but we’ll drop a warning
|
329
|
-
just in case
|
330
|
-
</p>
|
331
|
-
</div>
|
332
|
-
</div>
|
333
|
-
|
334
|
-
|
335
|
-
</div>
|
336
|
-
|
337
|
-
|
338
|
-
</div>
|
339
|
-
|
340
|
-
|
341
|
-
<div id="validator-badges">
|
342
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
343
|
-
</div>
|
344
|
-
|
345
|
-
</body>
|
346
|
-
</html>
|
@@ -1,24 +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::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 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>
|
23
|
-
</body>
|
24
|
-
</html>
|
@@ -1,48 +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>header (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 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">"text/html"</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">"text/html"</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">"; charset="</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">"charset"</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">""</span>
|
46
|
-
657: <span class="ruby-keyword kw">end</span></pre>
|
47
|
-
</body>
|
48
|
-
</html>
|
@@ -1,34 +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>send_cookies (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 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>
|
33
|
-
</body>
|
34
|
-
</html>
|