mongrel 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/README +30 -24
  2. data/Rakefile +12 -2
  3. data/bin/mongrel_rails +12 -8
  4. data/doc/rdoc/classes/Mongrel.html +18 -1
  5. data/doc/rdoc/classes/Mongrel/CGIWrapper.html +381 -0
  6. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +24 -0
  7. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +47 -0
  8. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +34 -0
  9. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +27 -0
  10. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html +25 -0
  11. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000056.html +18 -0
  12. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html +18 -0
  13. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html +18 -0
  14. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html +19 -0
  15. data/doc/rdoc/classes/Mongrel/Command.html +119 -0
  16. data/doc/rdoc/classes/Mongrel/Command/Base.html +332 -0
  17. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000003.html +24 -0
  18. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000004.html +41 -0
  19. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000005.html +18 -0
  20. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html +18 -0
  21. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html +18 -0
  22. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html +22 -0
  23. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000009.html +18 -0
  24. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html +18 -0
  25. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html +18 -0
  26. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html +18 -0
  27. data/doc/rdoc/classes/Mongrel/Command/Registry.html +192 -0
  28. data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000013.html +20 -0
  29. data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000014.html +25 -0
  30. data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000015.html +46 -0
  31. data/doc/rdoc/classes/Mongrel/Const.html +2 -2
  32. data/doc/rdoc/classes/Mongrel/DirHandler.html +283 -0
  33. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +20 -0
  34. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +42 -0
  35. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +40 -0
  36. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +31 -0
  37. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +38 -0
  38. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000028.html +18 -0
  39. data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
  40. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000060.html +18 -0
  41. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000061.html +18 -0
  42. data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
  43. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000014.html → M000035.html} +0 -0
  44. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000015.html → M000036.html} +0 -0
  45. data/doc/rdoc/classes/Mongrel/HttpHandler.html +146 -0
  46. data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000037.html +17 -0
  47. data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
  48. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000001.html → M000016.html} +0 -0
  49. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000002.html → M000017.html} +0 -0
  50. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000003.html → M000018.html} +0 -0
  51. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000004.html → M000019.html} +0 -0
  52. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000005.html → M000020.html} +0 -0
  53. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000006.html → M000021.html} +0 -0
  54. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000007.html → M000022.html} +0 -0
  55. data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
  56. data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000029.html → M000062.html} +0 -0
  57. data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
  58. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000016.html → M000038.html} +0 -0
  59. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000017.html → M000039.html} +0 -0
  60. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000018.html → M000040.html} +0 -0
  61. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000019.html → M000041.html} +0 -0
  62. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000020.html → M000042.html} +0 -0
  63. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000021.html → M000043.html} +0 -0
  64. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000022.html → M000044.html} +0 -0
  65. data/doc/rdoc/classes/Mongrel/HttpServer.html +33 -33
  66. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000008.html → M000029.html} +0 -0
  67. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000009.html → M000030.html} +0 -0
  68. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000010.html → M000031.html} +0 -0
  69. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000011.html → M000032.html} +0 -0
  70. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000012.html → M000033.html} +0 -0
  71. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000013.html → M000034.html} +0 -0
  72. data/doc/rdoc/classes/Mongrel/URIClassifier.html +33 -32
  73. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000023.html → M000045.html} +0 -0
  74. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000024.html → M000046.html} +0 -0
  75. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000025.html → M000047.html} +0 -0
  76. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000026.html → M000048.html} +0 -0
  77. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000027.html → M000049.html} +0 -0
  78. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000028.html → M000050.html} +0 -0
  79. data/doc/rdoc/classes/RailsHandler.html +225 -0
  80. data/doc/rdoc/classes/RailsHandler.src/M000001.html +22 -0
  81. data/doc/rdoc/classes/RailsHandler.src/M000002.html +48 -0
  82. data/doc/rdoc/created.rid +1 -1
  83. data/doc/rdoc/files/README.html +45 -50
  84. data/doc/rdoc/files/lib/mongrel/cgi_rb.html +108 -0
  85. data/doc/rdoc/files/lib/mongrel/command_rb.html +110 -0
  86. data/doc/rdoc/files/lib/mongrel/handlers_rb.html +101 -0
  87. data/doc/rdoc/files/lib/mongrel/plugins_rb.html +108 -0
  88. data/doc/rdoc/files/lib/mongrel/rails_rb.html +108 -0
  89. data/doc/rdoc/fr_class_index.html +8 -0
  90. data/doc/rdoc/fr_file_index.html +5 -0
  91. data/doc/rdoc/fr_method_index.html +62 -29
  92. data/lib/mongrel/command.rb +5 -5
  93. data/lib/mongrel/plugins.rb +3 -152
  94. data/lib/mongrel/rails.rb +1 -1
  95. metadata +95 -35
  96. data/test/plugins/commands/test1.rb +0 -19
  97. data/test/test_plugins.rb +0 -45
