mongrel 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +38 -15
- data/bin/mongrel_rails +13 -11
- data/doc/rdoc/classes/Mongrel.html +6 -1
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +49 -49
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html +11 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html +34 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html +21 -6
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000054.html → M000060.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000055.html → M000061.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000056.html → M000062.html} +0 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000063.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000064.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000065.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +177 -0
- data/doc/rdoc/classes/Mongrel/Camping.src/M000019.html +22 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +165 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000020.html +18 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000021.html +27 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +50 -50
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html +11 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html +28 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html +5 -9
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000009.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html +9 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000013.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000014.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000015.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +15 -15
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000013.html → M000016.html} +6 -6
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000014.html → M000017.html} +11 -11
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000015.html → M000018.html} +32 -32
- data/doc/rdoc/classes/Mongrel/Const.html +3 -3
- data/doc/rdoc/classes/Mongrel/DirHandler.html +31 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000023.html → M000029.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000024.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000025.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000026.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000027.html → M000033.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000028.html → M000034.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000060.html → M000066.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000061.html → M000067.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000035.html → M000041.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000036.html → M000042.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000037.html → M000043.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000022.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000017.html → M000023.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000018.html → M000024.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000019.html → M000025.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000020.html → M000026.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000021.html → M000027.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000016.html → M000028.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000062.html → M000068.html} +24 -24
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +8 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000039.html → M000045.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000040.html → M000046.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000047.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000048.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000049.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000050.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +33 -33
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000029.html → M000035.html} +22 -22
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000030.html → M000036.html} +43 -43
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000037.html} +34 -34
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000038.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000033.html → M000039.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000034.html → M000040.html} +9 -9
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +30 -30
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000045.html → M000051.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000046.html → M000052.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000047.html → M000053.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000048.html → M000054.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000049.html → M000055.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000050.html → M000056.html} +0 -0
- data/doc/rdoc/classes/RailsHandler.html +30 -10
- data/doc/rdoc/classes/RailsHandler.src/{M000001.html → M000003.html} +8 -8
- data/doc/rdoc/classes/RailsHandler.src/{M000002.html → M000004.html} +34 -34
- data/doc/rdoc/classes/RailsHandler.src/M000005.html +23 -0
- data/doc/rdoc/classes/TCPServer.html +173 -0
- data/doc/rdoc/classes/TCPServer.src/M000001.html +19 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/command_rb.html +3 -2
- data/doc/rdoc/files/lib/mongrel/{plugins_rb.html → init_rb.html} +5 -4
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -1
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -2
- data/doc/rdoc/fr_class_index.html +3 -0
- data/doc/rdoc/fr_file_index.html +3 -1
- data/doc/rdoc/fr_method_index.html +68 -62
- data/examples/camping/blog.rb +22 -37
- data/examples/camping/tepee.rb +3 -23
- data/lib/mongrel.rb +3 -4
- data/lib/mongrel/camping.rb +64 -0
- data/lib/mongrel/command.rb +3 -2
- data/lib/mongrel/{plugins.rb → init.rb} +1 -1
- data/lib/mongrel/rails.rb +16 -6
- data/lib/mongrel/tcphack.rb +12 -0
- data/tools/rakehelp.rb +10 -12
- metadata +74 -58
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -34
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000003.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000004.html +0 -41
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000005.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000038.html +0 -21
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ task :default => [:compile, :test]
|
|
17
17
|
|
18
18
|
desc "Compiles all extensions"
|
19
19
|
task :compile => [:http11]
|
20
|
-
task :package => [:clean,:compile]
|
20
|
+
task :package => [:clean,:compile,:test]
|
21
21
|
|
22
22
|
task :ragel do
|
23
23
|
sh %{/usr/local/bin/ragel ext/http11/http11_parser.rl | /usr/local/bin/rlcodegen -G2 -o ext/http11/http11_parser.c}
|
@@ -31,36 +31,59 @@ end
|
|
31
31
|
|
32
32
|
setup_extension("http11", "http11")
|
33
33
|
|
34
|
-
version="0.3.9"
|
35
|
-
summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
|
36
|
-
test_file = "test/test_ws.rb"
|
37
|
-
author="Zed A. Shaw"
|
38
34
|
name="mongrel"
|
39
|
-
|
35
|
+
version="0.3.10"
|
36
|
+
|
37
|
+
setup_gem(name, version) do |spec|
|
38
|
+
spec.summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
|
39
|
+
spec.description = spec.summary
|
40
|
+
spec.test_file = "test/test_ws.rb"
|
41
|
+
spec.author="Zed A. Shaw"
|
42
|
+
spec.executables=['mongrel_rails']
|
43
|
+
spec.files += %w(ext/http11/MANIFEST README Rakefile setup.rb)
|
40
44
|
|
41
|
-
setup_gem(name, version, author, summary, scripts, test_file) do |spec|
|
42
45
|
spec.add_dependency('daemons', '>= 0.4.2')
|
43
46
|
spec.add_dependency('gem_plugin', ">= 0.1")
|
47
|
+
spec.required_ruby_version = '>= 1.8.4'
|
44
48
|
end
|
45
49
|
|
46
50
|
desc "Build a binary gem for Win32"
|
47
51
|
task :win32_gem => [:clean, :compile, :test, :rerdoc, :package_win32]
|
48
52
|
|
49
|
-
scripts_win32 = scripts + ['mongrel_rails_service']
|
50
53
|
task :package_win32 do
|
51
|
-
setup_win32_gem(name, version
|
54
|
+
setup_win32_gem(name, version) do |spec|
|
55
|
+
spec.summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
|
56
|
+
spec.description = spec.summary
|
57
|
+
spec.test_files = Dir.glob('test/test_*.rb')
|
58
|
+
spec.author="Zed A. Shaw"
|
59
|
+
spec.executables=['mongrel_rails', 'mongrel_rails_service']
|
60
|
+
spec.homepage="http://mongrel.rubyforge.org"
|
61
|
+
spec.rubyforge_project="mongrel"
|
62
|
+
spec.files += %w(ext/http11/MANIFEST README Rakefile setup.rb)
|
63
|
+
spec.files << 'ext/http11/http11.so'
|
64
|
+
|
65
|
+
spec.required_ruby_version = '>= 1.8.4'
|
66
|
+
|
52
67
|
spec.add_dependency('win32-service', '>= 0.5.0')
|
53
68
|
spec.add_dependency('gem_plugin', ">= 0.1")
|
54
|
-
|
69
|
+
|
55
70
|
spec.extensions = []
|
56
71
|
spec.platform = Gem::Platform::WIN32
|
57
72
|
end
|
58
73
|
end
|
59
74
|
|
60
|
-
task :gem_plugin_project do
|
61
|
-
sh %{cd projects/gem_plugin; rake gem_test; }
|
62
|
-
end
|
63
75
|
|
64
|
-
task :
|
76
|
+
task :install do
|
77
|
+
sub_project("gem_plugin", :install)
|
78
|
+
sh %{rake package}
|
65
79
|
sh %{sudo gem install pkg/mongrel-#{version}}
|
66
|
-
|
80
|
+
sub_project("mongrel_status", :install)
|
81
|
+
sub_project("mongrel_config", :install)
|
82
|
+
end
|
83
|
+
|
84
|
+
task :uninstall => [:clean] do
|
85
|
+
sub_project("mongrel_status", :uninstall)
|
86
|
+
sub_project("mongrel_config", :uninstall)
|
87
|
+
sh %{sudo gem uninstall mongrel}
|
88
|
+
sub_project("gem_plugin", :uninstall)
|
89
|
+
end
|
data/bin/mongrel_rails
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'mongrel/rails'
|
3
2
|
require 'yaml'
|
4
|
-
|
3
|
+
require 'mongrel'
|
5
4
|
|
6
5
|
|
7
6
|
class Start < GemPlugin::Plugin "/commands"
|
@@ -72,8 +71,13 @@ class Start < GemPlugin::Plugin "/commands"
|
|
72
71
|
end
|
73
72
|
|
74
73
|
def configure_rails
|
74
|
+
# need this later for safe reloading
|
75
|
+
$orig_dollar_quote = $".clone
|
76
|
+
|
75
77
|
ENV['RAILS_ENV'] = @environment
|
76
78
|
require 'config/environment'
|
79
|
+
require 'dispatcher'
|
80
|
+
require 'mongrel/rails'
|
77
81
|
|
78
82
|
# configure the rails handler
|
79
83
|
rails = RailsHandler.new(@docroot, load_mime_map)
|
@@ -87,26 +91,26 @@ class Start < GemPlugin::Plugin "/commands"
|
|
87
91
|
server = Mongrel::HttpServer.new(@address, @port, @num_procs.to_i, @timeout.to_i)
|
88
92
|
server.register("/", rails)
|
89
93
|
|
90
|
-
# start mongrel processing thread
|
91
|
-
server.run
|
92
|
-
|
93
94
|
# signal trapping just applies to posix systems
|
94
95
|
# TERM is a valid signal, but still doesn't gracefuly shutdown on win32.
|
95
96
|
if RUBY_PLATFORM !~ /mswin/
|
96
97
|
# graceful shutdown
|
97
98
|
trap("TERM") {
|
98
99
|
server.stop
|
100
|
+
File.unlink @pid_file if File.exist?(@pid_file)
|
99
101
|
}
|
100
102
|
|
101
103
|
# rails reload
|
102
104
|
trap("HUP") {
|
103
|
-
|
104
|
-
|
105
|
+
STDERR.puts "Reloading rails..."
|
106
|
+
rails.reload!
|
107
|
+
STDERR.puts "Done reloading rails."
|
105
108
|
}
|
106
109
|
|
107
110
|
# restart
|
108
111
|
trap("USR2") {
|
109
112
|
server.stop
|
113
|
+
File.unlink @pid_file if File.exist?(@pid_file)
|
110
114
|
@restart = true
|
111
115
|
}
|
112
116
|
end
|
@@ -115,6 +119,8 @@ class Start < GemPlugin::Plugin "/commands"
|
|
115
119
|
GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE
|
116
120
|
|
117
121
|
begin
|
122
|
+
# start mongrel processing thread
|
123
|
+
server.run
|
118
124
|
STDERR.puts "Server ready."
|
119
125
|
server.acceptor.join
|
120
126
|
rescue Interrupt
|
@@ -175,8 +181,6 @@ class Stop < GemPlugin::Plugin "/commands"
|
|
175
181
|
else
|
176
182
|
send_signal("TERM", @pid_file)
|
177
183
|
end
|
178
|
-
|
179
|
-
File.unlink(@pid_file)
|
180
184
|
end
|
181
185
|
end
|
182
186
|
|
@@ -210,8 +214,6 @@ class Restart < GemPlugin::Plugin "/commands"
|
|
210
214
|
else
|
211
215
|
send_signal("USR2", @pid_file)
|
212
216
|
end
|
213
|
-
|
214
|
-
File.unlink(@pid_file)
|
215
217
|
end
|
216
218
|
end
|
217
219
|
|
@@ -58,6 +58,10 @@
|
|
58
58
|
<a href="../files/lib/mongrel_rb.html">
|
59
59
|
lib/mongrel.rb
|
60
60
|
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/lib/mongrel/camping_rb.html">
|
63
|
+
lib/mongrel/camping.rb
|
64
|
+
</a>
|
61
65
|
<br />
|
62
66
|
<a href="../files/lib/mongrel/cgi_rb.html">
|
63
67
|
lib/mongrel/cgi.rb
|
@@ -112,7 +116,8 @@ to service web application requests fast as possible.
|
|
112
116
|
<div id="class-list">
|
113
117
|
<h3 class="section-bar">Classes and Modules</h3>
|
114
118
|
|
115
|
-
Module <a href="Mongrel/
|
119
|
+
Module <a href="Mongrel/Camping.html" class="link">Mongrel::Camping</a><br />
|
120
|
+
Module <a href="Mongrel/Command.html" class="link">Mongrel::Command</a><br />
|
116
121
|
Module <a href="Mongrel/Const.html" class="link">Mongrel::Const</a><br />
|
117
122
|
Class <a href="Mongrel/CGIWrapper.html" class="link">Mongrel::CGIWrapper</a><br />
|
118
123
|
Class <a href="Mongrel/DirHandler.html" class="link">Mongrel::DirHandler</a><br />
|
@@ -102,7 +102,7 @@ In Rails you can get the real file for a request with:
|
|
102
102
|
</pre>
|
103
103
|
<p>
|
104
104
|
Which is ugly but does the job. Feel free to write a Rails helper for that.
|
105
|
-
Refer to <a href="DirHandler.html#
|
105
|
+
Refer to <a href="DirHandler.html#M000030">DirHandler#can_serve</a> for
|
106
106
|
more information on this.
|
107
107
|
</p>
|
108
108
|
|
@@ -115,15 +115,15 @@ more information on this.
|
|
115
115
|
<h3 class="section-bar">Methods</h3>
|
116
116
|
|
117
117
|
<div class="name-list">
|
118
|
-
<a href="#
|
119
|
-
<a href="#
|
120
|
-
<a href="#
|
121
|
-
<a href="#
|
122
|
-
<a href="#
|
123
|
-
<a href="#
|
124
|
-
<a href="#
|
125
|
-
<a href="#
|
126
|
-
<a href="#
|
118
|
+
<a href="#M000062">args</a>
|
119
|
+
<a href="#M000063">env_table</a>
|
120
|
+
<a href="#M000058">header</a>
|
121
|
+
<a href="#M000057">new</a>
|
122
|
+
<a href="#M000060">out</a>
|
123
|
+
<a href="#M000059">send_cookies</a>
|
124
|
+
<a href="#M000061">status</a>
|
125
|
+
<a href="#M000064">stdinput</a>
|
126
|
+
<a href="#M000065">stdoutput</a>
|
127
127
|
</div>
|
128
128
|
</div>
|
129
129
|
|
@@ -147,7 +147,7 @@ more information on this.
|
|
147
147
|
<td width="3em"> </td>
|
148
148
|
<td class="context-item-desc">
|
149
149
|
these are stripped out of any keys passed to <a
|
150
|
-
href="CGIWrapper.html#
|
150
|
+
href="CGIWrapper.html#M000058">CGIWrapper.header</a> function
|
151
151
|
|
152
152
|
</td>
|
153
153
|
</tr>
|
@@ -187,12 +187,12 @@ href="CGIWrapper.html#M000052">CGIWrapper.header</a> function
|
|
187
187
|
<div id="methods">
|
188
188
|
<h3 class="section-bar">Public Class methods</h3>
|
189
189
|
|
190
|
-
<div id="method-
|
191
|
-
<a name="
|
190
|
+
<div id="method-M000057" class="method-detail">
|
191
|
+
<a name="M000057"></a>
|
192
192
|
|
193
193
|
<div class="method-heading">
|
194
|
-
<a href="CGIWrapper.src/
|
195
|
-
onclick="popupCode('CGIWrapper.src/
|
194
|
+
<a href="CGIWrapper.src/M000057.html" target="Code" class="method-signature"
|
195
|
+
onclick="popupCode('CGIWrapper.src/M000057.html');return false;">
|
196
196
|
<span class="method-name">new</span><span class="method-args">(request, response, *args)</span>
|
197
197
|
</a>
|
198
198
|
</div>
|
@@ -210,12 +210,12 @@ href="../Mongrel.html">Mongrel</a>’s view of the world.
|
|
210
210
|
|
211
211
|
<h3 class="section-bar">Public Instance methods</h3>
|
212
212
|
|
213
|
-
<div id="method-
|
214
|
-
<a name="
|
213
|
+
<div id="method-M000062" class="method-detail">
|
214
|
+
<a name="M000062"></a>
|
215
215
|
|
216
216
|
<div class="method-heading">
|
217
|
-
<a href="CGIWrapper.src/
|
218
|
-
onclick="popupCode('CGIWrapper.src/
|
217
|
+
<a href="CGIWrapper.src/M000062.html" target="Code" class="method-signature"
|
218
|
+
onclick="popupCode('CGIWrapper.src/M000062.html');return false;">
|
219
219
|
<span class="method-name">args</span><span class="method-args">()</span>
|
220
220
|
</a>
|
221
221
|
</div>
|
@@ -227,30 +227,30 @@ Used to wrap the normal args variable used inside CGI.
|
|
227
227
|
</div>
|
228
228
|
</div>
|
229
229
|
|
230
|
-
<div id="method-
|
231
|
-
<a name="
|
230
|
+
<div id="method-M000063" class="method-detail">
|
231
|
+
<a name="M000063"></a>
|
232
232
|
|
233
233
|
<div class="method-heading">
|
234
|
-
<a href="CGIWrapper.src/
|
235
|
-
onclick="popupCode('CGIWrapper.src/
|
234
|
+
<a href="CGIWrapper.src/M000063.html" target="Code" class="method-signature"
|
235
|
+
onclick="popupCode('CGIWrapper.src/M000063.html');return false;">
|
236
236
|
<span class="method-name">env_table</span><span class="method-args">()</span>
|
237
237
|
</a>
|
238
238
|
</div>
|
239
239
|
|
240
240
|
<div class="method-description">
|
241
241
|
<p>
|
242
|
-
Used to wrap the normal <a href="CGIWrapper.html#
|
242
|
+
Used to wrap the normal <a href="CGIWrapper.html#M000063">env_table</a>
|
243
243
|
variable used inside CGI.
|
244
244
|
</p>
|
245
245
|
</div>
|
246
246
|
</div>
|
247
247
|
|
248
|
-
<div id="method-
|
249
|
-
<a name="
|
248
|
+
<div id="method-M000058" class="method-detail">
|
249
|
+
<a name="M000058"></a>
|
250
250
|
|
251
251
|
<div class="method-heading">
|
252
|
-
<a href="CGIWrapper.src/
|
253
|
-
onclick="popupCode('CGIWrapper.src/
|
252
|
+
<a href="CGIWrapper.src/M000058.html" target="Code" class="method-signature"
|
253
|
+
onclick="popupCode('CGIWrapper.src/M000058.html');return false;">
|
254
254
|
<span class="method-name">header</span><span class="method-args">(options = "text/html")</span>
|
255
255
|
</a>
|
256
256
|
</div>
|
@@ -269,12 +269,12 @@ output.
|
|
269
269
|
</div>
|
270
270
|
</div>
|
271
271
|
|
272
|
-
<div id="method-
|
273
|
-
<a name="
|
272
|
+
<div id="method-M000060" class="method-detail">
|
273
|
+
<a name="M000060"></a>
|
274
274
|
|
275
275
|
<div class="method-heading">
|
276
|
-
<a href="CGIWrapper.src/
|
277
|
-
onclick="popupCode('CGIWrapper.src/
|
276
|
+
<a href="CGIWrapper.src/M000060.html" target="Code" class="method-signature"
|
277
|
+
onclick="popupCode('CGIWrapper.src/M000060.html');return false;">
|
278
278
|
<span class="method-name">out</span><span class="method-args">(options = "text/html") {||| "")| ...}</span>
|
279
279
|
</a>
|
280
280
|
</div>
|
@@ -286,17 +286,17 @@ So, we just reuse header and then finalize the <a
|
|
286
286
|
href="HttpResponse.html">HttpResponse</a> the right way. Status is taken
|
287
287
|
from the various options and converted to what <a
|
288
288
|
href="../Mongrel.html">Mongrel</a> needs via the <a
|
289
|
-
href="CGIWrapper.html#
|
289
|
+
href="CGIWrapper.html#M000061">CGIWrapper.status</a> function.
|
290
290
|
</p>
|
291
291
|
</div>
|
292
292
|
</div>
|
293
293
|
|
294
|
-
<div id="method-
|
295
|
-
<a name="
|
294
|
+
<div id="method-M000059" class="method-detail">
|
295
|
+
<a name="M000059"></a>
|
296
296
|
|
297
297
|
<div class="method-heading">
|
298
|
-
<a href="CGIWrapper.src/
|
299
|
-
onclick="popupCode('CGIWrapper.src/
|
298
|
+
<a href="CGIWrapper.src/M000059.html" target="Code" class="method-signature"
|
299
|
+
onclick="popupCode('CGIWrapper.src/M000059.html');return false;">
|
300
300
|
<span class="method-name">send_cookies</span><span class="method-args">(to)</span>
|
301
301
|
</a>
|
302
302
|
</div>
|
@@ -312,12 +312,12 @@ the options. If cookie is an Array or Hash then it sends those on with
|
|
312
312
|
</div>
|
313
313
|
</div>
|
314
314
|
|
315
|
-
<div id="method-
|
316
|
-
<a name="
|
315
|
+
<div id="method-M000061" class="method-detail">
|
316
|
+
<a name="M000061"></a>
|
317
317
|
|
318
318
|
<div class="method-heading">
|
319
|
-
<a href="CGIWrapper.src/
|
320
|
-
onclick="popupCode('CGIWrapper.src/
|
319
|
+
<a href="CGIWrapper.src/M000061.html" target="Code" class="method-signature"
|
320
|
+
onclick="popupCode('CGIWrapper.src/M000061.html');return false;">
|
321
321
|
<span class="method-name">status</span><span class="method-args">()</span>
|
322
322
|
</a>
|
323
323
|
</div>
|
@@ -331,12 +331,12 @@ status message in the status we have to do a bit of parsing.
|
|
331
331
|
</div>
|
332
332
|
</div>
|
333
333
|
|
334
|
-
<div id="method-
|
335
|
-
<a name="
|
334
|
+
<div id="method-M000064" class="method-detail">
|
335
|
+
<a name="M000064"></a>
|
336
336
|
|
337
337
|
<div class="method-heading">
|
338
|
-
<a href="CGIWrapper.src/
|
339
|
-
onclick="popupCode('CGIWrapper.src/
|
338
|
+
<a href="CGIWrapper.src/M000064.html" target="Code" class="method-signature"
|
339
|
+
onclick="popupCode('CGIWrapper.src/M000064.html');return false;">
|
340
340
|
<span class="method-name">stdinput</span><span class="method-args">()</span>
|
341
341
|
</a>
|
342
342
|
</div>
|
@@ -348,12 +348,12 @@ Used to wrap the normal stdinput variable used inside CGI.
|
|
348
348
|
</div>
|
349
349
|
</div>
|
350
350
|
|
351
|
-
<div id="method-
|
352
|
-
<a name="
|
351
|
+
<div id="method-M000065" class="method-detail">
|
352
|
+
<a name="M000065"></a>
|
353
353
|
|
354
354
|
<div class="method-heading">
|
355
|
-
<a href="CGIWrapper.src/
|
356
|
-
onclick="popupCode('CGIWrapper.src/
|
355
|
+
<a href="CGIWrapper.src/M000065.html" target="Code" class="method-signature"
|
356
|
+
onclick="popupCode('CGIWrapper.src/M000065.html');return false;">
|
357
357
|
<span class="method-name">stdoutput</span><span class="method-args">()</span>
|
358
358
|
</a>
|
359
359
|
</div>
|
@@ -5,14 +5,20 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>new (Mongrel::CGIWrapper)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 34</span>
|
14
|
+
34: <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
|
+
35: <span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span>
|
16
|
+
36: <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">response</span>
|
17
|
+
37: <span class="ruby-ivar">@args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
18
|
+
38: <span class="ruby-ivar">@input</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>)
|
19
|
+
39: <span class="ruby-ivar">@head</span> = {}
|
20
|
+
40: <span class="ruby-ivar">@out_called</span> = <span class="ruby-keyword kw">false</span>
|
21
|
+
41: <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
22
|
+
42: <span class="ruby-keyword kw">end</span></pre>
|
17
23
|
</body>
|
18
24
|
</html>
|
@@ -5,14 +5,43 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>header (Mongrel::CGIWrapper)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel/cgi.rb, line 51</span>
|
14
|
+
51: <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
|
+
52: <span class="ruby-comment cmt"># if they pass in a string then just write the Content-Type</span>
|
16
|
+
53: <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
|
+
54: <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
|
+
55: <span class="ruby-keyword kw">else</span>
|
19
|
+
56: <span class="ruby-comment cmt"># convert the given options into what Mongrel wants</span>
|
20
|
+
57: <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
|
+
58: <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
|
+
59:
|
23
|
+
60: <span class="ruby-comment cmt"># setup date only if they use nph</span>
|
24
|
+
61: <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
|
+
62:
|
26
|
+
63: <span class="ruby-comment cmt"># setup the server to use the default or what they set</span>
|
27
|
+
64: <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
|
+
65:
|
29
|
+
66: <span class="ruby-comment cmt"># remaining possible options they can give</span>
|
30
|
+
67: <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
|
+
68: <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
|
+
69: <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
|
+
70:
|
34
|
+
71: <span class="ruby-comment cmt"># drop the keys we don't want anymore</span>
|
35
|
+
72: <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
|
+
73:
|
37
|
+
74: <span class="ruby-comment cmt"># finally just convert the rest raw (which puts 'cookie' directly)</span>
|
38
|
+
75: <span class="ruby-comment cmt"># 'cookie' is translated later as we write the header out</span>
|
39
|
+
76: <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
|
+
77: <span class="ruby-keyword kw">end</span>
|
41
|
+
78:
|
42
|
+
79: <span class="ruby-comment cmt"># doing this fakes out the cgi library to think the headers are empty</span>
|
43
|
+
80: <span class="ruby-comment cmt"># we then do the real headers in the out function call later</span>
|
44
|
+
81: <span class="ruby-value str">""</span>
|
45
|
+
82: <span class="ruby-keyword kw">end</span></pre>
|
17
46
|
</body>
|
18
47
|
</html>
|