mongrel 0.3.12 → 0.3.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/Rakefile +1 -1
  2. data/bin/mongrel_rails +12 -6
  3. data/doc/rdoc/classes/Class.src/M000001.html +10 -10
  4. data/doc/rdoc/classes/Class.src/M000002.html +46 -46
  5. data/doc/rdoc/classes/Class.src/M000003.html +7 -7
  6. data/doc/rdoc/classes/Class.src/M000004.html +6 -6
  7. data/doc/rdoc/classes/IO.src/M000005.html +5 -5
  8. data/doc/rdoc/classes/IO.src/M000006.html +5 -5
  9. data/doc/rdoc/classes/Kernel.src/M000025.html +5 -5
  10. data/doc/rdoc/classes/Kernel.src/M000026.html +11 -11
  11. data/doc/rdoc/classes/Mongrel.html +1 -0
  12. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +1 -1
  13. data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +10 -10
  14. data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +9 -9
  15. data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +4 -4
  16. data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +18 -18
  17. data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +5 -5
  18. data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +16 -16
  19. data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +19 -19
  20. data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +4 -4
  21. data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +10 -11
  22. data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +5 -5
  23. data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +8 -8
  24. data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +7 -7
  25. data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +4 -4
  26. data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +14 -13
  27. data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +5 -33
  28. data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +33 -5
  29. data/doc/rdoc/classes/Mongrel/Configurator.src/M000115.html +18 -0
  30. data/doc/rdoc/classes/Mongrel/Const.html +11 -1
  31. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html +5 -5
  32. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000117.html +18 -0
  33. data/doc/rdoc/classes/Mongrel/HeaderOut.html +0 -185
  34. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +4 -4
  35. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +4 -4
  36. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +3 -1
  37. data/doc/rdoc/classes/Mongrel/{StopServer.html → HttpParserError.html} +5 -11
  38. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html +15 -7
  39. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html +7 -7
  40. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html +7 -19
  41. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000121.html +32 -0
  42. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +12 -12
  43. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +6 -6
  44. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +11 -11
  45. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +8 -8
  46. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +8 -8
  47. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +9 -9
  48. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +4 -4
  49. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +6 -6
  50. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +4 -4
  51. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +10 -10
  52. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +51 -50
  53. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +10 -10
  54. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +45 -45
  55. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +14 -14
  56. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +4 -4
  57. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +8 -8
  58. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +4 -4
  59. data/doc/rdoc/classes/ObjectTracker.src/M000019.html +20 -22
  60. data/doc/rdoc/classes/RequestLog/Access.src/M000122.html +19 -0
  61. data/doc/rdoc/classes/RequestLog/Files.src/{M000121.html → M000123.html} +5 -5
  62. data/doc/rdoc/classes/RequestLog/Objects.src/{M000122.html → M000124.html} +5 -5
  63. data/doc/rdoc/classes/RequestLog/Params.src/{M000123.html → M000125.html} +5 -5
  64. data/doc/rdoc/classes/Stats.html +1 -1
  65. data/doc/rdoc/classes/Stats.src/M000012.html +2 -2
  66. data/doc/rdoc/created.rid +1 -1
  67. data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
  68. data/doc/rdoc/files/lib/mongrel/command_rb.html +1 -1
  69. data/doc/rdoc/files/lib/mongrel/debug_rb.html +1 -1
  70. data/doc/rdoc/files/lib/mongrel/handlers_rb.html +1 -1
  71. data/doc/rdoc/files/lib/mongrel/stats_rb.html +1 -1
  72. data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
  73. data/examples/random_thrash.rb +19 -0
  74. data/ext/http11/http11.c +57 -12
  75. data/ext/http11/http11_parser.c +58 -52
  76. data/lib/mongrel.rb +37 -10
  77. data/lib/mongrel/command.rb +1 -1
  78. data/lib/mongrel/debug.rb +39 -125
  79. data/lib/mongrel/handlers.rb +2 -2
  80. data/lib/mongrel/rails.rb +2 -1
  81. data/lib/mongrel/stats.rb +2 -2
  82. data/test/test_configurator.rb +2 -2
  83. data/test/test_debug.rb +2 -4
  84. data/test/test_http11.rb +76 -7
  85. data/test/test_stats.rb +6 -4
  86. data/test/test_uriclassifier.rb +0 -14
  87. metadata +12 -24
  88. data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -383
  89. data/doc/rdoc/classes/Mongrel/Configurator.html +0 -563
  90. data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
  91. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html +0 -18
  92. data/doc/rdoc/classes/Mongrel/HttpHandler.html +0 -152
  93. data/doc/rdoc/classes/Mongrel/HttpRequest.html +0 -222
  94. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html +0 -28
  95. data/doc/rdoc/classes/Mongrel/HttpResponse.html +0 -371
  96. data/doc/rdoc/classes/Mongrel/URIClassifier.html +0 -301
  97. data/doc/rdoc/classes/RequestLog.html +0 -113
  98. data/doc/rdoc/classes/RequestLog/Files.html +0 -144
  99. data/doc/rdoc/classes/RequestLog/Objects.html +0 -144
  100. data/doc/rdoc/classes/RequestLog/Params.html +0 -144
  101. data/doc/rdoc/fr_class_index.html +0 -60
  102. data/doc/rdoc/fr_file_index.html +0 -40
  103. data/doc/rdoc/fr_method_index.html +0 -149
  104. data/doc/rdoc/index.html +0 -24
  105. data/lib/http11.bundle +0 -0