@@ -90,12 +90,12 @@
90
90
  <h3 class="section-bar">Methods</h3>
91
91
 
92
92
  <div class="name-list">
93
- <a href="#M000024">inspect</a>&nbsp;&nbsp;
94
- <a href="#M000025">new</a>&nbsp;&nbsp;
95
- <a href="#M000026">register</a>&nbsp;&nbsp;
96
- <a href="#M000028">resolve</a>&nbsp;&nbsp;
97
- <a href="#M000027">unregister</a>&nbsp;&nbsp;
98
- <a href="#M000023">uris</a>&nbsp;&nbsp;
93
+ <a href="#M000046">inspect</a>&nbsp;&nbsp;
94
+ <a href="#M000047">new</a>&nbsp;&nbsp;
95
+ <a href="#M000048">register</a>&nbsp;&nbsp;
96
+ <a href="#M000050">resolve</a>&nbsp;&nbsp;
97
+ <a href="#M000049">unregister</a>&nbsp;&nbsp;
98
+ <a href="#M000045">uris</a>&nbsp;&nbsp;
99
99
  </div>
100
100
  </div>
101
101
 
@@ -117,12 +117,12 @@
117
117
  <div id="methods">
118
118
  <h3 class="section-bar">Public Class methods</h3>
119
119
 
120
- <div id="method-M000025" class="method-detail">
121
- <a name="M000025"></a>
120
+ <div id="method-M000047" class="method-detail">
121
+ <a name="M000047"></a>
122
122
 
123
123
  <div class="method-heading">
124
- <a href="URIClassifier.src/M000025.html" target="Code" class="method-signature"
125
- onclick="popupCode('URIClassifier.src/M000025.html');return false;">
124
+ <a href="URIClassifier.src/M000047.html" target="Code" class="method-signature"
125
+ onclick="popupCode('URIClassifier.src/M000047.html');return false;">
126
126
  <span class="method-name">URIClassifier.new &rarr; URIClassifier<br />
127
127
  </span>
128
128
  </a>
@@ -149,12 +149,12 @@ portion.
149
149
 
150
150
  <h3 class="section-bar">Public Instance methods</h3>
151
151
 
152
- <div id="method-M000024" class="method-detail">
153
- <a name="M000024"></a>
152
+ <div id="method-M000046" class="method-detail">
153
+ <a name="M000046"></a>
154
154
 
155
155
  <div class="method-heading">
156
- <a href="URIClassifier.src/M000024.html" target="Code" class="method-signature"
157
- onclick="popupCode('URIClassifier.src/M000024.html');return false;">
156
+ <a href="URIClassifier.src/M000046.html" target="Code" class="method-signature"
157
+ onclick="popupCode('URIClassifier.src/M000046.html');return false;">
158
158
  <span class="method-name">inspect</span><span class="method-args">()</span>
159
159
  </a>
160
160
  </div>
@@ -166,12 +166,12 @@ Simply does an inspect that looks like a Hash inspect.
166
166
  </div>
167
167
  </div>
168
168
 
