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
data/README CHANGED
@@ -11,7 +11,7 @@ scream without too many portability issues.
11
11
 
12
12
  == Status
13
13
 
14
- The 0.2.1 release of Mongrel features an HTTP core server that is the fastest possible
14
+ The 0.2.2 release of Mongrel features an HTTP core server that is the fastest possible
15
15
  thing I could get without using something other than Ruby. It features a few bug fixes,
16
16
  but mostly just a change to the Mongrel::HttpResponse class to make it more feature
17
17
  complete. The remaining development will be spent getting Mongrel to work with
@@ -28,6 +28,9 @@ page found at http://rubyforge.org/projects/mongrel/ thanks to Tom Copland.
28
28
  I'll be looking to automate management of this, but feel free to use
29
29
  rubyforge to post feature requests, bugs, and join the mailing list.
30
30
 
31
+ Finally, it now supports all CGI parameters that don't cause a performance hit,
32
+ and it has a Mongrel::DirHandler which can serve files out of a directory and
33
+ do (optional) directory listings.
31
34
 
32
35
  == Install
33
36
 
@@ -40,7 +43,6 @@ who can build it for you.
40
43
 
41
44
  Finally, the source includes a setup.rb for those who hate RubyGems.
42
45
 
43
-
44
46
  == Usage
45
47
 
46
48
  The examples/simpletest.rb file has the following code as the simplest
@@ -59,6 +61,7 @@ example:
59
61
 
60
62
  h = Mongrel::HttpServer.new("0.0.0.0", "3000")
61
63
  h.register("/test", SimpleHandler.new)
64
+ h.register("/files", DirHandler.new("."))
62
65
  h.run.join
63
66
 
64
67
  If you run this and access port 3000 with a browser it will say
@@ -66,6 +69,11 @@ If you run this and access port 3000 with a browser it will say
66
69
  give a simple 404. Check out the Mongrel::Error404Handler for a
67
70
  basic way to give a more complex 404 message.
68
71
 
72
+ This also shows the DirHandler with directory listings. This is still
73
+ rough but it should work for basic hosting. *File extension to mime
74
+ type mapping is missing though.*
75
+
76
+
69
77
  == Speed
70
78
 
71
79
  The 0.2.1 release probably consists of the most effort I've ever put into
data/Rakefile CHANGED
@@ -27,4 +27,4 @@ setup_extension("http11", "http11")
27
27
 
28
28
  summary = "An experimental fast simple web server for Ruby."
29
29
  test_file = "test/test_ws.rb"
30
- setup_gem("mongrel", "0.2.1", "Zed A. Shaw", summary, [], test_file)
30
+ setup_gem("mongrel", "0.2.2", "Zed A. Shaw", summary, [], test_file)
@@ -100,7 +100,9 @@ to service web application requests fast as possible.
100
100
  <div id="class-list">
101
101
  <h3 class="section-bar">Classes and Modules</h3>
102
102
 
103
- Class <a href="Mongrel/Error404Handler.html" class="link">Mongrel::Error404Handler</a><br />
103
+ Module <a href="Mongrel/Const.html" class="link">Mongrel::Const</a><br />
104
+ Class <a href="Mongrel/DirHandler.html" class="link">Mongrel::DirHandler</a><br />
105
+ Class <a href="Mongrel/Error404Handler.html" class="link">Mongrel::Error404Handler</a><br />
104
106
  Class <a href="Mongrel/HeaderOut.html" class="link">Mongrel::HeaderOut</a><br />
105
107
  Class <a href="Mongrel/HttpHandler.html" class="link">Mongrel::HttpHandler</a><br />
106
108
  Class <a href="Mongrel/HttpParser.html" class="link">Mongrel::HttpParser</a><br />
@@ -120,6 +122,14 @@ Class <a href="Mongrel/URIClassifier.html" class="link">Mongrel::URIClassifier</
120
122
  <td class="context-item-name">HTTP_STATUS_CODES</td>
121
123
  <td>=</td>