@@ -1,28 +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::HttpRequest)</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 150</span>
14
- 150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">initial_body</span>, <span class="ruby-identifier">socket</span>)
15
- 151: <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">initial_body</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>
16
- 152: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
17
- 153: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
18
- 154:
19
- 155: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
20
- 156: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
21
- 157: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
22
- 158: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">clen</span>
23
- 159: <span class="ruby-ivar">@body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">clen</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span>)
24
- 160: <span class="ruby-keyword kw">end</span>
25
- 161:
26
- 162: <span class="ruby-keyword kw">end</span></pre>
27
- </body>
28
- </html>
@@ -1,371 +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::HttpResponse</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::HttpResponse</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
- Object
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
- Writes and controls your response to the client using the HTTP/1.1
84
- specification. You use it by simply doing:
85
- </p>
86
- <pre>
87
- response.start(200) do |head,out|
88
- head['Content-Type'] = 'text/plain'
89
- out.write(&quot;hello\n&quot;)
90
- end
91
- </pre>
92
- <p>
93
- The parameter to start is the response code&#8212;which <a
94
- href="../Mongrel.html">Mongrel</a> will translate for you based on
95
- HTTP_STATUS_CODES. The head parameter is how you write custom headers. The
96
- out parameter is where you write your body. The default status code for <a
97
- href="HttpResponse.html#M000076">HttpResponse.start</a> is 200 so the above
98
- example is redundant.
99
- </p>
100
- <p>
101
- As you can see, it&#8217;s just like using a Hash and as you do this it
102
- writes the proper header to the output on the fly. You can even intermix
103
- specifying headers and writing content. The <a
104
- href="HttpResponse.html">HttpResponse</a> class with write the things in
105
- the proper order once the HttpResponse.block is ended.
106
- </p>
107
- <p>
108
- You may also work the <a href="HttpResponse.html">HttpResponse</a> object
109
- directly using the various attributes available for the raw socket, body,
110
- header, and status codes. If you do this you&#8217;re on your own. A design
111
- decision was made to force the client to not pipeline requests. HTTP/1.1
112
- pipelining really kills the performance due to how it has to be handled and
113
- how unclear the standard is. To fix this the <a
114
- href="HttpResponse.html">HttpResponse</a> gives a &quot;Connection:
115
- close&quot; header which forces the client to close right away. The bonus
116
- for this is that it gives a pretty nice speed boost to most clients since
117
- they can close their connection immediately.
118
- </p>
119
- <p>
120
- One additional caveat is that you don&#8217;t have to specify the
121
- Content-length header as the <a href="HttpResponse.html">HttpResponse</a>
122
- will write this for you based on the out length.
123
- </p>
124
-
125
- </div>
126
-
127
-
128
- </div>
129
-
130
- <div id="method-list">
131
- <h3 class="section-bar">Methods</h3>
132
-
133
- <div class="name-list">
134
- <a href="#M000083">done</a>&nbsp;&nbsp;
135
- <a href="#M000082">finished</a>&nbsp;&nbsp;
136
- <a href="#M000075">new</a>&nbsp;&nbsp;
137
- <a href="#M000077">reset</a>&nbsp;&nbsp;
138
- <a href="#M000080">send_body</a>&nbsp;&nbsp;
139
- <a href="#M000079">send_header</a>&nbsp;&nbsp;
140
- <a href="#M000078">send_status</a>&nbsp;&nbsp;
141
- <a href="#M000076">start</a>&nbsp;&nbsp;
142
- <a href="#M000081">write</a>&nbsp;&nbsp;
143
- </div>
144
- </div>
145
-
146
- </div>
147
-
148
-
149
- <!-- if includes -->
150
-
151
- <div id="section">
152
-
153
-
154
-
155
-
156
-
157
- <div id="attribute-list">
158
- <h3 class="section-bar">Attributes</h3>
159
-
160
- <div class="name-list">
161
- <table>
162
- <tr class="top-aligned-row context-row">
163
- <td class="context-item-name">body</td>
164
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
165
- <td class="context-item-desc"></td>
166
- </tr>
167
- <tr class="top-aligned-row context-row">
168
- <td class="context-item-name">body_sent</td>
169
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
170
- <td class="context-item-desc"></td>
171
- </tr>
172
- <tr class="top-aligned-row context-row">
173
- <td class="context-item-name">header</td>
174
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
175
- <td class="context-item-desc"></td>
176
- </tr>
177
- <tr class="top-aligned-row context-row">
178
- <td class="context-item-name">header_sent</td>
179
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
180
- <td class="context-item-desc"></td>
181
- </tr>
182
- <tr class="top-aligned-row context-row">
183
- <td class="context-item-name">socket</td>
184
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
185
- <td class="context-item-desc"></td>
186
- </tr>
187
- <tr class="top-aligned-row context-row">
188
- <td class="context-item-name">status</td>
189
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
190
- <td class="context-item-desc"></td>
191
- </tr>
192
- <tr class="top-aligned-row context-row">
193
- <td class="context-item-name">status</td>
194
- <td class="context-item-value">&nbsp;[W]&nbsp;</td>
195
- <td class="context-item-desc"></td>
196
- </tr>
197
- <tr class="top-aligned-row context-row">
198
- <td class="context-item-name">status_sent</td>
199
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
200
- <td class="context-item-desc"></td>
201
- </tr>
202
- </table>
203
- </div>
204
- </div>
205
-
206
-
207
-
208
- <!-- if method_list -->
209
- <div id="methods">
210
- <h3 class="section-bar">Public Class methods</h3>
211
-
212
- <div id="method-M000075" class="method-detail">
213
- <a name="M000075"></a>
214
-
215
- <div class="method-heading">
216
- <a href="HttpResponse.src/M000075.html" target="Code" class="method-signature"
217
- onclick="popupCode('HttpResponse.src/M000075.html');return false;">
218
- <span class="method-name">new</span><span class="method-args">(socket, filter = nil)</span>
219
- </a>
220
- </div>
221
-
222
- <div class="method-description">
223
- </div>
224
- </div>
225
-
226
- <h3 class="section-bar">Public Instance methods</h3>
227
-
228
- <div id="method-M000083" class="method-detail">
229
- <a name="M000083"></a>
230
-
231
- <div class="method-heading">
232
- <a href="HttpResponse.src/M000083.html" target="Code" class="method-signature"
233
- onclick="popupCode('HttpResponse.src/M000083.html');return false;">
234
- <span class="method-name">done</span><span class="method-args">()</span>
235
- </a>
236
- </div>
237
-
238
- <div class="method-description">
239
- </div>
240
- </div>
241
-
242
- <div id="method-M000082" class="method-detail">
243
- <a name="M000082"></a>
244
-
245
- <div class="method-heading">
246
- <a href="HttpResponse.src/M000082.html" target="Code" class="method-signature"
247
- onclick="popupCode('HttpResponse.src/M000082.html');return false;">
248
- <span class="method-name">finished</span><span class="method-args">()</span>
249
- </a>
250
- </div>
251
-
252
- <div class="method-description">
253
- <p>
254
- This takes whatever has been done to header and body and then writes it in
255
- the proper format to make an HTTP/1.1 response.
256
- </p>
257
- </div>
258
- </div>
259
-
260
- <div id="method-M000077" class="method-detail">
261
- <a name="M000077"></a>
262
-
263
- <div class="method-heading">
264
- <a href="HttpResponse.src/M000077.html" target="Code" class="method-signature"
265
- onclick="popupCode('HttpResponse.src/M000077.html');return false;">
266
- <span class="method-name">reset</span><span class="method-args">()</span>
267
- </a>
268
- </div>
269
-
270
- <div class="method-description">
271
- <p>
272
- Primarily used in exception handling to reset the response output in order
273
- to write an alternative response. It will abort with an exception if you
274
- have already sent the header or the body. This is pretty catastrophic
275
- actually.
276
- </p>
277
- </div>
278
- </div>
279
-
280
- <div id="method-M000080" class="method-detail">
281
- <a name="M000080"></a>
282
-
283
- <div class="method-heading">
284
- <a href="HttpResponse.src/M000080.html" target="Code" class="method-signature"
285
- onclick="popupCode('HttpResponse.src/M000080.html');return false;">
286
- <span class="method-name">send_body</span><span class="method-args">()</span>
287
- </a>
288
- </div>
289
-
290
- <div class="method-description">
291
- </div>
292
- </div>
293
-
294
- <div id="method-M000079" class="method-detail">
295
- <a name="M000079"></a>
296
-
297
- <div class="method-heading">
298
- <a href="HttpResponse.src/M000079.html" target="Code" class="method-signature"
299
- onclick="popupCode('HttpResponse.src/M000079.html');return false;">
300
- <span class="method-name">send_header</span><span class="method-args">()</span>
301
- </a>
302
- </div>
303
-
304
- <div class="method-description">
305
- </div>
306
- </div>
307
-
308
- <div id="method-M000078" class="method-detail">
309
- <a name="M000078"></a>
310
-
311
- <div class="method-heading">
312
- <a href="HttpResponse.src/M000078.html" target="Code" class="method-signature"
313
- onclick="popupCode('HttpResponse.src/M000078.html');return false;">
314
- <span class="method-name">send_status</span><span class="method-args">(content_length=nil)</span>
315
- </a>
316
- </div>
317
-
318
- <div class="method-description">
319
- </div>
320
- </div>
321
-
322
- <div id="method-M000076" class="method-detail">
323
- <a name="M000076"></a>
324
-
325
- <div class="method-heading">
326
- <a href="HttpResponse.src/M000076.html" target="Code" class="method-signature"
327
- onclick="popupCode('HttpResponse.src/M000076.html');return false;">
328
- <span class="method-name">start</span><span class="method-args">(status=200, finalize=false) {|@header, @body| ...}</span>
329
- </a>
330
- </div>
331
-
332
- <div class="method-description">
333
- <p>
334
- Receives a block passing it the header and body for you to work with. When
335
- the block is finished it writes everything you&#8217;ve done to the socket
336
- in the proper order. This lets you intermix header and body content as
337
- needed. Handlers are able to modify pretty much any part of the request in
338
- the chain, and can stop further processing by simple passing
339
- &quot;finalize=true&quot; to the start method. By default all handlers run
340
- and then mongrel finalizes the request when they&#8217;re all done.
341
- </p>
342
- </div>
343
- </div>
344
-
345
- <div id="method-M000081" class="method-detail">
346
- <a name="M000081"></a>
347
-
348
- <div class="method-heading">
349
- <a href="HttpResponse.src/M000081.html" target="Code" class="method-signature"
350
- onclick="popupCode('HttpResponse.src/M000081.html');return false;">
351
- <span class="method-name">write</span><span class="method-args">(data)</span>
352
- </a>
353
- </div>
354
-
355
- <div class="method-description">
356
- </div>
357
- </div>
358
-
359
-
360
- </div>
361
-
362
-
363
- </div>
364
-
365
-
366
- <div id="validator-badges">
367
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
368
- </div>
369
-
370
- </body>
371
- </html>
@@ -1,301 +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::URIClassifier</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::URIClassifier</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
- <a href="../../files/ext/http11/http11_c.html">
63
- ext/http11/http11.c
64
- </a>
65
- <br />
66
- </td>
67
- </tr>
68
-
69
- <tr class="top-aligned-row">
70
- <td><strong>Parent:</strong></td>
71
- <td>
72
- Object
73
- </td>
74
- </tr>
75
- </table>
76
- </div>
77
- <!-- banner header -->
78
-
79
- <div id="bodyContent">
80
-
81
-
82
-
83
- <div id="contextContent">
84
-
85
-
86
-
87
- </div>
88
-
89
- <div id="method-list">
90
- <h3 class="section-bar">Methods</h3>
91
-
92
- <div class="name-list">
93
- <a href="#M000085">inspect</a>&nbsp;&nbsp;
94
- <a href="#M000086">new</a>&nbsp;&nbsp;
95
- <a href="#M000087">register</a>&nbsp;&nbsp;
96
- <a href="#M000089">resolve</a>&nbsp;&nbsp;
97
- <a href="#M000088">unregister</a>&nbsp;&nbsp;
98
- <a href="#M000084">uris</a>&nbsp;&nbsp;
99
- </div>
100
- </div>
101
-
102
- </div>
103
-
104
-
105
- <!-- if includes -->
106
-
107
- <div id="section">
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
- <!-- if method_list -->
117
- <div id="methods">
118
- <h3 class="section-bar">Public Class methods</h3>
119
-
120
- <div id="method-M000086" class="method-detail">
121
- <a name="M000086"></a>
122
-
123
- <div class="method-heading">
124
- <a href="URIClassifier.src/M000086.html" target="Code" class="method-signature"
125
- onclick="popupCode('URIClassifier.src/M000086.html');return false;">
126
- <span class="method-name">URIClassifier.new &rarr; URIClassifier<br />
127
- </span>
128
- </a>
129
- </div>
130
-
131
- <div class="method-description">
132
- <p>
133
- Initializes a new <a href="URIClassifier.html">URIClassifier</a> object
134
- that you can use to associate URI sequences with objects. You can actually
135
- use it with any string sequence and any objects, but it&#8217;s mostly used
136
- with URIs.
137
- </p>
138
- <p>
139
- It uses TST from <a
140
- href="http://www.octavian.org/cs/software.html">www.octavian.org/cs/software.html</a>
141
- to build an ternary search trie to hold all of the URIs. It uses this to do
142
- an initial search for the a URI prefix, and then to break the URI into
143
- SCRIPT_NAME and PATH_INFO portions. It actually will do two searches most
144
- of the time in order to find the right handler for the registered prefix
145
- portion.
146
- </p>
147
- </div>
148
- </div>
149
-
150
- <h3 class="section-bar">Public Instance methods</h3>
151
-
152
- <div id="method-M000085" class="method-detail">
153
- <a name="M000085"></a>
154
-
155
- <div class="method-heading">
156
- <a href="URIClassifier.src/M000085.html" target="Code" class="method-signature"
157
- onclick="popupCode('URIClassifier.src/M000085.html');return false;">
158
- <span class="method-name">inspect</span><span class="method-args">()</span>
159
- </a>
160
- </div>
161
-
162
- <div class="method-description">
163
- <p>
164
- Simply does an inspect that looks like a Hash inspect.
165
- </p>
166
- </div>
167
- </div>
168
-
169
- <div id="method-M000087" class="method-detail">
170
- <a name="M000087"></a>
171
-
172
- <div class="method-heading">
173
- <a href="URIClassifier.src/M000087.html" target="Code" class="method-signature"
174
- onclick="popupCode('URIClassifier.src/M000087.html');return false;">
175
- <span class="method-name">uc.register("/someuri", SampleHandler.new) &rarr; nil<br />
176
- </span>
177
- </a>
178
- </div>
179
-
180
- <div class="method-description">
181
- <p>
182
- Registers the SampleHandler (one for all requests) with the
183
- &quot;/someuri&quot;. When URIClassifier::resolve is called with
184
- &quot;/someuri&quot; it&#8217;ll return SampleHandler immediately. When
185
- called with &quot;/someuri/iwant&quot; it&#8217;ll also return SomeHandler
186
- immediatly, with no additional searches, but it will return path info with
187
- &quot;/iwant&quot;.
188
- </p>
189
- <p>
190
- You actually can reuse this class to register nearly anything and quickly
191
- resolve it. This could be used for caching, fast mapping, etc. The downside
192
- is it uses much more memory than a Hash, but it can be a lot faster.
193
- It&#8217;s main advantage is that it works on prefixes, which is damn hard
194
- to get right with a Hash.
195
- </p>
196
- </div>
197
- </div>
198
-
199
- <div id="method-M000089" class="method-detail">
200
- <a name="M000089"></a>
201
-
202
- <div class="method-heading">
203
- <a href="URIClassifier.src/M000089.html" target="Code" class="method-signature"
204
- onclick="popupCode('URIClassifier.src/M000089.html');return false;">
205
- <span class="method-name">uc.resolve("/someuri") &rarr; "/someuri", "", handler<br />
206
- uc.resolve("/someuri/pathinfo") &rarr; "/someuri", "/pathinfo", handler<br />
207
- uc.resolve("/notfound/orhere") &rarr; nil, nil, nil<br />
208
- uc.resolve("/") &rarr; "/", "/", handler # if uc.register("/", handler)<br />
209
- uc.resolve("/path/from/root") &rarr; "/", "/path/from/root", handler # if uc.register("/", handler) <br />
210
- </span>
211
- </a>
212
- </div>
213
-
214
- <div class="method-description">
215
- <p>
216
- Attempts to resolve either the whole URI or at the longest prefix,
217
- returning the prefix (as script_info), path (as path_info), and registered
218
- handler (usually an <a href="HttpHandler.html">HttpHandler</a>). If it
219
- doesn&#8217;t find a handler registered at the longest match then it
220
- returns nil,nil,nil.
221
- </p>
222
- <p>
223
- Because the resolver uses a trie you are able to register a handler at
224
- <b>any</b> character in the URI and it will be handled as long as
225
- it&#8217;s the longest prefix. So, if you registered handler 1 at
226
- &quot;/something/lik&quot;, and 2 at &quot;/something/like/that&quot;, then
227
- a a search for &quot;/something/like&quot; would give you 1. A search for
228
- &quot;/something/like/that/too&quot; would give you 2.
229
- </p>
230
- <p>
231
- This is very powerful since it means you can also attach handlers to parts
232
- of the ; (semi-colon) separated path params, any part of the path, use off
233
- chars, anything really. It also means that it&#8217;s very efficient to do
234
- this only taking as long as the URI has characters.
235
- </p>
236
- <p>
237
- A slight modification to the CGI 1.2 standard is given for handlers
238
- registered to &quot;/&quot;. CGI expects all CGI scripts to be at some
239
- script path, so it doesn&#8217;t really say anything about a script that
240
- handles the root. To make this work, the resolver will detect that the
241
- requested handler is at &quot;/&quot;, and return that for script_name, and
242
- then simply return the full URI back as path_info.
243
- </p>
244
- <p>
245
- It expects strings with no embedded &#8217;\0&#8217; characters.
246
- Don&#8216;t try other string-like stuff yet.
247
- </p>
248
- </div>
249
- </div>
250
-
251
- <div id="method-M000088" class="method-detail">
252
- <a name="M000088"></a>
253
-
254
- <div class="method-heading">
255
- <a href="URIClassifier.src/M000088.html" target="Code" class="method-signature"
256
- onclick="popupCode('URIClassifier.src/M000088.html');return false;">
257
- <span class="method-name">uc.unregister("/someuri")<br />
258
- </span>
259
- </a>
260
- </div>
261
-
262
- <div class="method-description">
263
- <p>
264
- Yep, just removes this uri and it&#8217;s handler from the trie.
265
- </p>
266
- </div>
267
- </div>
268
-
269
- <div id="method-M000084" class="method-detail">
270
- <a name="M000084"></a>
271
-
272
- <div class="method-heading">
273
- <a href="URIClassifier.src/M000084.html" target="Code" class="method-signature"
274
- onclick="popupCode('URIClassifier.src/M000084.html');return false;">
275
- <span class="method-name">uris</span><span class="method-args">()</span>
276
- </a>
277
- </div>
278
-
279
- <div class="method-description">
280
- <p>
281
- Returns the URIs that have been registered with this classifier so far. The
282
- URIs returned should not be modified as this will cause a memory leak. You
283
- can use this to inspect the contents of the <a
284
- href="URIClassifier.html">URIClassifier</a>.
285
- </p>
286
- </div>
287
- </div>
288
-
289
-
290
- </div>
291
-
292
-
293
- </div>
294
-
295
-
296
- <div id="validator-badges">
297
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
298
- </div>
299
-
300
- </body>
301
- </html>