mongrel 1.0.1 → 1.0.2
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.tar.gz.sig +2 -0
- data/CHANGELOG +2 -0
- data/Manifest +68 -0
- data/bin/mongrel_rails +55 -22
- data/examples/camping/README +3 -0
- data/examples/httpd.conf +474 -0
- data/examples/mime.yaml +3 -0
- data/examples/mongrel.conf +9 -0
- data/examples/monitrc +57 -0
- data/ext/http11/http11.c +25 -12
- data/ext/http11/http11_parser.c +456 -331
- data/ext/http11/http11_parser.h +1 -0
- data/ext/http11/http11_parser.java.rl +170 -0
- data/ext/http11/http11_parser.rl +8 -48
- data/ext/http11/http11_parser_common.rl +54 -0
- data/ext/http11/tst.h +2 -2
- data/ext/http11/tst_cleanup.c +0 -1
- data/ext/http11/tst_insert.c +29 -3
- data/ext/http11/tst_search.c +60 -55
- data/lib/mongrel.rb +68 -53
- data/lib/mongrel/cgi.rb +3 -3
- data/lib/mongrel/command.rb +1 -1
- data/lib/mongrel/configurator.rb +41 -31
- data/lib/mongrel/debug.rb +2 -5
- data/lib/mongrel/handlers.rb +23 -9
- data/lib/mongrel/mime_types.yml +2 -1
- data/lib/mongrel/rails.rb +7 -15
- data/mongrel-public_cert.pem +20 -0
- data/mongrel.gemspec +211 -0
- data/test/jruby_socket.rb +39 -0
- data/test/test_cgi_wrapper.rb +26 -0
- data/test/test_command.rb +1 -4
- data/test/test_conditional.rb +6 -18
- data/test/test_configurator.rb +5 -8
- data/test/test_debug.rb +3 -11
- data/test/test_handlers.rb +8 -10
- data/test/test_http11.rb +24 -5
- data/test/test_redirect_handler.rb +2 -6
- data/test/test_request_progress.rb +5 -9
- data/test/test_response.rb +24 -3
- data/test/test_stats.rb +1 -3
- data/test/test_uriclassifier.rb +170 -81
- data/test/test_ws.rb +25 -24
- data/test/testhelp.rb +26 -3
- data/tools/trickletest.rb +2 -2
- metadata +138 -333
- metadata.gz.sig +0 -0
- data/Rakefile +0 -117
- data/doc/rdoc/classes/IO.html +0 -170
- data/doc/rdoc/classes/IO.src/M000003.html +0 -19
- data/doc/rdoc/classes/IO.src/M000004.html +0 -19
- data/doc/rdoc/classes/Kernel.html +0 -159
- data/doc/rdoc/classes/Kernel.src/M000012.html +0 -19
- data/doc/rdoc/classes/Kernel.src/M000013.html +0 -23
- data/doc/rdoc/classes/Mongrel.html +0 -204
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -404
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000115.html +0 -25
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000116.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000117.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000118.html +0 -32
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000119.html +0 -25
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000120.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000121.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000122.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000123.html +0 -19
- data/doc/rdoc/classes/Mongrel/Camping.html +0 -177
- data/doc/rdoc/classes/Mongrel/Camping.src/M000041.html +0 -22
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +0 -184
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000042.html +0 -20
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000043.html +0 -58
- data/doc/rdoc/classes/Mongrel/Command.html +0 -132
- data/doc/rdoc/classes/Mongrel/Command/Base.html +0 -384
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000018.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000019.html +0 -42
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000020.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000021.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000022.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000023.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000024.html +0 -22
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000025.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000026.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000027.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000028.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +0 -192
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000031.html +0 -20
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000032.html +0 -29
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000033.html +0 -58
- data/doc/rdoc/classes/Mongrel/Configurator.html +0 -716
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000093.html +0 -27
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000094.html +0 -31
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000095.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000096.html +0 -21
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000097.html +0 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000098.html +0 -23
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +0 -38
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +0 -19
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +0 -39
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +0 -33
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +0 -24
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +0 -19
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +0 -22
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +0 -22
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +0 -34
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +0 -36
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +0 -18
- data/doc/rdoc/classes/Mongrel/Const.html +0 -337
- data/doc/rdoc/classes/Mongrel/DeflateFilter.html +0 -188
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/M000124.html +0 -19
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/M000125.html +0 -23
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -303
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000051.html +0 -21
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000052.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000053.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000054.html +0 -65
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000055.html +0 -39
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000056.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000126.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000127.html +0 -18
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +0 -190
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000066.html +0 -21
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000067.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +0 -215
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000072.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000073.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000074.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +0 -210
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000014.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000015.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000016.html +0 -19
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000017.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpParams.html +0 -131
- data/doc/rdoc/classes/Mongrel/HttpParser.html +0 -278
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000044.html +0 -28
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000045.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000046.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000047.html +0 -59
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000048.html +0 -27
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000049.html +0 -27
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000050.html +0 -28
- data/doc/rdoc/classes/Mongrel/HttpParserError.html +0 -111
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +0 -284
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000133.html +0 -50
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000134.html +0 -41
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000135.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000136.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000137.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000138.html +0 -32
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +0 -443
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +0 -26
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +0 -22
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +0 -22
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +0 -22
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000084.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000085.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000086.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpServer.html +0 -402
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000057.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000058.html +0 -100
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000059.html +0 -32
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000060.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000061.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000062.html +0 -65
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000063.html +0 -34
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +0 -22
- data/doc/rdoc/classes/Mongrel/Rails.html +0 -112
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +0 -225
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000034.html +0 -37
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000035.html +0 -25
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000036.html +0 -26
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +0 -263
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000037.html +0 -23
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000038.html +0 -56
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000039.html +0 -20
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000040.html +0 -25
- data/doc/rdoc/classes/Mongrel/RedirectHandler.html +0 -187
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/M000131.html +0 -22
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/M000132.html +0 -27
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.html +0 -211
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000128.html +0 -24
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000129.html +0 -24
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000130.html +0 -18
- data/doc/rdoc/classes/Mongrel/Stats.html +0 -309
- data/doc/rdoc/classes/Mongrel/Stats.src/M000139.html +0 -19
- data/doc/rdoc/classes/Mongrel/Stats.src/M000140.html +0 -23
- data/doc/rdoc/classes/Mongrel/Stats.src/M000141.html +0 -26
- data/doc/rdoc/classes/Mongrel/Stats.src/M000142.html +0 -18
- data/doc/rdoc/classes/Mongrel/Stats.src/M000143.html +0 -18
- data/doc/rdoc/classes/Mongrel/Stats.src/M000144.html +0 -18
- data/doc/rdoc/classes/Mongrel/Stats.src/M000145.html +0 -23
- data/doc/rdoc/classes/Mongrel/Stats.src/M000146.html +0 -20
- data/doc/rdoc/classes/Mongrel/StatusHandler.html +0 -194
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000068.html +0 -18
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000069.html +0 -24
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000070.html +0 -42
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000071.html +0 -20
- data/doc/rdoc/classes/Mongrel/StopServer.html +0 -117
- data/doc/rdoc/classes/Mongrel/TimeoutError.html +0 -117
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +0 -317
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000087.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000088.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html +0 -39
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000090.html +0 -51
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000091.html +0 -36
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000092.html +0 -83
- data/doc/rdoc/classes/MongrelDbg.html +0 -209
- data/doc/rdoc/classes/MongrelDbg.src/M000007.html +0 -24
- data/doc/rdoc/classes/MongrelDbg.src/M000008.html +0 -20
- data/doc/rdoc/classes/MongrelDbg.src/M000009.html +0 -22
- data/doc/rdoc/classes/MongrelDbg.src/M000010.html +0 -21
- data/doc/rdoc/classes/MongrelDbg.src/M000011.html +0 -18
- data/doc/rdoc/classes/Mutex.html +0 -158
- data/doc/rdoc/classes/Mutex.src/M000001.html +0 -24
- data/doc/rdoc/classes/Mutex.src/M000002.html +0 -32
- data/doc/rdoc/classes/RequestLog.html +0 -115
- data/doc/rdoc/classes/RequestLog/Access.html +0 -151
- data/doc/rdoc/classes/RequestLog/Access.src/M000147.html +0 -19
- data/doc/rdoc/classes/RequestLog/Files.html +0 -144
- data/doc/rdoc/classes/RequestLog/Files.src/M000148.html +0 -19
- data/doc/rdoc/classes/RequestLog/Objects.html +0 -150
- data/doc/rdoc/classes/RequestLog/Objects.src/M000150.html +0 -51
- data/doc/rdoc/classes/RequestLog/Params.html +0 -144
- data/doc/rdoc/classes/RequestLog/Params.src/M000151.html +0 -19
- data/doc/rdoc/classes/RequestLog/Threads.html +0 -144
- data/doc/rdoc/classes/RequestLog/Threads.src/M000149.html +0 -34
- data/doc/rdoc/classes/TCPServer.html +0 -173
- data/doc/rdoc/classes/TCPServer.src/M000005.html +0 -19
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -168
- data/doc/rdoc/files/LICENSE.html +0 -168
- data/doc/rdoc/files/README.html +0 -213
- data/doc/rdoc/files/ext/http11/http11_c.html +0 -101
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +0 -120
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +0 -120
- data/doc/rdoc/files/lib/mongrel/command_rb.html +0 -123
- data/doc/rdoc/files/lib/mongrel/configurator_rb.html +0 -111
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +0 -122
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +0 -122
- data/doc/rdoc/files/lib/mongrel/init_rb.html +0 -121
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +0 -123
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +0 -113
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +0 -113
- data/doc/rdoc/files/lib/mongrel_rb.html +0 -135
- data/doc/rdoc/files/lib/mutex_fix_rb.html +0 -108
- data/doc/rdoc/fr_class_index.html +0 -68
- data/doc/rdoc/fr_file_index.html +0 -42
- data/doc/rdoc/fr_method_index.html +0 -177
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/tools/rakehelp.rb +0 -117
|
@@ -1,50 +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 198</span>
|
|
14
|
-
198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">socket</span>, <span class="ruby-identifier">dispatchers</span>)
|
|
15
|
-
199: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
|
16
|
-
200: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
|
17
|
-
201: <span class="ruby-ivar">@dispatchers</span> = <span class="ruby-identifier">dispatchers</span>
|
|
18
|
-
202: <span class="ruby-identifier">content_length</span> = <span class="ruby-ivar">@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>
|
|
19
|
-
203: <span class="ruby-identifier">remain</span> = <span class="ruby-identifier">content_length</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span>.<span class="ruby-identifier">length</span>
|
|
20
|
-
204:
|
|
21
|
-
205: <span class="ruby-comment cmt"># tell all dispatchers the request has begun</span>
|
|
22
|
-
206: <span class="ruby-ivar">@dispatchers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dispatcher</span><span class="ruby-operator">|</span>
|
|
23
|
-
207: <span class="ruby-identifier">dispatcher</span>.<span class="ruby-identifier">request_begins</span>(<span class="ruby-ivar">@params</span>)
|
|
24
|
-
208: <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@dispatchers</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@dispatchers</span>.<span class="ruby-identifier">empty?</span>
|
|
25
|
-
209:
|
|
26
|
-
210: <span class="ruby-comment cmt"># Some clients (like FF1.0) report 0 for body and then send a body. This will probably truncate them but at least the request goes through usually.</span>
|
|
27
|
-
211: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">remain</span> <span class="ruby-operator"><=</span> <span class="ruby-value">0</span>
|
|
28
|
-
212: <span class="ruby-comment cmt"># we've got everything, pack it up</span>
|
|
29
|
-
213: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
30
|
-
214: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">write</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span>
|
|
31
|
-
215: <span class="ruby-identifier">update_request_progress</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">content_length</span>)
|
|
32
|
-
216: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">remain</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
33
|
-
217: <span class="ruby-comment cmt"># must read more data to complete body</span>
|
|
34
|
-
218: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">remain</span> <span class="ruby-operator">></span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_BODY</span>
|
|
35
|
-
219: <span class="ruby-comment cmt"># huge body, put it in a tempfile</span>
|
|
36
|
-
220: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MONGREL_TMP_BASE</span>)
|
|
37
|
-
221: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">binmode</span>
|
|
38
|
-
222: <span class="ruby-keyword kw">else</span>
|
|
39
|
-
223: <span class="ruby-comment cmt"># small body, just use that</span>
|
|
40
|
-
224: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
41
|
-
225: <span class="ruby-keyword kw">end</span>
|
|
42
|
-
226:
|
|
43
|
-
227: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">write</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span>
|
|
44
|
-
228: <span class="ruby-identifier">read_body</span>(<span class="ruby-identifier">remain</span>, <span class="ruby-identifier">content_length</span>)
|
|
45
|
-
229: <span class="ruby-keyword kw">end</span>
|
|
46
|
-
230:
|
|
47
|
-
231: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>
|
|
48
|
-
232: <span class="ruby-keyword kw">end</span></pre>
|
|
49
|
-
</body>
|
|
50
|
-
</html>
|
|
@@ -1,41 +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>read_body (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 247</span>
|
|
14
|
-
247: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_body</span>(<span class="ruby-identifier">remain</span>, <span class="ruby-identifier">total</span>)
|
|
15
|
-
248: <span class="ruby-keyword kw">begin</span>
|
|
16
|
-
249: <span class="ruby-comment cmt"># write the odd sized chunk first</span>
|
|
17
|
-
250: <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span> = <span class="ruby-identifier">read_socket</span>(<span class="ruby-identifier">remain</span> <span class="ruby-operator">%</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
|
18
|
-
251:
|
|
19
|
-
252: <span class="ruby-identifier">remain</span> <span class="ruby-operator">-=</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span>)
|
|
20
|
-
253:
|
|
21
|
-
254: <span class="ruby-identifier">update_request_progress</span>(<span class="ruby-identifier">remain</span>, <span class="ruby-identifier">total</span>)
|
|
22
|
-
255:
|
|
23
|
-
256: <span class="ruby-comment cmt"># then stream out nothing but perfectly sized chunks</span>
|
|
24
|
-
257: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">remain</span> <span class="ruby-operator"><=</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
|
25
|
-
258: <span class="ruby-comment cmt"># ASSUME: we are writing to a disk and these writes always write the requested amount</span>
|
|
26
|
-
259: <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span> = <span class="ruby-identifier">read_socket</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
|
27
|
-
260: <span class="ruby-identifier">remain</span> <span class="ruby-operator">-=</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@params</span>.<span class="ruby-identifier">http_body</span>)
|
|
28
|
-
261:
|
|
29
|
-
262: <span class="ruby-identifier">update_request_progress</span>(<span class="ruby-identifier">remain</span>, <span class="ruby-identifier">total</span>)
|
|
30
|
-
263: <span class="ruby-keyword kw">end</span>
|
|
31
|
-
264: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
|
|
32
|
-
265: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"ERROR reading http body: #$!"</span>
|
|
33
|
-
266: <span class="ruby-identifier">$!</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
|
34
|
-
267: <span class="ruby-comment cmt"># any errors means we should delete the file, including if the file is dumped</span>
|
|
35
|
-
268: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
|
|
36
|
-
269: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Tempfile</span>
|
|
37
|
-
270: <span class="ruby-ivar">@body</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># signals that there was a problem</span>
|
|
38
|
-
271: <span class="ruby-keyword kw">end</span>
|
|
39
|
-
272: <span class="ruby-keyword kw">end</span></pre>
|
|
40
|
-
</body>
|
|
41
|
-
</html>
|
|
@@ -1,29 +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>read_socket (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 274</span>
|
|
14
|
-
274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_socket</span>(<span class="ruby-identifier">len</span>)
|
|
15
|
-
275: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
|
16
|
-
276: <span class="ruby-identifier">data</span> = <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">len</span>)
|
|
17
|
-
277: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">data</span>
|
|
18
|
-
278: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Socket read return nil"</span>
|
|
19
|
-
279: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">len</span>
|
|
20
|
-
280: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Socket read returned insufficient data: #{data.length}"</span>
|
|
21
|
-
281: <span class="ruby-keyword kw">else</span>
|
|
22
|
-
282: <span class="ruby-identifier">data</span>
|
|
23
|
-
283: <span class="ruby-keyword kw">end</span>
|
|
24
|
-
284: <span class="ruby-keyword kw">else</span>
|
|
25
|
-
285: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Socket already closed when reading."</span>
|
|
26
|
-
286: <span class="ruby-keyword kw">end</span>
|
|
27
|
-
287: <span class="ruby-keyword kw">end</span></pre>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
@@ -1,20 +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>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 292</span>
|
|
14
|
-
292: <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
|
-
293: <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
|
-
294: <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
|
-
295: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
|
|
18
|
-
296: <span class="ruby-keyword kw">end</span></pre>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,20 +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>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 300</span>
|
|
14
|
-
300: <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
|
-
301: <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
|
-
302: [<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
|
-
303: }
|
|
18
|
-
304: <span class="ruby-keyword kw">end</span></pre>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,32 +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>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 310</span>
|
|
14
|
-
310: <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
|
-
311: <span class="ruby-identifier">params</span> = {}
|
|
16
|
-
312: (<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
|
-
313: <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
|
-
314: <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
|
-
315: <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
|
-
316: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>
|
|
21
|
-
317: <span class="ruby-keyword kw">else</span>
|
|
22
|
-
318: <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
|
-
319: <span class="ruby-keyword kw">end</span>
|
|
24
|
-
320: <span class="ruby-keyword kw">else</span>
|
|
25
|
-
321: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
26
|
-
322: <span class="ruby-keyword kw">end</span>
|
|
27
|
-
323: }
|
|
28
|
-
324:
|
|
29
|
-
325: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>
|
|
30
|
-
326: <span class="ruby-keyword kw">end</span></pre>
|
|
31
|
-
</body>
|
|
32
|
-
</html>
|
|
@@ -1,443 +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("hello\n")
|
|
90
|
-
end
|
|
91
|
-
</pre>
|
|
92
|
-
<p>
|
|
93
|
-
The parameter to <a href="HttpResponse.html#M000076">start</a> is the
|
|
94
|
-
response code—which <a href="../Mongrel.html">Mongrel</a> will
|
|
95
|
-
translate for you based on HTTP_STATUS_CODES. The head parameter is how you
|
|
96
|
-
<a href="HttpResponse.html#M000083">write</a> custom headers. The out
|
|
97
|
-
parameter is where you <a href="HttpResponse.html#M000083">write</a> your
|
|
98
|
-
body. The default status code for <a
|
|
99
|
-
href="HttpResponse.html#M000076">HttpResponse.start</a> is 200 so the above
|
|
100
|
-
example is redundant.
|
|
101
|
-
</p>
|
|
102
|
-
<p>
|
|
103
|
-
As you can see, it‘s just like using a Hash and as you do this it
|
|
104
|
-
writes the proper header to the output on the fly. You can even intermix
|
|
105
|
-
specifying headers and writing content. The <a
|
|
106
|
-
href="HttpResponse.html">HttpResponse</a> class with <a
|
|
107
|
-
href="HttpResponse.html#M000083">write</a> the things in the proper order
|
|
108
|
-
once the HttpResponse.block is ended.
|
|
109
|
-
</p>
|
|
110
|
-
<p>
|
|
111
|
-
You may also work the <a href="HttpResponse.html">HttpResponse</a> object
|
|
112
|
-
directly using the various attributes available for the raw socket, body,
|
|
113
|
-
header, and status codes. If you do this you‘re on your own. A design
|
|
114
|
-
decision was made to force the client to not pipeline requests. HTTP/1.1
|
|
115
|
-
pipelining really kills the performance due to how it has to be handled and
|
|
116
|
-
how unclear the standard is. To fix this the <a
|
|
117
|
-
href="HttpResponse.html">HttpResponse</a> gives a "Connection:
|
|
118
|
-
close" header which forces the client to close right away. The bonus
|
|
119
|
-
for this is that it gives a pretty nice speed boost to most clients since
|
|
120
|
-
they can close their connection immediately.
|
|
121
|
-
</p>
|
|
122
|
-
<p>
|
|
123
|
-
One additional caveat is that you don‘t have to specify the
|
|
124
|
-
Content-length header as the <a href="HttpResponse.html">HttpResponse</a>
|
|
125
|
-
will <a href="HttpResponse.html#M000083">write</a> this for you based on
|
|
126
|
-
the out length.
|
|
127
|
-
</p>
|
|
128
|
-
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
<div id="method-list">
|
|
135
|
-
<h3 class="section-bar">Methods</h3>
|
|
136
|
-
|
|
137
|
-
<div class="name-list">
|
|
138
|
-
<a href="#M000086">done</a>
|
|
139
|
-
<a href="#M000085">done=</a>
|
|
140
|
-
<a href="#M000084">finished</a>
|
|
141
|
-
<a href="#M000075">new</a>
|
|
142
|
-
<a href="#M000077">reset</a>
|
|
143
|
-
<a href="#M000080">send_body</a>
|
|
144
|
-
<a href="#M000081">send_file</a>
|
|
145
|
-
<a href="#M000079">send_header</a>
|
|
146
|
-
<a href="#M000078">send_status</a>
|
|
147
|
-
<a href="#M000082">socket_error</a>
|
|
148
|
-
<a href="#M000076">start</a>
|
|
149
|
-
<a href="#M000083">write</a>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<!-- if includes -->
|
|
157
|
-
|
|
158
|
-
<div id="section">
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<div id="attribute-list">
|
|
165
|
-
<h3 class="section-bar">Attributes</h3>
|
|
166
|
-
|
|
167
|
-
<div class="name-list">
|
|
168
|
-
<table>
|
|
169
|
-
<tr class="top-aligned-row context-row">
|
|
170
|
-
<td class="context-item-name">body</td>
|
|
171
|
-
<td class="context-item-value"> [W] </td>
|
|
172
|
-
<td class="context-item-desc"></td>
|
|
173
|
-
</tr>
|
|
174
|
-
<tr class="top-aligned-row context-row">
|
|
175
|
-
<td class="context-item-name">body</td>
|
|
176
|
-
<td class="context-item-value"> [R] </td>
|
|
177
|
-
<td class="context-item-desc"></td>
|
|
178
|
-
</tr>
|
|
179
|
-
<tr class="top-aligned-row context-row">
|
|
180
|
-
<td class="context-item-name">body_sent</td>
|
|
181
|
-
<td class="context-item-value"> [R] </td>
|
|
182
|
-
<td class="context-item-desc"></td>
|
|
183
|
-
</tr>
|
|
184
|
-
<tr class="top-aligned-row context-row">
|
|
185
|
-
<td class="context-item-name">header</td>
|
|
186
|
-
<td class="context-item-value"> [R] </td>
|
|
187
|
-
<td class="context-item-desc"></td>
|
|
188
|
-
</tr>
|
|
189
|
-
<tr class="top-aligned-row context-row">
|
|
190
|
-
<td class="context-item-name">header_sent</td>
|
|
191
|
-
<td class="context-item-value"> [R] </td>
|
|
192
|
-
<td class="context-item-desc"></td>
|
|
193
|
-
</tr>
|
|
194
|
-
<tr class="top-aligned-row context-row">
|
|
195
|
-
<td class="context-item-name">socket</td>
|
|
196
|
-
<td class="context-item-value"> [R] </td>
|
|
197
|
-
<td class="context-item-desc"></td>
|
|
198
|
-
</tr>
|
|
199
|
-
<tr class="top-aligned-row context-row">
|
|
200
|
-
<td class="context-item-name">status</td>
|
|
201
|
-
<td class="context-item-value"> [W] </td>
|
|
202
|
-
<td class="context-item-desc"></td>
|
|
203
|
-
</tr>
|
|
204
|
-
<tr class="top-aligned-row context-row">
|
|
205
|
-
<td class="context-item-name">status</td>
|
|
206
|
-
<td class="context-item-value"> [R] </td>
|
|
207
|
-
<td class="context-item-desc"></td>
|
|
208
|
-
</tr>
|
|
209
|
-
<tr class="top-aligned-row context-row">
|
|
210
|
-
<td class="context-item-name">status_sent</td>
|
|
211
|
-
<td class="context-item-value"> [R] </td>
|
|
212
|
-
<td class="context-item-desc"></td>
|
|
213
|
-
</tr>
|
|
214
|
-
</table>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<!-- if method_list -->
|
|
221
|
-
<div id="methods">
|
|
222
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
223
|
-
|
|
224
|
-
<div id="method-M000075" class="method-detail">
|
|
225
|
-
<a name="M000075"></a>
|
|
226
|
-
|
|
227
|
-
<div class="method-heading">
|
|
228
|
-
<a href="HttpResponse.src/M000075.html" target="Code" class="method-signature"
|
|
229
|
-
onclick="popupCode('HttpResponse.src/M000075.html');return false;">
|
|
230
|
-
<span class="method-name">new</span><span class="method-args">(socket)</span>
|
|
231
|
-
</a>
|
|
232
|
-
</div>
|
|
233
|
-
|
|
234
|
-
<div class="method-description">
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
239
|
-
|
|
240
|
-
<div id="method-M000086" class="method-detail">
|
|
241
|
-
<a name="M000086"></a>
|
|
242
|
-
|
|
243
|
-
<div class="method-heading">
|
|
244
|
-
<a href="HttpResponse.src/M000086.html" target="Code" class="method-signature"
|
|
245
|
-
onclick="popupCode('HttpResponse.src/M000086.html');return false;">
|
|
246
|
-
<span class="method-name">done</span><span class="method-args">()</span>
|
|
247
|
-
</a>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<div class="method-description">
|
|
251
|
-
</div>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
<div id="method-M000085" class="method-detail">
|
|
255
|
-
<a name="M000085"></a>
|
|
256
|
-
|
|
257
|
-
<div class="method-heading">
|
|
258
|
-
<a href="HttpResponse.src/M000085.html" target="Code" class="method-signature"
|
|
259
|
-
onclick="popupCode('HttpResponse.src/M000085.html');return false;">
|
|
260
|
-
<span class="method-name">done=</span><span class="method-args">(val)</span>
|
|
261
|
-
</a>
|
|
262
|
-
</div>
|
|
263
|
-
|
|
264
|
-
<div class="method-description">
|
|
265
|
-
<p>
|
|
266
|
-
Used during error conditions to mark the response as "<a
|
|
267
|
-
href="HttpResponse.html#M000086">done</a>" so there isn‘t any
|
|
268
|
-
more processing sent to the client.
|
|
269
|
-
</p>
|
|
270
|
-
</div>
|
|
271
|
-
</div>
|
|
272
|
-
|
|
273
|
-
<div id="method-M000084" class="method-detail">
|
|
274
|
-
<a name="M000084"></a>
|
|
275
|
-
|
|
276
|
-
<div class="method-heading">
|
|
277
|
-
<a href="HttpResponse.src/M000084.html" target="Code" class="method-signature"
|
|
278
|
-
onclick="popupCode('HttpResponse.src/M000084.html');return false;">
|
|
279
|
-
<span class="method-name">finished</span><span class="method-args">()</span>
|
|
280
|
-
</a>
|
|
281
|
-
</div>
|
|
282
|
-
|
|
283
|
-
<div class="method-description">
|
|
284
|
-
<p>
|
|
285
|
-
This takes whatever has been <a href="HttpResponse.html#M000086">done</a>
|
|
286
|
-
to header and body and then writes it in the proper format to make an
|
|
287
|
-
HTTP/1.1 response.
|
|
288
|
-
</p>
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
|
|
292
|
-
<div id="method-M000077" class="method-detail">
|
|
293
|
-
<a name="M000077"></a>
|
|
294
|
-
|
|
295
|
-
<div class="method-heading">
|
|
296
|
-
<a href="HttpResponse.src/M000077.html" target="Code" class="method-signature"
|
|
297
|
-
onclick="popupCode('HttpResponse.src/M000077.html');return false;">
|
|
298
|
-
<span class="method-name">reset</span><span class="method-args">()</span>
|
|
299
|
-
</a>
|
|
300
|
-
</div>
|
|
301
|
-
|
|
302
|
-
<div class="method-description">
|
|
303
|
-
<p>
|
|
304
|
-
Primarily used in exception handling to <a
|
|
305
|
-
href="HttpResponse.html#M000077">reset</a> the response output in order to
|
|
306
|
-
<a href="HttpResponse.html#M000083">write</a> an alternative response. It
|
|
307
|
-
will abort with an exception if you have already sent the header or the
|
|
308
|
-
body. This is pretty catastrophic actually.
|
|
309
|
-
</p>
|
|
310
|
-
</div>
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
<div id="method-M000080" class="method-detail">
|
|
314
|
-
<a name="M000080"></a>
|
|
315
|
-
|
|
316
|
-
<div class="method-heading">
|
|
317
|
-
<a href="HttpResponse.src/M000080.html" target="Code" class="method-signature"
|
|
318
|
-
onclick="popupCode('HttpResponse.src/M000080.html');return false;">
|
|
319
|
-
<span class="method-name">send_body</span><span class="method-args">()</span>
|
|
320
|
-
</a>
|
|
321
|
-
</div>
|
|
322
|
-
|
|
323
|
-
<div class="method-description">
|
|
324
|
-
</div>
|
|
325
|
-
</div>
|
|
326
|
-
|
|
327
|
-
<div id="method-M000081" class="method-detail">
|
|
328
|
-
<a name="M000081"></a>
|
|
329
|
-
|
|
330
|
-
<div class="method-heading">
|
|
331
|
-
<a href="HttpResponse.src/M000081.html" target="Code" class="method-signature"
|
|
332
|
-
onclick="popupCode('HttpResponse.src/M000081.html');return false;">
|
|
333
|
-
<span class="method-name">send_file</span><span class="method-args">(path, small_file = false)</span>
|
|
334
|
-
</a>
|
|
335
|
-
</div>
|
|
336
|
-
|
|
337
|
-
<div class="method-description">
|
|
338
|
-
<p>
|
|
339
|
-
Appends the contents of <tt>path</tt> to the response stream. The file is
|
|
340
|
-
opened for binary reading and written in chunks to the socket.
|
|
341
|
-
</p>
|
|
342
|
-
<p>
|
|
343
|
-
Sendfile API support has been removed in 0.3.13.4 due to stability
|
|
344
|
-
problems.
|
|
345
|
-
</p>
|
|
346
|
-
</div>
|
|
347
|
-
</div>
|
|
348
|
-
|
|
349
|
-
<div id="method-M000079" class="method-detail">
|
|
350
|
-
<a name="M000079"></a>
|
|
351
|
-
|
|
352
|
-
<div class="method-heading">
|
|
353
|
-
<a href="HttpResponse.src/M000079.html" target="Code" class="method-signature"
|
|
354
|
-
onclick="popupCode('HttpResponse.src/M000079.html');return false;">
|
|
355
|
-
<span class="method-name">send_header</span><span class="method-args">()</span>
|
|
356
|
-
</a>
|
|
357
|
-
</div>
|
|
358
|
-
|
|
359
|
-
<div class="method-description">
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
|
|
363
|
-
<div id="method-M000078" class="method-detail">
|
|
364
|
-
<a name="M000078"></a>
|
|
365
|
-
|
|
366
|
-
<div class="method-heading">
|
|
367
|
-
<a href="HttpResponse.src/M000078.html" target="Code" class="method-signature"
|
|
368
|
-
onclick="popupCode('HttpResponse.src/M000078.html');return false;">
|
|
369
|
-
<span class="method-name">send_status</span><span class="method-args">(content_length=@body.length)</span>
|
|
370
|
-
</a>
|
|
371
|
-
</div>
|
|
372
|
-
|
|
373
|
-
<div class="method-description">
|
|
374
|
-
</div>
|
|
375
|
-
</div>
|
|
376
|
-
|
|
377
|
-
<div id="method-M000082" class="method-detail">
|
|
378
|
-
<a name="M000082"></a>
|
|
379
|
-
|
|
380
|
-
<div class="method-heading">
|
|
381
|
-
<a href="HttpResponse.src/M000082.html" target="Code" class="method-signature"
|
|
382
|
-
onclick="popupCode('HttpResponse.src/M000082.html');return false;">
|
|
383
|
-
<span class="method-name">socket_error</span><span class="method-args">(details)</span>
|
|
384
|
-
</a>
|
|
385
|
-
</div>
|
|
386
|
-
|
|
387
|
-
<div class="method-description">
|
|
388
|
-
</div>
|
|
389
|
-
</div>
|
|
390
|
-
|
|
391
|
-
<div id="method-M000076" class="method-detail">
|
|
392
|
-
<a name="M000076"></a>
|
|
393
|
-
|
|
394
|
-
<div class="method-heading">
|
|
395
|
-
<a href="HttpResponse.src/M000076.html" target="Code" class="method-signature"
|
|
396
|
-
onclick="popupCode('HttpResponse.src/M000076.html');return false;">
|
|
397
|
-
<span class="method-name">start</span><span class="method-args">(status=200, finalize=false) {|@header, @body| ...}</span>
|
|
398
|
-
</a>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<div class="method-description">
|
|
402
|
-
<p>
|
|
403
|
-
Receives a block passing it the header and body for you to work with. When
|
|
404
|
-
the block is <a href="HttpResponse.html#M000084">finished</a> it writes
|
|
405
|
-
everything you‘ve <a href="HttpResponse.html#M000086">done</a> to the
|
|
406
|
-
socket in the proper order. This lets you intermix header and body content
|
|
407
|
-
as needed. Handlers are able to modify pretty much any part of the request
|
|
408
|
-
in the chain, and can stop further processing by simple passing
|
|
409
|
-
"finalize=true" to the <a
|
|
410
|
-
href="HttpResponse.html#M000076">start</a> method. By default all handlers
|
|
411
|
-
run and then mongrel finalizes the request when they‘re all <a
|
|
412
|
-
href="HttpResponse.html#M000086">done</a>.
|
|
413
|
-
</p>
|
|
414
|
-
</div>
|
|
415
|
-
</div>
|
|
416
|
-
|
|
417
|
-
<div id="method-M000083" class="method-detail">
|
|
418
|
-
<a name="M000083"></a>
|
|
419
|
-
|
|
420
|
-
<div class="method-heading">
|
|
421
|
-
<a href="HttpResponse.src/M000083.html" target="Code" class="method-signature"
|
|
422
|
-
onclick="popupCode('HttpResponse.src/M000083.html');return false;">
|
|
423
|
-
<span class="method-name">write</span><span class="method-args">(data)</span>
|
|
424
|
-
</a>
|
|
425
|
-
</div>
|
|
426
|
-
|
|
427
|
-
<div class="method-description">
|
|
428
|
-
</div>
|
|
429
|
-
</div>
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
</div>
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
</div>
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
<div id="validator-badges">
|
|
439
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
440
|
-
</div>
|
|
441
|
-
|
|
442
|
-
</body>
|
|
443
|
-
</html>
|