mongrel 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +4 -2
- data/bin/mongrel_rails +65 -101
- data/bin/mongrel_rails_service +1 -1
- data/bin/mongrel_rails_svc +131 -115
- data/doc/rdoc/classes/Class.html +197 -0
- data/doc/rdoc/classes/Class.src/M000001.html +24 -0
- data/doc/rdoc/classes/Class.src/M000002.html +62 -0
- data/doc/rdoc/classes/Class.src/M000003.html +21 -0
- data/doc/rdoc/classes/Class.src/M000004.html +20 -0
- data/doc/rdoc/classes/IO.html +170 -0
- data/doc/rdoc/classes/IO.src/M000005.html +19 -0
- data/doc/rdoc/classes/IO.src/M000006.html +19 -0
- data/doc/rdoc/classes/Kernel.html +159 -0
- data/doc/rdoc/classes/Kernel.src/M000025.html +19 -0
- data/doc/rdoc/classes/Kernel.src/M000026.html +25 -0
- data/doc/rdoc/classes/Mongrel.html +181 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +383 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000090.html +24 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000091.html +47 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000092.html +34 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000093.html +27 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000094.html +25 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000095.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000096.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000097.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000098.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +177 -0
- data/doc/rdoc/classes/Mongrel/Camping.src/M000048.html +22 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +165 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000049.html +18 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000050.html +27 -0
- data/doc/rdoc/classes/Mongrel/Command.html +119 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +337 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +24 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +41 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000031.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000032.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000033.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000034.html +22 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000035.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000036.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000037.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000038.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +192 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000039.html +20 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000040.html +25 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000041.html +46 -0
- data/doc/rdoc/classes/Mongrel/Configurator.html +563 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +24 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +23 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +32 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +19 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +31 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +33 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +25 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +19 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +22 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +21 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +27 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +46 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +18 -0
- data/doc/rdoc/classes/Mongrel/Const.html +286 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.html +288 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000058.html +20 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000059.html +42 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000060.html +40 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html +51 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000062.html +40 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000063.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +185 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +152 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000074.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +169 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000027.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000028.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +271 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000051.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000052.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000053.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +41 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000055.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000056.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000057.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +222 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html +32 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +371 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +26 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +25 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +23 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +360 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +24 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +65 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +24 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +60 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +18 -0
- data/doc/rdoc/classes/Mongrel/Rails.html +112 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +223 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000042.html +35 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000043.html +25 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000044.html +32 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +250 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000045.html +22 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000046.html +48 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000047.html +23 -0
- data/doc/rdoc/classes/Mongrel/StopServer.html +117 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +301 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000084.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000085.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000086.html +39 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000087.html +51 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000088.html +36 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html +83 -0
- data/doc/rdoc/classes/MongrelDbg.html +209 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000020.html +19 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000021.html +20 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000022.html +22 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000023.html +21 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000024.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.html +176 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000016.html +22 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000017.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000018.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000019.html +46 -0
- data/doc/rdoc/classes/RequestLog.html +113 -0
- data/doc/rdoc/classes/RequestLog/Files.html +144 -0
- data/doc/rdoc/classes/RequestLog/Files.src/M000121.html +19 -0
- data/doc/rdoc/classes/RequestLog/Objects.html +144 -0
- data/doc/rdoc/classes/RequestLog/Objects.src/M000122.html +19 -0
- data/doc/rdoc/classes/RequestLog/Params.html +144 -0
- data/doc/rdoc/classes/RequestLog/Params.src/M000123.html +19 -0
- data/doc/rdoc/classes/Stats.html +306 -0
- data/doc/rdoc/classes/Stats.src/M000009.html +19 -0
- data/doc/rdoc/classes/Stats.src/M000010.html +23 -0
- data/doc/rdoc/classes/Stats.src/M000011.html +26 -0
- data/doc/rdoc/classes/Stats.src/M000012.html +18 -0
- data/doc/rdoc/classes/Stats.src/M000013.html +18 -0
- data/doc/rdoc/classes/Stats.src/M000014.html +19 -0
- data/doc/rdoc/classes/Stats.src/M000015.html +20 -0
- data/doc/rdoc/classes/TCPServer.html +173 -0
- data/doc/rdoc/classes/TCPServer.src/M000007.html +19 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +756 -0
- data/doc/rdoc/files/LICENSE.html +756 -0
- data/doc/rdoc/files/README.html +302 -0
- data/doc/rdoc/files/ext/http11/http11_c.html +101 -0
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/command_rb.html +111 -0
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +110 -0
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel/init_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +111 -0
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +117 -0
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel_rb.html +118 -0
- data/doc/rdoc/fr_class_index.html +60 -0
- data/doc/rdoc/fr_file_index.html +40 -0
- data/doc/rdoc/fr_method_index.html +149 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/builder.rb +29 -0
- data/examples/camping/blog.rb +11 -2
- data/examples/simpletest.rb +20 -7
- data/ext/http11/http11.c +71 -14
- data/ext/http11/http11_parser.c +27 -24
- data/ext/http11/http11_parser.h +2 -1
- data/lib/http11.bundle +0 -0
- data/lib/mongrel.rb +498 -135
- data/lib/mongrel/command.rb +1 -1
- data/lib/mongrel/debug.rb +259 -0
- data/lib/mongrel/handlers.rb +76 -22
- data/lib/mongrel/rails.rb +165 -72
- data/lib/mongrel/stats.rb +71 -0
- data/test/test_configurator.rb +67 -0
- data/test/test_debug.rb +31 -0
- data/test/test_http11.rb +16 -0
- data/test/test_response.rb +5 -0
- data/test/test_stats.rb +28 -0
- metadata +224 -2
|
@@ -0,0 +1,20 @@
|
|
|
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>escape (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 164</span>
|
|
14
|
+
164: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
|
|
15
|
+
165: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {
|
|
16
|
+
166: <span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>
|
|
17
|
+
167: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
|
|
18
|
+
168: <span class="ruby-keyword kw">end</span></pre>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
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>unescape (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 171</span>
|
|
14
|
+
171: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>)
|
|
15
|
+
172: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'+'</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/((?:%[0-9a-fA-F]{2})+)/n</span>){
|
|
16
|
+
173: [<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'%'</span>)].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">'H*'</span>)
|
|
17
|
+
174: }
|
|
18
|
+
175: <span class="ruby-keyword kw">end</span></pre>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
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>query_parse (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 178</span>
|
|
14
|
+
178: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">query_parse</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-value str">'&;'</span>)
|
|
15
|
+
179: <span class="ruby-identifier">params</span> = {}
|
|
16
|
+
180: (<span class="ruby-identifier">qs</span><span class="ruby-operator">||</span><span class="ruby-value str">''</span>).<span class="ruby-identifier">split</span>(<span class="ruby-node">/[#{d}] */n</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">params</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
|
17
|
+
181: <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>=<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'='</span>,<span class="ruby-value">2</span>)
|
|
18
|
+
182: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>]
|
|
19
|
+
183: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
|
|
20
|
+
184: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>
|
|
21
|
+
185: <span class="ruby-keyword kw">else</span>
|
|
22
|
+
186: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = [<span class="ruby-identifier">cur</span>, <span class="ruby-identifier">v</span>]
|
|
23
|
+
187: <span class="ruby-keyword kw">end</span>
|
|
24
|
+
188: <span class="ruby-keyword kw">else</span>
|
|
25
|
+
189: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
26
|
+
190: <span class="ruby-keyword kw">end</span>
|
|
27
|
+
191: }
|
|
28
|
+
192:
|
|
29
|
+
193: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>
|
|
30
|
+
194: <span class="ruby-keyword kw">end</span></pre>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,371 @@
|
|
|
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("hello\n")
|
|
90
|
+
end
|
|
91
|
+
</pre>
|
|
92
|
+
<p>
|
|
93
|
+
The parameter to start is the response code—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’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’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 "Connection:
|
|
115
|
+
close" 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’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>
|
|
135
|
+
<a href="#M000082">finished</a>
|
|
136
|
+
<a href="#M000075">new</a>
|
|
137
|
+
<a href="#M000077">reset</a>
|
|
138
|
+
<a href="#M000080">send_body</a>
|
|
139
|
+
<a href="#M000079">send_header</a>
|
|
140
|
+
<a href="#M000078">send_status</a>
|
|
141
|
+
<a href="#M000076">start</a>
|
|
142
|
+
<a href="#M000081">write</a>
|
|
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"> [R] </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"> [R] </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"> [R] </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"> [R] </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"> [R] </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"> [R] </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"> [W] </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"> [R] </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’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
|
+
"finalize=true" to the start method. By default all handlers run
|
|
340
|
+
and then mongrel finalizes the request when they’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>
|
|
@@ -0,0 +1,26 @@
|
|
|
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::HttpResponse)</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 260</span>
|
|
14
|
+
260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>, <span class="ruby-identifier">filter</span> = <span class="ruby-keyword kw">nil</span>)
|
|
15
|
+
261: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
16
|
+
262: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
17
|
+
263: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
|
18
|
+
264: <span class="ruby-ivar">@header</span> = <span class="ruby-constant">HeaderOut</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>)
|
|
19
|
+
265: <span class="ruby-ivar">@header</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE</span>] = <span class="ruby-constant">HttpServer</span>.<span class="ruby-identifier">httpdate</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
|
20
|
+
266: <span class="ruby-ivar">@filter</span> = <span class="ruby-identifier">filter</span>
|
|
21
|
+
267: <span class="ruby-ivar">@body_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
22
|
+
268: <span class="ruby-ivar">@header_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
23
|
+
269: <span class="ruby-ivar">@status_sent</span> = <span class="ruby-keyword kw">false</span>
|
|
24
|
+
270: <span class="ruby-keyword kw">end</span></pre>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|