169
- <div id="method-M000026" class="method-detail">
170
- <a name="M000026"></a>
169
+ <div id="method-M000048" class="method-detail">
170
+ <a name="M000048"></a>
171
171
 
172
172
  <div class="method-heading">
173
- <a href="URIClassifier.src/M000026.html" target="Code" class="method-signature"
174
- onclick="popupCode('URIClassifier.src/M000026.html');return false;">
173
+ <a href="URIClassifier.src/M000048.html" target="Code" class="method-signature"
174
+ onclick="popupCode('URIClassifier.src/M000048.html');return false;">
175
175
  <span class="method-name">uc.register("/someuri", SampleHandler.new) &rarr; nil<br />
176
176
  </span>
177
177
  </a>
@@ -196,12 +196,12 @@ to get right with a Hash.
196
196
  </div>
197
197
  </div>
198
198
 
199
- <div id="method-M000028" class="method-detail">
200
- <a name="M000028"></a>
199
+ <div id="method-M000050" class="method-detail">
200
+ <a name="M000050"></a>
201
201
 
202
202
  <div class="method-heading">
203
- <a href="URIClassifier.src/M000028.html" target="Code" class="method-signature"
204
- onclick="popupCode('URIClassifier.src/M000028.html');return false;">
203
+ <a href="URIClassifier.src/M000050.html" target="Code" class="method-signature"
204
+ onclick="popupCode('URIClassifier.src/M000050.html');return false;">
205
205
  <span class="method-name">uc.resolve("/someuri") &rarr; "/someuri", "", handler<br />
206
206
  uc.resolve("/someuri/pathinfo") &rarr; "/someuri", "/pathinfo", handler<br />
207
207
  uc.resolve("/notfound/orhere") &rarr; nil, nil, nil<br />
@@ -215,8 +215,9 @@ uc.resolve("/path/from/root") &rarr; "/", "/path/from/root", handler # if uc.re
215
215
  <p>
216
216
  Attempts to resolve either the whole URI or at the longest prefix,
217
217
  returning the prefix (as script_info), path (as path_info), and registered
218
- handler (usually an HttpHandler). If it doesn&#8217;t find a handler
219
- registered at the longest match then it returns nil,nil,nil.
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.
220
221
  </p>
221
222
  <p>
222
223
  Because the resolver uses a trie you are able to register a handler at
@@ -247,12 +248,12 @@ Don&#8216;t try other string-like stuff yet.
247
248
  </div>
248
249
  </div>
249
250
 
250
- <div id="method-M000027" class="method-detail">
251
- <a name="M000027"></a>
251
+ <div id="method-M000049" class="method-detail">
252
+ <a name="M000049"></a>
252
253
 
253
254
  <div class="method-heading">
254
- <a href="URIClassifier.src/M000027.html" target="Code" class="method-signature"
255
- onclick="popupCode('URIClassifier.src/M000027.html');return false;">
255
+ <a href="URIClassifier.src/M000049.html" target="Code" class="method-signature"
256
+ onclick="popupCode('URIClassifier.src/M000049.html');return false;">
256
257
  <span class="method-name">uc.unregister("/someuri")<br />
257
258
  </span>
258
259
  </a>
@@ -265,12 +266,12 @@ Yep, just removes this uri and it&#8217;s handler from the trie.
265
266
  </div>
266
267
  </div>
267
268
 
268
- <div id="method-M000023" class="method-detail">
269
- <a name="M000023"></a>
269
+ <div id="method-M000045" class="method-detail">
270
+ <a name="M000045"></a>
270
271
 
271
272
  <div class="method-heading">
272
- <a href="URIClassifier.src/M000023.html" target="Code" class="method-signature"
273
- onclick="popupCode('URIClassifier.src/M000023.html');return false;">
273
+ <a href="URIClassifier.src/M000045.html" target="Code" class="method-signature"
274
+ onclick="popupCode('URIClassifier.src/M000045.html');return false;">
274
275
  <span class="method-name">uris</span><span class="method-args">()</span>