122
124
  <td class="context-item-value">{ 100 =&gt; 'Continue', 101 =&gt; 'Switching Protocols', 200 =&gt; 'OK', 201 =&gt; 'Created', 202 =&gt; 'Accepted', 203 =&gt; 'Non-Authoritative Information', 204 =&gt; 'No Content', 205 =&gt; 'Reset Content', 206 =&gt; 'Partial Content', 300 =&gt; 'Multiple Choices', 301 =&gt; 'Moved Permanently', 302 =&gt; 'Moved Temporarily', 303 =&gt; 'See Other', 304 =&gt; 'Not Modified', 305 =&gt; 'Use Proxy', 400 =&gt; 'Bad Request', 401 =&gt; 'Unauthorized', 402 =&gt; 'Payment Required', 403 =&gt; 'Forbidden', 404 =&gt; 'Not Found', 405 =&gt; 'Method Not Allowed', 406 =&gt; 'Not Acceptable', 407 =&gt; 'Proxy Authentication Required', 408 =&gt; 'Request Time-out', 409 =&gt; 'Conflict', 410 =&gt; 'Gone', 411 =&gt; 'Length Required', 412 =&gt; 'Precondition Failed', 413 =&gt; 'Request Entity Too Large', 414 =&gt; 'Request-URI Too Large', 415 =&gt; 'Unsupported Media Type', 500 =&gt; 'Internal Server Error', 501 =&gt; 'Not Implemented', 502 =&gt; 'Bad Gateway', 503 =&gt; 'Service Unavailable', 504 =&gt; 'Gateway Time-out', 505 =&gt; 'HTTP Version not supported'</td>
125
+ <td width="3em">&nbsp;</td>
126
+ <td class="context-item-desc">
127
+ Every standard HTTP code mapped to the appropriate message. These are used
128
+ so frequently that they are placed directly in <a
129
+ href="Mongrel.html">Mongrel</a> for easy access rather than <a
130
+ href="Mongrel/Const.html">Mongrel::Const</a>.
131
+
132
+ </td>
123
133
  </tr>
124
134
  </table>
125
135
  </div>
@@ -0,0 +1,342 @@
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>Module: Mongrel::Const</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>Module</strong></td>
53
+ <td class="class-name-in-header">Mongrel::Const</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
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Frequently used constants when constructing requests or responses. Many
78
+ times the constant just refers to a string with the same contents. Using
79
+ these constants gave about a 3% to 10% performance improvement over using
80
+ the strings directly. Symbols did not really improve things much compared
81
+ to constants.
82
+ </p>
83
+ <p>
84
+ While <a href="../Mongrel.html">Mongrel</a> does try to emulate the CGI/1.2
85
+ protocol, it does not use the REMOTE_IDENT, REMOTE_USER, or REMOTE_HOST
86
+ parameters since those are either a security problem or too taxing on
87
+ performance.
88
+ </p>
89
+
90
+ </div>
91
+
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+
101
+ <div id="section">
102
+
103
+
104
+ <div id="constants-list">
105
+ <h3 class="section-bar">Constants</h3>
106
+
107
+ <div class="name-list">
108
+ <table summary="Constants">
109
+ <tr class="top-aligned-row context-row">
110
+ <td class="context-item-name">PATH_INFO</td>
111
+ <td>=</td>
112
+ <td class="context-item-value">&quot;PATH_INFO&quot;</td>
113
+ <td width="3em">&nbsp;</td>
114
+ <td class="context-item-desc">
115
+ This is the part of the path after the SCRIPT_NAME. <a
116
+ href="URIClassifier.html">URIClassifier</a> will determine this.
117
+
118
+ </td>
119
+ </tr>
120
+ <tr class="top-aligned-row context-row">
121
+ <td class="context-item-name">SCRIPT_NAME</td>
122
+ <td>=</td>
123
+ <td class="context-item-value">&quot;SCRIPT_NAME&quot;</td>
124
+ <td width="3em">&nbsp;</td>
125
+ <td class="context-item-desc">
126
+ This is the intial part that your handler is identified as by <a
127
+ href="URIClassifier.html">URIClassifier</a>.
128
+
129
+ </td>
130
+ </tr>
131
+ <tr class="top-aligned-row context-row">
132
+ <td class="context-item-name">REQUEST_URI</td>
133
+ <td>=</td>
134
+ <td class="context-item-value">'REQUEST_URI'</td>
135
+ <td width="3em">&nbsp;</td>
136
+ <td class="context-item-desc">
137
+ The original URI requested by the client. Passed to <a
138
+ href="URIClassifier.html">URIClassifier</a> to build PATH_INFO and
139
+ SCRIPT_NAME.
140
+
141
+ </td>
142
+ </tr>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">CONTENT_LENGTH</td>
145
+ <td>=</td>
146
+ <td class="context-item-value">'CONTENT_LENGTH'</td>
147
+ <td width="3em">&nbsp;</td>
148
+ <td class="context-item-desc">
149
+ Content length (also available as HTTP_CONTENT_LENGTH).
150
+
151
+ </td>
152
+ </tr>
153
+ <tr class="top-aligned-row context-row">
154
+ <td class="context-item-name">HTTP_CONTENT_LENGTH</td>
155
+ <td>=</td>
156
+ <td class="context-item-value">'HTTP_CONTENT_LENGTH'</td>
157
+ <td width="3em">&nbsp;</td>
158
+ <td class="context-item-desc">
159
+ Content length (also available as CONTENT_LENGTH).
160
+
161
+ </td>
162
+ </tr>
163
+ <tr class="top-aligned-row context-row">
164
+ <td class="context-item-name">CONTENT_TYPE</td>
165
+ <td>=</td>
166
+ <td class="context-item-value">'CONTENT_TYPE'</td>
167
+ <td width="3em">&nbsp;</td>
168
+ <td class="context-item-desc">
169
+ Content type (also available as HTTP_CONTENT_TYPE).
170
+
171
+ </td>
172
+ </tr>
173
+ <tr class="top-aligned-row context-row">
174
+ <td class="context-item-name">HTTP_CONTENT_TYPE</td>
175
+ <td>=</td>
176
+ <td class="context-item-value">'HTTP_CONTENT_TYPE'</td>
177
+ <td width="3em">&nbsp;</td>
178
+ <td class="context-item-desc">
179
+ Content type (also available as CONTENT_TYPE).
180
+
181
+ </td>
182
+ </tr>
183
+ <tr class="top-aligned-row context-row">
184
+ <td class="context-item-name">GATEWAY_INTERFACE</td>
185
+ <td>=</td>
186
+ <td class="context-item-value">'GATEWAY_INTERFACE'</td>
187
+ <td width="3em">&nbsp;</td>
188
+ <td class="context-item-desc">
189
+ Gateway interface key in the <a href="HttpRequest.html">HttpRequest</a>
190
+ parameters.
191
+
192
+ </td>
193
+ </tr>
194
+ <tr class="top-aligned-row context-row">
195
+ <td class="context-item-name">GATEWAY_INTERFACE_VALUE</td>
196
+ <td>=</td>
197
+ <td class="context-item-value">'CGI/1.2'</td>
198
+ <td width="3em">&nbsp;</td>
199
+ <td class="context-item-desc">
200
+ We claim to support CGI/1.2.
201
+
202
+ </td>
203
+ </tr>
204
+ <tr class="top-aligned-row context-row">
205
+ <td class="context-item-name">REMOTE_ADDR</td>
206
+ <td>=</td>
207
+ <td class="context-item-value">'REMOTE_ADDR'</td>
208
+ <td width="3em">&nbsp;</td>
209
+ <td class="context-item-desc">
210
+ Hosts remote IP address. <a href="../Mongrel.html">Mongrel</a> does not do
211
+ DNS resolves since that slows processing down considerably.
212
+
213
+ </td>
214
+ </tr>
215
+ <tr class="top-aligned-row context-row">
216
+ <td class="context-item-name">REMOTE_HOST</td>
217
+ <td>=</td>
218
+ <td class="context-item-value">'REMOTE_HOST'</td>
219
+ <td width="3em">&nbsp;</td>
220
+ <td class="context-item-desc">
221
+ This is not given since <a href="../Mongrel.html">Mongrel</a> does not do
222
+ DNS resolves. It is only here for completeness for the CGI standard.
223
+
224
+ </td>
225
+ </tr>
226
+ <tr class="top-aligned-row context-row">
227
+ <td class="context-item-name">SERVER_NAME</td>
228
+ <td>=</td>
229
+ <td class="context-item-value">'SERVER_NAME'</td>
230
+ <td width="3em">&nbsp;</td>
231
+ <td class="context-item-desc">
232
+ The name/host of our server as given by the <a
233
+ href="HttpServer.html#M000012">HttpServer.new</a>(host,port) call.
234
+
235
+ </td>
236
+ </tr>
237
+ <tr class="top-aligned-row context-row">
238
+ <td class="context-item-name">SERVER_PORT</td>
239
+ <td>=</td>
240
+ <td class="context-item-value">'SERVER_PORT'</td>
241
+ <td width="3em">&nbsp;</td>
242
+ <td class="context-item-desc">
243
+ The port of our server as given by the <a
244
+ href="HttpServer.html#M000012">HttpServer.new</a>(host,port) call.
245
+
246
+ </td>
247
+ </tr>
248
+ <tr class="top-aligned-row context-row">
249
+ <td class="context-item-name">SERVER_PROTOCOL</td>
250
+ <td>=</td>
251
+ <td class="context-item-value">'SERVER_PROTOCOL'</td>
252
+ <td width="3em">&nbsp;</td>
253
+ <td class="context-item-desc">
254
+ Official server protocol key in the <a
255
+ href="HttpRequest.html">HttpRequest</a> parameters.
256
+
257
+ </td>
258
+ </tr>
259
+ <tr class="top-aligned-row context-row">
260
+ <td class="context-item-name">SERVER_PROTOCOL_VALUE</td>
261
+ <td>=</td>
262
+ <td class="context-item-value">'HTTP/1.1'</td>
263
+ <td width="3em">&nbsp;</td>
264
+ <td class="context-item-desc">
265
+ <a href="../Mongrel.html">Mongrel</a> claims to support HTTP/1.1.
266
+
267
+ </td>
268
+ </tr>
269
+ <tr class="top-aligned-row context-row">
270
+ <td class="context-item-name">SERVER_SOFTWARE</td>
271
+ <td>=</td>
272
+ <td class="context-item-value">'SERVER_SOFTWARE'</td>
273
+ <td width="3em">&nbsp;</td>
274
+ <td class="context-item-desc">
275
+ The actual server software being used (it&#8217;s <a
276
+ href="../Mongrel.html">Mongrel</a> man).
277
+
278
+ </td>
279
+ </tr>
280
+ <tr class="top-aligned-row context-row">
281
+ <td class="context-item-name">MONGREL_VERSION</td>
282
+ <td>=</td>
283
+ <td class="context-item-value">'Mongrel 0.2.2'</td>
284
+ <td width="3em">&nbsp;</td>
285
+ <td class="context-item-desc">
286
+ Current <a href="../Mongrel.html">Mongrel</a> version (used for
287
+ SERVER_SOFTWARE and other response headers).
288
+
289
+ </td>
290
+ </tr>
291
+ <tr class="top-aligned-row context-row">
292
+ <td class="context-item-name">ERROR_404_RESPONSE</td>
293
+ <td>=</td>
294
+ <td class="context-item-value">&quot;HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: #{MONGREL_VERSION}\r\n\r\nNOT FOUND&quot;</td>
295
+ <td width="3em">&nbsp;</td>
296
+ <td class="context-item-desc">
297
+ The standard empty 404 response for bad requests. Use Error4040Handler for
298
+ custom stuff.
299
+
300
+ </td>
301
+ </tr>
302
+ <tr class="top-aligned-row context-row">
303
+ <td class="context-item-name">ERROR_503_RESPONSE</td>
304
+ <td>=</td>
305
+ <td class="context-item-value">&quot;HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY&quot;</td>
306
+ <td width="3em">&nbsp;</td>
307
+ <td class="context-item-desc">
308
+ A common header for indicating the server is too busy. Not used yet.
309
+
310
+ </td>
311
+ </tr>
312
+ <tr class="top-aligned-row context-row">
313
+ <td class="context-item-name">CHUNK_SIZE</td>
314
+ <td>=</td>
315
+ <td class="context-item-value">(16 * 1024)</td>
316
+ <td width="3em">&nbsp;</td>
317
+ <td class="context-item-desc">
318
+ The basic max request size we&#8217;ll try to read.
319
+
320
+ </td>
321
+ </tr>
322
+ </table>
323
+ </div>
324
+ </div>
325
+
326
+
327
+
328
+
329
+
330
+
331
+ <!-- if method_list -->
332
+
333
+
334
+ </div>
335
+
336
+
337
+ <div id="validator-badges">
338
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
339
+ </div>
340
+
341
+ </body>
342
+ </html>
@@ -0,0 +1,201 @@
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::DirHandler</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::DirHandler</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
+ <a href="HttpHandler.html">
69
+ HttpHandler
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ Serves the contents of a directory. You give it the path to the root where
86
+ the files are located, and it tries to find the files based on the
87
+ PATH_INFO inside the directory. If the requested path is a directory then
88
+ it returns a simple directory listing.
89
+ </p>
90
+ <p>
91
+ It does a simple protection against going outside it&#8217;s root path by
92
+ converting all paths to an absolute expanded path, and then making sure
93
+ that the final expanded path includes the root path. If it doesn&#8217;t
94
+ than it simply gives a 404.
95
+ </p>
96
+
97
+ </div>
98
+
99
+
100
+ </div>
101
+
102
+ <div id="method-list">
103
+ <h3 class="section-bar">Methods</h3>
104
+
105
+ <div class="name-list">
106
+ <a href="#M000008">new</a>&nbsp;&nbsp;
107
+ <a href="#M000011">process</a>&nbsp;&nbsp;
108
+ <a href="#M000009">send_dir_listing</a>&nbsp;&nbsp;
109
+ <a href="#M000010">send_file</a>&nbsp;&nbsp;
110
+ </div>
111
+ </div>
112
+
113
+ </div>
114
+
115
+
116
+ <!-- if includes -->
117
+
118
+ <div id="section">
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+ <!-- if method_list -->
128
+ <div id="methods">
129
+ <h3 class="section-bar">Public Class methods</h3>
130
+
131
+ <div id="method-M000008" class="method-detail">
132
+ <a name="M000008"></a>
133
+
134
+ <div class="method-heading">
135
+ <a href="DirHandler.src/M000008.html" target="Code" class="method-signature"
136
+ onclick="popupCode('DirHandler.src/M000008.html');return false;">
137
+ <span class="method-name">new</span><span class="method-args">(path, listing_allowed=true)</span>
138
+ </a>
139
+ </div>
140
+
141
+ <div class="method-description">
142
+ </div>
143
+ </div>
144
+
145
+ <h3 class="section-bar">Public Instance methods</h3>
146
+
147
+ <div id="method-M000011" class="method-detail">
148
+ <a name="M000011"></a>
149
+
150
+ <div class="method-heading">
151
+ <a href="DirHandler.src/M000011.html" target="Code" class="method-signature"
152
+ onclick="popupCode('DirHandler.src/M000011.html');return false;">
153
+ <span class="method-name">process</span><span class="method-args">(request, response)</span>
154
+ </a>
155
+ </div>
156
+
157
+ <div class="method-description">
158
+ </div>
159
+ </div>
160
+
161
+ <div id="method-M000009" class="method-detail">
162
+ <a name="M000009"></a>
163
+
164
+ <div class="method-heading">
165
+ <a href="DirHandler.src/M000009.html" target="Code" class="method-signature"
166
+ onclick="popupCode('DirHandler.src/M000009.html');return false;">
167
+ <span class="method-name">send_dir_listing</span><span class="method-args">(base, dir, response)</span>
168
+ </a>
169
+ </div>
170
+
171
+ <div class="method-description">
172
+ </div>
173
+ </div>
174
+
175
+ <div id="method-M000010" class="method-detail">
176
+ <a name="M000010"></a>
177
+
178
+ <div class="method-heading">
179
+ <a href="DirHandler.src/M000010.html" target="Code" class="method-signature"
180
+ onclick="popupCode('DirHandler.src/M000010.html');return false;">
181
+ <span class="method-name">send_file</span><span class="method-args">(req, response)</span>
182
+ </a>
183
+ </div>
184
+
185
+ <div class="method-description">
186
+ </div>
187
+ </div>
188
+
189
+
190
+ </div>
191
+
192
+
193
+ </div>
194
+
195
+
196
+ <div id="validator-badges">
197
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
198
+ </div>
199
+
200
+ </body>
201
+ </html>