mongrel 0.3.13.2 → 0.3.13.3
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +39 -488
- data/LICENSE +39 -488
- data/Rakefile +1 -1
- data/bin/mongrel_rails +8 -0
- data/doc/rdoc/classes/IO.src/M000001.html +5 -5
- data/doc/rdoc/classes/IO.src/M000002.html +5 -5
- data/doc/rdoc/classes/Kernel.src/M000020.html +5 -5
- data/doc/rdoc/classes/Kernel.src/M000021.html +9 -9
- data/doc/rdoc/classes/Mongrel.html +4 -22
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000101.html +10 -10
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000102.html +33 -33
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000103.html +20 -20
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000104.html +13 -13
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000105.html +11 -11
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000106.html +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000107.html +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000108.html +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000109.html +5 -5
- data/doc/rdoc/classes/Mongrel/Camping.src/M000048.html +8 -8
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000049.html +4 -4
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000050.html +36 -36
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000026.html +10 -10
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000027.html +28 -28
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000028.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000031.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000032.html +8 -8
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000033.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000034.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000035.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000036.html +10 -10
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000037.html +10 -10
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000038.html +4 -4
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000039.html +6 -6
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000040.html +11 -11
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000041.html +33 -33
- data/doc/rdoc/classes/Mongrel/Configurator.html +2 -2
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +13 -13
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +17 -17
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +6 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +6 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +9 -9
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000115.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000116.html +23 -23
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000117.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000118.html +16 -16
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000119.html +18 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000120.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000121.html +10 -10
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000122.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000123.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000124.html +8 -8
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000125.html +11 -11
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000126.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000127.html +21 -21
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000128.html +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000129.html +19 -19
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000130.html +4 -4
- data/doc/rdoc/classes/Mongrel/Const.html +1 -1
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/M000099.html +5 -5
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/M000100.html +14 -14
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000058.html +7 -7
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000059.html +29 -29
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000060.html +28 -28
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html +48 -48
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000062.html +25 -25
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000063.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000131.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000132.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000078.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000079.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000080.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000022.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000023.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000024.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000025.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000138.html +42 -42
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000139.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000140.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000141.html +18 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +11 -11
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +11 -11
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000084.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000085.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000086.html +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000087.html +17 -17
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000088.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000089.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000090.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000091.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000092.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +11 -11
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +71 -71
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +17 -17
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +36 -37
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +20 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +8 -8
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000042.html +25 -25
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000043.html +11 -11
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000044.html +12 -12
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000045.html +8 -8
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000046.html +36 -36
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000047.html +9 -9
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/M000136.html +8 -8
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/M000137.html +13 -13
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000133.html +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000134.html +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000135.html +4 -4
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000074.html +4 -4
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000075.html +10 -10
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000076.html +28 -28
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000077.html +6 -6
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000093.html +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000094.html +4 -4
- data/doc/rdoc/classes/MongrelDbg.src/M000015.html +5 -5
- data/doc/rdoc/classes/MongrelDbg.src/M000016.html +6 -6
- data/doc/rdoc/classes/MongrelDbg.src/M000017.html +8 -8
- data/doc/rdoc/classes/MongrelDbg.src/M000018.html +7 -7
- data/doc/rdoc/classes/MongrelDbg.src/M000019.html +4 -4
- data/doc/rdoc/classes/ObjectTracker.src/M000013.html +13 -13
- data/doc/rdoc/classes/ObjectTracker.src/M000014.html +30 -30
- data/doc/rdoc/classes/RequestLog/Access.src/M000142.html +5 -5
- data/doc/rdoc/classes/RequestLog/Files.src/M000143.html +5 -5
- data/doc/rdoc/classes/RequestLog/Objects.src/M000145.html +5 -5
- data/doc/rdoc/classes/RequestLog/Params.src/M000146.html +5 -5
- data/doc/rdoc/classes/RequestLog/Threads.src/M000144.html +20 -20
- data/doc/rdoc/classes/Stats.src/M000005.html +5 -5
- data/doc/rdoc/classes/Stats.src/M000006.html +9 -9
- data/doc/rdoc/classes/Stats.src/M000007.html +12 -12
- data/doc/rdoc/classes/Stats.src/M000008.html +4 -4
- data/doc/rdoc/classes/Stats.src/M000009.html +4 -4
- data/doc/rdoc/classes/Stats.src/M000010.html +4 -4
- data/doc/rdoc/classes/Stats.src/M000011.html +9 -9
- data/doc/rdoc/classes/Stats.src/M000012.html +6 -6
- data/doc/rdoc/classes/TCPServer.src/M000003.html +5 -5
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/COPYING.html +51 -639
- data/doc/rdoc/files/LICENSE.html +51 -639
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/command_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +13 -1
- data/doc/rdoc/files/lib/mongrel/init_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +6 -21
- data/doc/rdoc/files/lib/mongrel_rb.html +6 -21
- data/ext/http11/http11.c +4 -19
- data/ext/http11/http11_parser.c +48 -63
- data/ext/http11/http11_parser.h +3 -17
- data/lib/http11.so +0 -0
- data/lib/mongrel.rb +10 -23
- data/lib/mongrel/camping.rb +4 -16
- data/lib/mongrel/cgi.rb +4 -16
- data/lib/mongrel/command.rb +4 -16
- data/lib/mongrel/debug.rb +4 -16
- data/lib/mongrel/handlers.rb +6 -17
- data/lib/mongrel/init.rb +4 -16
- data/lib/mongrel/rails.rb +4 -16
- data/lib/mongrel/stats.rb +4 -16
- data/lib/mongrel/tcphack.rb +4 -16
- data/test/test_command.rb +4 -16
- data/test/test_conditional.rb +4 -16
- data/test/test_configurator.rb +4 -16
- data/test/test_debug.rb +4 -16
- data/test/test_handlers.rb +4 -16
- data/test/test_http11.rb +4 -16
- data/test/test_redirect_handler.rb +6 -0
- data/test/test_request_progress.rb +58 -0
- data/test/test_response.rb +4 -16
- data/test/test_stats.rb +4 -16
- data/test/test_uriclassifier.rb +4 -16
- data/test/test_ws.rb +4 -16
- data/test/testhelp.rb +6 -0
- metadata +5 -2
data/Rakefile
CHANGED
@@ -53,7 +53,7 @@ task :site => [:site_webgen, :site_rdoc, :site_coverage, :site_projects_rdoc]
|
|
53
53
|
setup_extension("http11", "http11")
|
54
54
|
|
55
55
|
name="mongrel"
|
56
|
-
version="0.3.13.
|
56
|
+
version="0.3.13.3"
|
57
57
|
|
58
58
|
setup_gem(name, version) do |spec|
|
59
59
|
spec.summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
|
data/bin/mongrel_rails
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2005 Zed A. Shaw
|
2
|
+
# You can redistribute it and/or modify it under the same terms as Ruby.
|
3
|
+
#
|
4
|
+
# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
|
5
|
+
# for more information.
|
1
6
|
|
2
7
|
require 'rubygems'
|
3
8
|
require 'yaml'
|
@@ -98,6 +103,9 @@ class Start < GemPlugin::Plugin "/commands"
|
|
98
103
|
if defaults[:debug]
|
99
104
|
log "Installing debugging prefixed filters. Look in log/mongrel_debug for the files."
|
100
105
|
debug "/"
|
106
|
+
elsif not defaults[:daemon]
|
107
|
+
# they don't have debug on and aren't in daemon so at least log accesses
|
108
|
+
debug "/", what = [:files]
|
101
109
|
end
|
102
110
|
|
103
111
|
log "Starting Rails with #{defaults[:environment]} environment ..."
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line 104</span>
|
14
|
+
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
15
|
+
105: <span class="ruby-identifier">$open_files</span>[<span class="ruby-keyword kw">self</span>] = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">inspect</span>
|
16
|
+
106: <span class="ruby-identifier">orig_open</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
17
|
+
107: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line 109</span>
|
14
|
+
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
15
|
+
110: <span class="ruby-identifier">$open_files</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">self</span>
|
16
|
+
111: <span class="ruby-identifier">orig_close</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
17
|
+
112: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line 119</span>
|
14
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
15
|
+
120: <span class="ruby-identifier">$open_files</span>[<span class="ruby-keyword kw">self</span>] = <span class="ruby-identifier">arg</span>[<span class="ruby-value">0</span>]
|
16
|
+
121: <span class="ruby-identifier">orig_open</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
17
|
+
122: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,14 +10,14 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/debug.rb, line 124</span>
|
14
|
+
124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_open_files</span>
|
15
|
+
125: <span class="ruby-identifier">open_counts</span> = {}
|
16
|
+
126: <span class="ruby-identifier">$open_files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span>,<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
17
|
+
127: <span class="ruby-identifier">open_counts</span>[<span class="ruby-identifier">args</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
18
|
+
128: <span class="ruby-identifier">open_counts</span>[<span class="ruby-identifier">args</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
19
|
+
129: <span class="ruby-keyword kw">end</span>
|
20
|
+
130: <span class="ruby-constant">MongrelDbg</span><span class="ruby-operator">::</span><span class="ruby-identifier">trace</span>(<span class="ruby-identifier">:files</span>, <span class="ruby-identifier">open_counts</span>.<span class="ruby-identifier">to_yaml</span>)
|
21
|
+
131: <span class="ruby-keyword kw">end</span></pre>
|
22
22
|
</body>
|
23
23
|
</html>
|
@@ -98,28 +98,10 @@
|
|
98
98
|
|
99
99
|
<div id="description">
|
100
100
|
<p>
|
101
|
-
<a href="Mongrel.html">Mongrel</a>
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
Copyright (C) 2005 Zed A. Shaw zedshaw AT zedshaw dot com
|
106
|
-
</p>
|
107
|
-
<p>
|
108
|
-
This library is free software; you can redistribute it and/or modify it
|
109
|
-
under the terms of the GNU Lesser General Public License as published by
|
110
|
-
the Free Software Foundation; either version 2.1 of the License, or (at
|
111
|
-
your option) any later version.
|
112
|
-
</p>
|
113
|
-
<p>
|
114
|
-
This library is distributed in the hope that it will be useful, but WITHOUT
|
115
|
-
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
116
|
-
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
117
|
-
for more details.
|
118
|
-
</p>
|
119
|
-
<p>
|
120
|
-
You should have received a copy of the GNU Lesser General Public License
|
121
|
-
along with this library; if not, write to the Free Software Foundation,
|
122
|
-
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
101
|
+
<a href="Mongrel.html">Mongrel</a> module containing all of the classes
|
102
|
+
(include C extensions) for running a <a href="Mongrel.html">Mongrel</a> web
|
103
|
+
server. It contains a minimalist HTTP server with just enough functionality
|
104
|
+
to service web application requests fast as possible.
|
123
105
|
</p>
|
124
106
|
|
125
107
|
</div>
|
@@ -10,15 +10,15 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 40</span>
|
14
|
+
40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
41: <span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span>
|
16
|
+
42: <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">response</span>
|
17
|
+
43: <span class="ruby-ivar">@args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
18
|
+
44: <span class="ruby-ivar">@input</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>
|
19
|
+
45: <span class="ruby-ivar">@head</span> = {}
|
20
|
+
46: <span class="ruby-ivar">@out_called</span> = <span class="ruby-keyword kw">false</span>
|
21
|
+
47: <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
22
|
+
48: <span class="ruby-keyword kw">end</span></pre>
|
23
23
|
</body>
|
24
24
|
</html>
|
@@ -10,38 +10,38 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 57</span>
|
14
|
+
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">"text/html"</span>)
|
15
|
+
58: <span class="ruby-comment cmt"># if they pass in a string then just write the Content-Type</span>
|
16
|
+
59: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
|
17
|
+
60: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">options</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>]
|
18
|
+
61: <span class="ruby-keyword kw">else</span>
|
19
|
+
62: <span class="ruby-comment cmt"># convert the given options into what Mongrel wants</span>
|
20
|
+
63: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'type'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">"text/html"</span>
|
21
|
+
64: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Type'</span>] <span class="ruby-operator">+=</span> <span class="ruby-value str">"; charset="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'charset'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-value str">"charset"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'charset'</span>]
|
22
|
+
65:
|
23
|
+
66: <span class="ruby-comment cmt"># setup date only if they use nph</span>
|
24
|
+
67: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Date'</span>] = <span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-identifier">rfc1123_date</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'nph'</span>]
|
25
|
+
68:
|
26
|
+
69: <span class="ruby-comment cmt"># setup the server to use the default or what they set</span>
|
27
|
+
70: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Server'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'server'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">env_table</span>[<span class="ruby-value str">'SERVER_SOFTWARE'</span>]
|
28
|
+
71:
|
29
|
+
72: <span class="ruby-comment cmt"># remaining possible options they can give</span>
|
30
|
+
73: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Status'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'status'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'status'</span>]
|
31
|
+
74: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Content-Language'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'language'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'language'</span>]
|
32
|
+
75: <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'Expires'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'expires'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'expires'</span>]
|
33
|
+
76:
|
34
|
+
77: <span class="ruby-comment cmt"># drop the keys we don't want anymore</span>
|
35
|
+
78: <span class="ruby-constant">REMOVED_KEYS</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) }
|
36
|
+
79:
|
37
|
+
80: <span class="ruby-comment cmt"># finally just convert the rest raw (which puts 'cookie' directly)</span>
|
38
|
+
81: <span class="ruby-comment cmt"># 'cookie' is translated later as we write the header out</span>
|
39
|
+
82: <span class="ruby-identifier">options</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-ivar">@head</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>}
|
40
|
+
83: <span class="ruby-keyword kw">end</span>
|
41
|
+
84:
|
42
|
+
85: <span class="ruby-comment cmt"># doing this fakes out the cgi library to think the headers are empty</span>
|
43
|
+
86: <span class="ruby-comment cmt"># we then do the real headers in the out function call later</span>
|
44
|
+
87: <span class="ruby-value str">""</span>
|
45
|
+
88: <span class="ruby-keyword kw">end</span></pre>
|
46
46
|
</body>
|
47
47
|
</html>
|
@@ -10,25 +10,25 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 95</span>
|
14
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_cookies</span>(<span class="ruby-identifier">to</span>)
|
15
|
+
96: <span class="ruby-comment cmt"># convert the cookies based on the myriad of possible ways to set a cookie</span>
|
16
|
+
97: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'cookie'</span>]
|
17
|
+
98: <span class="ruby-identifier">cookie</span> = <span class="ruby-ivar">@head</span>[<span class="ruby-value str">'cookie'</span>]
|
18
|
+
99: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">cookie</span>
|
19
|
+
100: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
20
|
+
101: <span class="ruby-identifier">cookie</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> }
|
21
|
+
102: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
22
|
+
103: <span class="ruby-identifier">cookie</span>.<span class="ruby-identifier">each_value</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>}
|
23
|
+
104: <span class="ruby-keyword kw">else</span>
|
24
|
+
105: <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'cookie'</span>].<span class="ruby-identifier">to_s</span>
|
25
|
+
106: <span class="ruby-keyword kw">end</span>
|
26
|
+
107:
|
27
|
+
108: <span class="ruby-ivar">@head</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'cookie'</span>)
|
28
|
+
109:
|
29
|
+
110: <span class="ruby-comment cmt"># @output_cookies seems to never be used, but we'll process it just in case</span>
|
30
|
+
111: <span class="ruby-ivar">@output_cookies</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'Set-Cookie'</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@output_cookies</span>
|
31
|
+
112: <span class="ruby-keyword kw">end</span>
|
32
|
+
113: <span class="ruby-keyword kw">end</span></pre>
|
33
33
|
</body>
|
34
34
|
</html>
|
@@ -10,18 +10,18 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 119</span>
|
14
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">out</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">"text/html"</span>)
|
15
|
+
120: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@out_called</span> <span class="ruby-comment cmt"># don't do this more than once</span>
|
16
|
+
121:
|
17
|
+
122: <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span>)
|
18
|
+
123:
|
19
|
+
124: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">start</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>, <span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
|
20
|
+
125: <span class="ruby-identifier">send_cookies</span>(<span class="ruby-identifier">head</span>)
|
21
|
+
126:
|
22
|
+
127: <span class="ruby-ivar">@head</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-identifier">head</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>}
|
23
|
+
128: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-keyword kw">yield</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>)
|
24
|
+
129: <span class="ruby-keyword kw">end</span>
|
25
|
+
130: <span class="ruby-keyword kw">end</span></pre>
|
26
26
|
</body>
|
27
27
|
</html>
|
@@ -10,16 +10,16 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 135</span>
|
14
|
+
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
|
15
|
+
136: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status</span>
|
16
|
+
137: <span class="ruby-identifier">stat</span> = <span class="ruby-ivar">@head</span>[<span class="ruby-value str">"Status"</span>]
|
17
|
+
138: <span class="ruby-identifier">stat</span> = <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>)[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stat</span>
|
18
|
+
139:
|
19
|
+
140: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">stat</span> <span class="ruby-operator">||</span> <span class="ruby-value str">"200"</span>
|
20
|
+
141: <span class="ruby-keyword kw">end</span>
|
21
|
+
142:
|
22
|
+
143: <span class="ruby-ivar">@status</span>
|
23
|
+
144: <span class="ruby-keyword kw">end</span></pre>
|
24
24
|
</body>
|
25
25
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 147</span>
|
14
|
+
147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args</span>
|
15
|
+
148: <span class="ruby-ivar">@args</span>
|
16
|
+
149: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 152</span>
|
14
|
+
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env_table</span>
|
15
|
+
153: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
|
16
|
+
154: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 157</span>
|
14
|
+
157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdinput</span>
|
15
|
+
158: <span class="ruby-ivar">@input</span>
|
16
|
+
159: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 162</span>
|
14
|
+
162: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdoutput</span>
|
15
|
+
163: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"WARNING: Your program is doing something not expected. Please tell Zed that stdoutput was used and what software you are running. Thanks."</span>
|
16
|
+
164: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span>
|
17
|
+
165: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,13 +10,13 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/camping.rb, line 86</span>
|
14
|
+
86: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Camping</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">klass</span>)
|
15
|
+
87: <span class="ruby-identifier">h</span> = <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">HttpServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>)
|
16
|
+
88: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-constant">CampingHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">klass</span>))
|
17
|
+
89: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">register</span>(<span class="ruby-value str">"/favicon.ico"</span>, <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Error404Handler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">""</span>))
|
18
|
+
90: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">run</span>
|
19
|
+
91: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">h</span>
|
20
|
+
92: <span class="ruby-keyword kw">end</span></pre>
|
21
21
|
</body>
|
22
22
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/camping.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/camping.rb, line 36</span>
|
14
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">klass</span>)
|
15
|
+
37: <span class="ruby-ivar">@klass</span> = <span class="ruby-identifier">klass</span>
|
16
|
+
38: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,42 +10,42 @@
|
|
10
10
|
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel/camping.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/camping.rb, line 40</span>
|
14
|
+
40: <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
|
+
41: <span class="ruby-identifier">controller</span> = <span class="ruby-ivar">@klass</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>, <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>)
|
16
|
+
42: <span class="ruby-identifier">sendfile</span>, <span class="ruby-identifier">clength</span> = <span class="ruby-keyword kw">nil</span>
|
17
|
+
43: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">status</span>
|
18
|
+
44: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
19
|
+
45: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^X-SENDFILE$/i</span>
|
20
|
+
46: <span class="ruby-identifier">sendfile</span> = <span class="ruby-identifier">v</span>
|
21
|
+
47: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^CONTENT-LENGTH$/i</span>
|
22
|
+
48: <span class="ruby-identifier">clength</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_i</span>
|
23
|
+
49: <span class="ruby-keyword kw">else</span>
|
24
|
+
50: [<span class="ruby-operator">*</span><span class="ruby-identifier">v</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">vi</span><span class="ruby-operator">|</span>
|
25
|
+
51: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">vi</span>
|
26
|
+
52: <span class="ruby-keyword kw">end</span>
|
27
|
+
53: <span class="ruby-keyword kw">end</span>
|
28
|
+
54: <span class="ruby-keyword kw">end</span>
|
29
|
+
55:
|
30
|
+
56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sendfile</span>
|
31
|
+
57: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">sendfile</span>))
|
32
|
+
58: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
|
33
|
+
59: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">sendfile</span>)
|
34
|
+
60: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:read</span>
|
35
|
+
61: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-identifier">clength</span>)
|
36
|
+
62: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
|
37
|
+
63: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">chunk</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">16384</span>)
|
38
|
+
64: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">chunk</span>)
|
27
39
|
65: <span class="ruby-keyword kw">end</span>
|
28
|
-
66:
|
29
|
-
67:
|
30
|
-
68:
|
31
|
-
69:
|
32
|
-
70: <span class="ruby-identifier">
|
33
|
-
71: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">
|
34
|
-
72:
|
35
|
-
73: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">
|
36
|
-
74:
|
37
|
-
75:
|
38
|
-
76: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">chunk</span>)
|
39
|
-
77: <span class="ruby-keyword kw">end</span>
|
40
|
-
78: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
|
41
|
-
79: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span>
|
42
|
-
80: <span class="ruby-keyword kw">end</span>
|
43
|
-
81: <span class="ruby-keyword kw">else</span>
|
44
|
-
82: <span class="ruby-identifier">body</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>
|
45
|
-
83: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-identifier">body</span>.<span class="ruby-identifier">length</span>)
|
46
|
-
84: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
|
47
|
-
85: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">body</span>)
|
48
|
-
86: <span class="ruby-keyword kw">end</span>
|
49
|
-
87: <span class="ruby-keyword kw">end</span></pre>
|
40
|
+
66: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:close</span>
|
41
|
+
67: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span>
|
42
|
+
68: <span class="ruby-keyword kw">end</span>
|
43
|
+
69: <span class="ruby-keyword kw">else</span>
|
44
|
+
70: <span class="ruby-identifier">body</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>
|
45
|
+
71: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-identifier">body</span>.<span class="ruby-identifier">length</span>)
|
46
|
+
72: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
|
47
|
+
73: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">body</span>)
|
48
|
+
74: <span class="ruby-keyword kw">end</span>
|
49
|
+
75: <span class="ruby-keyword kw">end</span></pre>
|
50
50
|
</body>
|
51
51
|
</html>
|