275
276
  </a>
276
277
  </div>
@@ -0,0 +1,225 @@
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: RailsHandler</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">RailsHandler</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/mongrel/rails_rb.html">
59
+ lib/mongrel/rails.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="Mongrel/HttpHandler.html">
69
+ Mongrel::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
+ Implements a handler that can run Rails and serve files out of the Rails
86
+ application&#8217;s public directory. This lets you run your Rails
87
+ application with <a href="Mongrel.html">Mongrel</a> during development and
88
+ testing, then use it also in production behind a server that&#8217;s better
89
+ at serving the static files.
90
+ </p>
91
+ <p>
92
+ The <a href="RailsHandler.html">RailsHandler</a> takes a mime_map parameter
93
+ which is a simple suffix=mimetype mapping that it should add to the list of
94
+ valid mime types.
95
+ </p>
96
+ <p>
97
+ It also supports page caching directly and will try to resolve a request in
98
+ the following order:
99
+ </p>
100
+ <ul>
101
+ <li>If the requested exact PATH_INFO exists as a file then serve it.
102
+
103
+ </li>
104
+ <li>If it exists at PATH_INFO+&quot;.html&quot; exists then serve that.
105
+
106
+ </li>
107
+ <li>Finally, construct a <a
108
+ href="Mongrel/CGIWrapper.html">Mongrel::CGIWrapper</a> and run
109
+ Dispatcher.dispath to have Rails go.
110
+
111
+ </li>
112
+ </ul>
113
+ <p>
114
+ This means that if you are using page caching it will actually work with <a
115
+ href="Mongrel.html">Mongrel</a> and you should see a decent speed boost
116
+ (but not as fast as if you use lighttpd).
117
+ </p>
118
+ <p>
119
+ An additional feature you can use is
120
+ </p>
121
+
122
+ </div>
123
+
124
+
125
+ </div>
126
+
127
+ <div id="method-list">
128
+ <h3 class="section-bar">Methods</h3>
129
+
130
+ <div class="name-list">
131
+ <a href="#M000001">new</a>&nbsp;&nbsp;
132
+ <a href="#M000002">process</a>&nbsp;&nbsp;
133
+ </div>
134
+ </div>
135
+
136
+ </div>
137
+
138
+
139
+ <!-- if includes -->
140
+
141
+ <div id="section">
142
+
143
+
144
+
145
+
146
+
147
+ <div id="attribute-list">
148
+ <h3 class="section-bar">Attributes</h3>
149
+
150
+ <div class="name-list">
151
+ <table>
152
+ <tr class="top-aligned-row context-row">
153
+ <td class="context-item-name">files</td>
154
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
155
+ <td class="context-item-desc"></td>
156
+ </tr>
157
+ </table>
158
+ </div>
159
+ </div>
160
+
161
+
162
+
163
+ <!-- if method_list -->
164
+ <div id="methods">
165
+ <h3 class="section-bar">Public Class methods</h3>
166
+
167
+ <div id="method-M000001" class="method-detail">
168
+ <a name="M000001"></a>
169
+
170
+ <div class="method-heading">
171
+ <a href="RailsHandler.src/M000001.html" target="Code" class="method-signature"
172
+ onclick="popupCode('RailsHandler.src/M000001.html');return false;">
173
+ <span class="method-name">new</span><span class="method-args">(dir, mime_map = {})</span>
174
+ </a>
175
+ </div>
176
+
177
+ <div class="method-description">
178
+ </div>
179
+ </div>
180
+
181
+ <h3 class="section-bar">Public Instance methods</h3>
182
+
183
+ <div id="method-M000002" class="method-detail">
184
+ <a name="M000002"></a>
185
+
186
+ <div class="method-heading">
187
+ <a href="RailsHandler.src/M000002.html" target="Code" class="method-signature"
188
+ onclick="popupCode('RailsHandler.src/M000002.html');return false;">
189
+ <span class="method-name">process</span><span class="method-args">(request, response)</span>
190
+ </a>
191
+ </div>
192
+
193
+ <div class="method-description">
194
+ <p>
195
+ Attempts to resolve the request as follows:
196
+ </p>
197
+ <ul>
198
+ <li>If the requested exact PATH_INFO exists as a file then serve it.
199
+
200
+ </li>
201
+ <li>If it exists at PATH_INFO+&quot;.html&quot; exists then serve that.
202
+
203
+ </li>
204
+ <li>Finally, construct a <a
205
+ href="Mongrel/CGIWrapper.html">Mongrel::CGIWrapper</a> and run
206
+ Dispatcher.dispath to have Rails go.
207
+
208
+ </li>
209
+ </ul>
210
+ </div>
211
+ </div>
212
+
213
+
214
+ </div>
215
+
216
+
217
+ </div>
218
+
219
+
220
+ <div id="validator-badges">
221
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
222
+ </div>
223
+
224
+ </body>
225
+ </html>
@@ -0,0 +1,22 @@
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 (RailsHandler)</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/rails.rb, line 27</span>
14
+ 27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">mime_map</span> = {})
15
+ 28: <span class="ruby-ivar">@files</span> = <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">DirHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-keyword kw">false</span>)
16
+ 29: <span class="ruby-ivar">@guard</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
17
+ 30:
18
+ 31: <span class="ruby-comment cmt"># register the requested mime types</span>
19
+ 32: <span class="ruby-identifier">mime_map</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-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">DirHandler</span><span class="ruby-operator">::</span><span class="ruby-identifier">add_mime_type</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>) }
20
+ 33: <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,48 @@
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 (RailsHandler)</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/rails.rb, line 41</span>
14
+ 41: <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
+ 42: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">closed?</span>
16
+ 43:
17
+ 44: <span class="ruby-identifier">path_info</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>]
18
+ 45: <span class="ruby-identifier">page_cached</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;.html&quot;</span>
19
+ 46:
20
+ 47: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path_info</span>)
21
+ 48: <span class="ruby-comment cmt"># File exists as-is so serve it up</span>
22
+ 49: <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>,<span class="ruby-identifier">response</span>)
23
+ 50: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">page_cached</span>)
24
+ 51: <span class="ruby-comment cmt"># possible cached page, serve it up </span>
25
+ 52: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">page_cached</span>
26
+ 53: <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>,<span class="ruby-identifier">response</span>)
27
+ 54: <span class="ruby-keyword kw">else</span>
28
+ 55: <span class="ruby-identifier">cgi</span> = <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">CGIWrapper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
29
+ 56: <span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">handler</span> = <span class="ruby-keyword kw">self</span>
30
+ 57:
31
+ 58: <span class="ruby-keyword kw">begin</span>
32
+ 59: <span class="ruby-ivar">@guard</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
33
+ 60: <span class="ruby-comment cmt"># Rails is not thread safe so must be run entirely within synchronize </span>
34
+ 61: <span class="ruby-constant">Dispatcher</span>.<span class="ruby-identifier">dispatch</span>(<span class="ruby-identifier">cgi</span>, <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">CgiRequest</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_SESSION_OPTIONS</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
35
+ 62: <span class="ruby-keyword kw">end</span>
36
+ 63:
37
+ 64: <span class="ruby-comment cmt"># This finalizes the output using the proper HttpResponse way</span>
38
+ 65: <span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">out</span> {<span class="ruby-value str">&quot;&quot;</span>}
39
+ 66: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
40
+ 67: <span class="ruby-comment cmt"># ignored</span>
41
+ 68: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rails_error</span>
42
+ 69: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error calling Dispatcher.dispatch #{rails_error.inspect}&quot;</span>
43
+ 70: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">rails_error</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
44
+ 71: <span class="ruby-keyword kw">end</span>
45
+ 72: <span class="ruby-keyword kw">end</span>
46
+ 73: <span class="ruby-keyword kw">end</span></pre>
47
+ </body>
48
+ </html>