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/examples/camping/blog.rb
CHANGED
@@ -2,10 +2,15 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.dirname(__FILE__) + "/../../lib"
|
4
4
|
require 'rubygems'
|
5
|
-
|
5
|
+
require_gem 'camping', '>=1.4'
|
6
|
+
require 'camping/session'
|
6
7
|
|
7
8
|
Camping.goes :Blog
|
8
9
|
|
10
|
+
module Blog
|
11
|
+
include Camping::Session
|
12
|
+
end
|
13
|
+
|
9
14
|
module Blog::Models
|
10
15
|
def self.schema(&block)
|
11
16
|
@@schema = block if block_given?
|
@@ -48,15 +53,15 @@ module Blog::Controllers
|
|
48
53
|
|
49
54
|
class Add
|
50
55
|
def get
|
51
|
-
unless
|
52
|
-
@
|
56
|
+
unless @state.user_id.blank?
|
57
|
+
@user = User.find @state.user_id
|
53
58
|
@post = Post.new
|
54
59
|
end
|
55
60
|
render :add
|
56
61
|
end
|
57
62
|
def post
|
58
63
|
post = Post.create :title => input.post_title, :body => input.post_body,
|
59
|
-
:user_id => @
|
64
|
+
:user_id => @state.user_id
|
60
65
|
redirect View, post
|
61
66
|
end
|
62
67
|
end
|
@@ -81,8 +86,8 @@ module Blog::Controllers
|
|
81
86
|
|
82
87
|
class Edit < R '/edit/(\d+)', '/edit'
|
83
88
|
def get post_id
|
84
|
-
unless
|
85
|
-
@
|
89
|
+
unless @state.user_id.blank?
|
90
|
+
@user = User.find @state.user_id
|
86
91
|
end
|
87
92
|
@post = Post.find post_id
|
88
93
|
render :edit
|
@@ -109,7 +114,7 @@ module Blog::Controllers
|
|
109
114
|
|
110
115
|
if @user
|
111
116
|
@login = 'login success !'
|
112
|
-
|
117
|
+
@state.user_id = @user.id
|
113
118
|
else
|
114
119
|
@login = 'wrong user name or password'
|
115
120
|
end
|
@@ -119,7 +124,7 @@ module Blog::Controllers
|
|
119
124
|
|
120
125
|
class Logout
|
121
126
|
def get
|
122
|
-
|
127
|
+
@state.user_id = nil
|
123
128
|
render :logout
|
124
129
|
end
|
125
130
|
end
|
@@ -183,7 +188,7 @@ module Blog::Views
|
|
183
188
|
end
|
184
189
|
|
185
190
|
def add
|
186
|
-
if @
|
191
|
+
if @user
|
187
192
|
_form(post, :action => R(Add))
|
188
193
|
else
|
189
194
|
_login
|
@@ -191,7 +196,7 @@ module Blog::Views
|
|
191
196
|
end
|
192
197
|
|
193
198
|
def edit
|
194
|
-
if @
|
199
|
+
if @user
|
195
200
|
_form(post, :action => R(Edit))
|
196
201
|
else
|
197
202
|
_login
|
@@ -241,7 +246,7 @@ module Blog::Views
|
|
241
246
|
|
242
247
|
def _form(post, opts)
|
243
248
|
p do
|
244
|
-
text "You are logged in as #{@
|
249
|
+
text "You are logged in as #{@user.username} | "
|
245
250
|
a 'Logout', :href => R(Logout)
|
246
251
|
end
|
247
252
|
form({:method => 'post'}.merge(opts)) do
|
@@ -259,42 +264,22 @@ module Blog::Views
|
|
259
264
|
end
|
260
265
|
|
261
266
|
def Blog.create
|
267
|
+
Camping::Models::Session.create_schema
|
262
268
|
unless Blog::Models::Post.table_exists?
|
263
269
|
ActiveRecord::Schema.define(&Blog::Models.schema)
|
264
|
-
puts "** The blog.db file has been created."
|
265
|
-
puts "** When adding/editing posts -- username: admin, password: camping"
|
266
270
|
end
|
267
271
|
end
|
268
272
|
|
269
273
|
if __FILE__ == $0
|
270
|
-
require '
|
271
|
-
|
272
|
-
class CampingHandler < Mongrel::HttpHandler
|
273
|
-
def initialize(klass)
|
274
|
-
@klass = klass
|
275
|
-
end
|
276
|
-
def process(request, response)
|
277
|
-
req = StringIO.new(request.body)
|
278
|
-
controller = @klass.run(req, request.params)
|
279
|
-
response.start(controller.status) do |head,out|
|
280
|
-
controller.headers.each do |k, v|
|
281
|
-
[*v].each do |vi|
|
282
|
-
head[k] = vi
|
283
|
-
end
|
284
|
-
end
|
285
|
-
out << controller.body
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
274
|
+
require 'mongrel/camping'
|
289
275
|
|
290
276
|
Blog::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'blog.db'
|
291
277
|
Blog::Models::Base.logger = Logger.new('camping.log')
|
292
278
|
Blog::Models::Base.threaded_connections=false
|
293
279
|
Blog.create
|
294
280
|
|
295
|
-
|
296
|
-
puts "** Blog example is running at http://localhost:
|
297
|
-
|
298
|
-
|
299
|
-
h.run.join
|
281
|
+
server = Mongrel::Camping::start("0.0.0.0",3002,"/blog",Blog)
|
282
|
+
puts "** Blog example is running at http://localhost:3002/blog"
|
283
|
+
puts "** Default username is `admin', password is `camping'"
|
284
|
+
server.acceptor.join
|
300
285
|
end
|
data/examples/camping/tepee.rb
CHANGED
@@ -135,34 +135,14 @@ def Tepee.create
|
|
135
135
|
end
|
136
136
|
|
137
137
|
if __FILE__ == $0
|
138
|
-
require '
|
139
|
-
|
140
|
-
class CampingHandler < Mongrel::HttpHandler
|
141
|
-
def initialize(klass)
|
142
|
-
@klass = klass
|
143
|
-
end
|
144
|
-
def process(request, response)
|
145
|
-
req = StringIO.new(request.body)
|
146
|
-
controller = @klass.run(req, request.params)
|
147
|
-
response.start(controller.status) do |head,out|
|
148
|
-
controller.headers.each do |k, v|
|
149
|
-
[*v].each do |vi|
|
150
|
-
head[k] = vi
|
151
|
-
end
|
152
|
-
end
|
153
|
-
out << controller.body
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
138
|
+
require 'mongrel/camping'
|
157
139
|
|
158
140
|
Tepee::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'tepee.db'
|
159
141
|
Tepee::Models::Base.logger = Logger.new('camping.log')
|
160
142
|
Tepee::Models::Base.threaded_connections=false
|
161
143
|
Tepee.create
|
162
144
|
|
163
|
-
|
145
|
+
server = Mongrel::Camping::start("0.0.0.0",3000,"/tepee",Tepee)
|
164
146
|
puts "** Tepee example is running at http://localhost:3000/tepee"
|
165
|
-
|
166
|
-
h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
|
167
|
-
h.run.join
|
147
|
+
server.acceptor.join
|
168
148
|
end
|
data/lib/mongrel.rb
CHANGED
@@ -5,8 +5,9 @@ require 'stringio'
|
|
5
5
|
require 'mongrel/cgi'
|
6
6
|
require 'mongrel/handlers'
|
7
7
|
require 'mongrel/command'
|
8
|
-
require 'mongrel/plugins'
|
9
8
|
require 'timeout'
|
9
|
+
require 'mongrel/tcphack'
|
10
|
+
|
10
11
|
|
11
12
|
# Mongrel module containing all of the classes (include C extensions) for running
|
12
13
|
# a Mongrel web server. It contains a minimalist HTTP server with just enough
|
@@ -140,7 +141,7 @@ module Mongrel
|
|
140
141
|
SERVER_SOFTWARE='SERVER_SOFTWARE'
|
141
142
|
|
142
143
|
# Current Mongrel version (used for SERVER_SOFTWARE and other response headers).
|
143
|
-
MONGREL_VERSION='Mongrel 0.3.
|
144
|
+
MONGREL_VERSION='Mongrel 0.3.10'
|
144
145
|
|
145
146
|
# The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
|
146
147
|
ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: #{MONGREL_VERSION}\r\n\r\nNOT FOUND"
|
@@ -477,5 +478,3 @@ module Mongrel
|
|
477
478
|
end
|
478
479
|
|
479
480
|
end
|
480
|
-
|
481
|
-
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'mongrel'
|
2
|
+
|
3
|
+
|
4
|
+
module Mongrel
|
5
|
+
# Support for the Camping micro framework at http://camping.rubyforge.org
|
6
|
+
# This implements the unusually long Postamble that Camping usually
|
7
|
+
# needs and shrinks it down to just a single line or two.
|
8
|
+
#
|
9
|
+
# Your Postamble would now be:
|
10
|
+
#
|
11
|
+
# Mongrel::Camping::start("0.0.0.0",3001,"/tepee",Tepee).join
|
12
|
+
#
|
13
|
+
# If you wish to get fancier than this then you can use the
|
14
|
+
# Camping::CampingHandler directly instead and do your own
|
15
|
+
# wiring:
|
16
|
+
#
|
17
|
+
# h = Mongrel::HttpServer.new(server, port)
|
18
|
+
# h.register(uri, CampingHandler.new(Tepee))
|
19
|
+
# h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
|
20
|
+
#
|
21
|
+
# I add the /favicon.ico since camping apps typically don't
|
22
|
+
# have them and it's just annoying anyway.
|
23
|
+
module Camping
|
24
|
+
|
25
|
+
# This is a specialized handler for Camping applications
|
26
|
+
# that has them process the request and then translates
|
27
|
+
# the results into something the Mongrel::HttpResponse
|
28
|
+
# needs.
|
29
|
+
class CampingHandler < Mongrel::HttpHandler
|
30
|
+
def initialize(klass)
|
31
|
+
@klass = klass
|
32
|
+
end
|
33
|
+
|
34
|
+
def process(request, response)
|
35
|
+
req = StringIO.new(request.body)
|
36
|
+
controller = @klass.run(req, request.params)
|
37
|
+
response.start(controller.status) do |head,out|
|
38
|
+
controller.headers.each do |k, v|
|
39
|
+
[*v].each do |vi|
|
40
|
+
head[k] = vi
|
41
|
+
end
|
42
|
+
end
|
43
|
+
out << controller.body
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# This is a convenience method that wires up a CampingHandler
|
49
|
+
# for your application on a given port and uri. It's pretty
|
50
|
+
# much all you need for a camping application to work right.
|
51
|
+
#
|
52
|
+
# It returns the Mongrel::HttpServer which you should either
|
53
|
+
# join or somehow manage. The thread is running when
|
54
|
+
# returned.
|
55
|
+
|
56
|
+
def Camping.start(server, port, uri, klass)
|
57
|
+
h = Mongrel::HttpServer.new(server, port)
|
58
|
+
h.register(uri, CampingHandler.new(klass))
|
59
|
+
h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
|
60
|
+
h.run
|
61
|
+
return h
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/mongrel/command.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'singleton'
|
2
3
|
require 'optparse'
|
3
|
-
require '
|
4
|
+
require 'gem_plugin'
|
4
5
|
|
5
6
|
module Mongrel
|
6
7
|
|
@@ -114,7 +115,7 @@ module Mongrel
|
|
114
115
|
# Builds a list of possible commands from the Command derivates list
|
115
116
|
def commands
|
116
117
|
pmgr = GemPlugin::Manager.instance
|
117
|
-
list = pmgr.
|
118
|
+
list = pmgr.plugins["/commands"].keys
|
118
119
|
return list.sort
|
119
120
|
end
|
120
121
|
|
data/lib/mongrel/rails.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'mongrel'
|
2
|
-
|
2
|
+
require 'cgi'
|
3
3
|
|
4
4
|
# Implements a handler that can run Rails and serve files out of the
|
5
5
|
# Rails application's public directory. This lets you run your Rails
|
@@ -23,11 +23,12 @@ require_gem 'rails'
|
|
23
23
|
# An additional feature you can use is
|
24
24
|
class RailsHandler < Mongrel::HttpHandler
|
25
25
|
attr_reader :files
|
26
|
-
|
26
|
+
attr_reader :guard
|
27
|
+
|
27
28
|
def initialize(dir, mime_map = {})
|
28
29
|
@files = Mongrel::DirHandler.new(dir,false)
|
29
30
|
@guard = Mutex.new
|
30
|
-
|
31
|
+
|
31
32
|
# register the requested mime types
|
32
33
|
mime_map.each {|k,v| Mongrel::DirHandler::add_mime_type(k,v) }
|
33
34
|
end
|
@@ -52,10 +53,10 @@ class RailsHandler < Mongrel::HttpHandler
|
|
52
53
|
request.params[Mongrel::Const::PATH_INFO] = page_cached
|
53
54
|
@files.process(request,response)
|
54
55
|
else
|
55
|
-
cgi = Mongrel::CGIWrapper.new(request, response)
|
56
|
-
cgi.handler = self
|
57
|
-
|
58
56
|
begin
|
57
|
+
cgi = Mongrel::CGIWrapper.new(request, response)
|
58
|
+
cgi.handler = self
|
59
|
+
|
59
60
|
@guard.synchronize do
|
60
61
|
# Rails is not thread safe so must be run entirely within synchronize
|
61
62
|
Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
|
@@ -72,4 +73,13 @@ class RailsHandler < Mongrel::HttpHandler
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
|
77
|
+
def reload!
|
78
|
+
@guard.synchronize do
|
79
|
+
$".replace $orig_dollar_quote
|
80
|
+
GC.start
|
81
|
+
Dispatcher.reset_application!
|
82
|
+
ActionController::Routing::Routes.reload
|
83
|
+
end
|
84
|
+
end
|
75
85
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
# A modification proposed by Sean Treadway that increases the default accept
|
3
|
+
# queue of TCPServer to 1024 so that it handles more concurrent requests.
|
4
|
+
class TCPServer
|
5
|
+
def initialize_with_backlog(*args)
|
6
|
+
initialize_without_backlog(*args)
|
7
|
+
listen(1024)
|
8
|
+
end
|
9
|
+
|
10
|
+
alias_method :initialize_without_backlog, :initialize
|
11
|
+
alias_method :initialize, :initialize_with_backlog
|
12
|
+
end
|
data/tools/rakehelp.rb
CHANGED
@@ -64,22 +64,18 @@ def setup_extension(dir, extension)
|
|
64
64
|
end
|
65
65
|
|
66
66
|
|
67
|
-
def base_gem_spec(pkg_name, pkg_version
|
67
|
+
def base_gem_spec(pkg_name, pkg_version)
|
68
68
|
pkg_version = pkg_version
|
69
69
|
pkg_name = pkg_name
|
70
70
|
pkg_file_name = "#{pkg_name}-#{pkg_version}"
|
71
71
|
Gem::Specification.new do |s|
|
72
72
|
s.name = pkg_name
|
73
73
|
s.version = pkg_version
|
74
|
-
s.required_ruby_version = '>= 1.8.3'
|
75
74
|
s.platform = Gem::Platform::RUBY
|
76
|
-
s.author = author
|
77
|
-
s.summary = summary
|
78
|
-
s.test_file = test_file
|
79
75
|
s.has_rdoc = true
|
80
76
|
s.extra_rdoc_files = [ "README" ]
|
81
77
|
|
82
|
-
s.files = %w(COPYING LICENSE
|
78
|
+
s.files = %w(COPYING LICENSE README Rakefile) +
|
83
79
|
Dir.glob("{bin,doc/rdoc,test,lib}/**/*") +
|
84
80
|
Dir.glob("ext/**/*.{h,c,rb}") +
|
85
81
|
Dir.glob("examples/**/*.rb") +
|
@@ -87,14 +83,12 @@ def base_gem_spec(pkg_name, pkg_version, author, summary, executables, test_file
|
|
87
83
|
|
88
84
|
s.require_path = "lib"
|
89
85
|
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
90
|
-
|
91
|
-
s.executables = executables
|
92
86
|
s.bindir = "bin"
|
93
87
|
end
|
94
88
|
end
|
95
89
|
|
96
|
-
def setup_gem(pkg_name, pkg_version
|
97
|
-
spec = base_gem_spec(pkg_name, pkg_version
|
90
|
+
def setup_gem(pkg_name, pkg_version)
|
91
|
+
spec = base_gem_spec(pkg_name, pkg_version)
|
98
92
|
yield spec if block_given?
|
99
93
|
|
100
94
|
Rake::GemPackageTask.new(spec) do |p|
|
@@ -103,9 +97,13 @@ def setup_gem(pkg_name, pkg_version, author, summary, executables, test_file)
|
|
103
97
|
end
|
104
98
|
end
|
105
99
|
|
106
|
-
def setup_win32_gem(pkg_name, pkg_version
|
107
|
-
spec = base_gem_spec(pkg_name, pkg_version
|
100
|
+
def setup_win32_gem(pkg_name, pkg_version)
|
101
|
+
spec = base_gem_spec(pkg_name, pkg_version)
|
108
102
|
yield spec if block_given?
|
109
103
|
|
110
104
|
Gem::Builder.new(spec).build
|
111
105
|
end
|
106
|
+
|
107
|
+
def sub_project(project, target="")
|
108
|
+
sh %{cd projects/#{project}; rake #{target.to_s}; }
|
109
|
+
end
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: mongrel
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2006-03-
|
6
|
+
version: 0.3.10
|
7
|
+
date: 2006-03-12 00:00:00 -05:00
|
8
8
|
summary: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email:
|
12
12
|
homepage:
|
13
13
|
rubyforge_project:
|
14
|
-
description:
|
14
|
+
description: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -20,7 +20,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.
|
23
|
+
version: 1.8.4
|
24
24
|
version:
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
@@ -30,10 +30,8 @@ authors:
|
|
30
30
|
files:
|
31
31
|
- COPYING
|
32
32
|
- LICENSE
|
33
|
-
- ext/http11/MANIFEST
|
34
33
|
- README
|
35
34
|
- Rakefile
|
36
|
-
- setup.rb
|
37
35
|
- bin/mongrel_rails
|
38
36
|
- bin/mongrel_rails_service
|
39
37
|
- bin/mongrel_rails_svc
|
@@ -49,6 +47,11 @@ files:
|
|
49
47
|
- doc/rdoc/classes/Mongrel.html
|
50
48
|
- doc/rdoc/classes/RailsHandler.html
|
51
49
|
- doc/rdoc/classes/RailsHandler.src
|
50
|
+
- doc/rdoc/classes/TCPServer.html
|
51
|
+
- doc/rdoc/classes/TCPServer.src
|
52
|
+
- doc/rdoc/classes/Mongrel/Camping
|
53
|
+
- doc/rdoc/classes/Mongrel/Camping.html
|
54
|
+
- doc/rdoc/classes/Mongrel/Camping.src
|
52
55
|
- doc/rdoc/classes/Mongrel/CGIWrapper.html
|
53
56
|
- doc/rdoc/classes/Mongrel/CGIWrapper.src
|
54
57
|
- doc/rdoc/classes/Mongrel/Command
|
@@ -74,22 +77,24 @@ files:
|
|
74
77
|
- doc/rdoc/classes/Mongrel/TimeoutWorker.html
|
75
78
|
- doc/rdoc/classes/Mongrel/URIClassifier.html
|
76
79
|
- doc/rdoc/classes/Mongrel/URIClassifier.src
|
77
|
-
- doc/rdoc/classes/Mongrel/
|
78
|
-
- doc/rdoc/classes/Mongrel/
|
79
|
-
- doc/rdoc/classes/Mongrel/
|
80
|
-
- doc/rdoc/classes/Mongrel/
|
81
|
-
- doc/rdoc/classes/Mongrel/
|
82
|
-
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000056.html
|
80
|
+
- doc/rdoc/classes/Mongrel/Camping/CampingHandler.html
|
81
|
+
- doc/rdoc/classes/Mongrel/Camping/CampingHandler.src
|
82
|
+
- doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000020.html
|
83
|
+
- doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000021.html
|
84
|
+
- doc/rdoc/classes/Mongrel/Camping.src/M000019.html
|
83
85
|
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html
|
84
86
|
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html
|
85
87
|
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html
|
88
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000060.html
|
89
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000061.html
|
90
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000062.html
|
91
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000063.html
|
92
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000064.html
|
93
|
+
- doc/rdoc/classes/Mongrel/CGIWrapper.src/M000065.html
|
86
94
|
- doc/rdoc/classes/Mongrel/Command/Base.html
|
87
95
|
- doc/rdoc/classes/Mongrel/Command/Base.src
|
88
96
|
- doc/rdoc/classes/Mongrel/Command/Registry.html
|
89
97
|
- doc/rdoc/classes/Mongrel/Command/Registry.src
|
90
|
-
- doc/rdoc/classes/Mongrel/Command/Base.src/M000003.html
|
91
|
-
- doc/rdoc/classes/Mongrel/Command/Base.src/M000004.html
|
92
|
-
- doc/rdoc/classes/Mongrel/Command/Base.src/M000005.html
|
93
98
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html
|
94
99
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html
|
95
100
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html
|
@@ -97,49 +102,54 @@ files:
|
|
97
102
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html
|
98
103
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html
|
99
104
|
- doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html
|
100
|
-
- doc/rdoc/classes/Mongrel/Command/
|
101
|
-
- doc/rdoc/classes/Mongrel/Command/
|
102
|
-
- doc/rdoc/classes/Mongrel/Command/
|
103
|
-
- doc/rdoc/classes/Mongrel/
|
104
|
-
- doc/rdoc/classes/Mongrel/
|
105
|
-
- doc/rdoc/classes/Mongrel/
|
106
|
-
- doc/rdoc/classes/Mongrel/DirHandler.src/
|
107
|
-
- doc/rdoc/classes/Mongrel/DirHandler.src/
|
108
|
-
- doc/rdoc/classes/Mongrel/DirHandler.src/
|
109
|
-
- doc/rdoc/classes/Mongrel/
|
110
|
-
- doc/rdoc/classes/Mongrel/
|
111
|
-
- doc/rdoc/classes/Mongrel/
|
112
|
-
- doc/rdoc/classes/Mongrel/
|
113
|
-
- doc/rdoc/classes/Mongrel/
|
114
|
-
- doc/rdoc/classes/Mongrel/
|
115
|
-
- doc/rdoc/classes/Mongrel/
|
116
|
-
- doc/rdoc/classes/Mongrel/
|
117
|
-
- doc/rdoc/classes/Mongrel/HttpParser.src/M000019.html
|
118
|
-
- doc/rdoc/classes/Mongrel/HttpParser.src/M000020.html
|
119
|
-
- doc/rdoc/classes/Mongrel/HttpParser.src/M000021.html
|
105
|
+
- doc/rdoc/classes/Mongrel/Command/Base.src/M000013.html
|
106
|
+
- doc/rdoc/classes/Mongrel/Command/Base.src/M000014.html
|
107
|
+
- doc/rdoc/classes/Mongrel/Command/Base.src/M000015.html
|
108
|
+
- doc/rdoc/classes/Mongrel/Command/Registry.src/M000016.html
|
109
|
+
- doc/rdoc/classes/Mongrel/Command/Registry.src/M000017.html
|
110
|
+
- doc/rdoc/classes/Mongrel/Command/Registry.src/M000018.html
|
111
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000029.html
|
112
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000030.html
|
113
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000031.html
|
114
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000032.html
|
115
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000033.html
|
116
|
+
- doc/rdoc/classes/Mongrel/DirHandler.src/M000034.html
|
117
|
+
- doc/rdoc/classes/Mongrel/Error404Handler.src/M000066.html
|
118
|
+
- doc/rdoc/classes/Mongrel/Error404Handler.src/M000067.html
|
119
|
+
- doc/rdoc/classes/Mongrel/HeaderOut.src/M000041.html
|
120
|
+
- doc/rdoc/classes/Mongrel/HeaderOut.src/M000042.html
|
121
|
+
- doc/rdoc/classes/Mongrel/HttpHandler.src/M000043.html
|
120
122
|
- doc/rdoc/classes/Mongrel/HttpParser.src/M000022.html
|
121
|
-
- doc/rdoc/classes/Mongrel/
|
122
|
-
- doc/rdoc/classes/Mongrel/
|
123
|
-
- doc/rdoc/classes/Mongrel/
|
124
|
-
- doc/rdoc/classes/Mongrel/
|
125
|
-
- doc/rdoc/classes/Mongrel/
|
126
|
-
- doc/rdoc/classes/Mongrel/
|
127
|
-
- doc/rdoc/classes/Mongrel/
|
123
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000023.html
|
124
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000024.html
|
125
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000025.html
|
126
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000026.html
|
127
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000027.html
|
128
|
+
- doc/rdoc/classes/Mongrel/HttpParser.src/M000028.html
|
129
|
+
- doc/rdoc/classes/Mongrel/HttpRequest.src/M000068.html
|
128
130
|
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html
|
129
|
-
- doc/rdoc/classes/Mongrel/
|
130
|
-
- doc/rdoc/classes/Mongrel/
|
131
|
-
- doc/rdoc/classes/Mongrel/
|
132
|
-
- doc/rdoc/classes/Mongrel/
|
133
|
-
- doc/rdoc/classes/Mongrel/
|
134
|
-
- doc/rdoc/classes/Mongrel/
|
135
|
-
- doc/rdoc/classes/Mongrel/
|
136
|
-
- doc/rdoc/classes/Mongrel/
|
137
|
-
- doc/rdoc/classes/Mongrel/
|
138
|
-
- doc/rdoc/classes/Mongrel/
|
139
|
-
- doc/rdoc/classes/Mongrel/
|
140
|
-
- doc/rdoc/classes/Mongrel/
|
141
|
-
- doc/rdoc/classes/
|
142
|
-
- doc/rdoc/classes/
|
131
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html
|
132
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html
|
133
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000047.html
|
134
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000048.html
|
135
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000049.html
|
136
|
+
- doc/rdoc/classes/Mongrel/HttpResponse.src/M000050.html
|
137
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000035.html
|
138
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000036.html
|
139
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000037.html
|
140
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000038.html
|
141
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000039.html
|
142
|
+
- doc/rdoc/classes/Mongrel/HttpServer.src/M000040.html
|
143
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000051.html
|
144
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000052.html
|
145
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000053.html
|
146
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000054.html
|
147
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000055.html
|
148
|
+
- doc/rdoc/classes/Mongrel/URIClassifier.src/M000056.html
|
149
|
+
- doc/rdoc/classes/RailsHandler.src/M000003.html
|
150
|
+
- doc/rdoc/classes/RailsHandler.src/M000004.html
|
151
|
+
- doc/rdoc/classes/RailsHandler.src/M000005.html
|
152
|
+
- doc/rdoc/classes/TCPServer.src/M000001.html
|
143
153
|
- doc/rdoc/files/COPYING.html
|
144
154
|
- doc/rdoc/files/ext
|
145
155
|
- doc/rdoc/files/lib
|
@@ -149,23 +159,27 @@ files:
|
|
149
159
|
- doc/rdoc/files/ext/http11/http11_c.html
|
150
160
|
- doc/rdoc/files/lib/mongrel
|
151
161
|
- doc/rdoc/files/lib/mongrel_rb.html
|
162
|
+
- doc/rdoc/files/lib/mongrel/camping_rb.html
|
152
163
|
- doc/rdoc/files/lib/mongrel/cgi_rb.html
|
153
164
|
- doc/rdoc/files/lib/mongrel/command_rb.html
|
154
165
|
- doc/rdoc/files/lib/mongrel/handlers_rb.html
|
155
|
-
- doc/rdoc/files/lib/mongrel/
|
166
|
+
- doc/rdoc/files/lib/mongrel/init_rb.html
|
156
167
|
- doc/rdoc/files/lib/mongrel/rails_rb.html
|
168
|
+
- doc/rdoc/files/lib/mongrel/tcphack_rb.html
|
157
169
|
- test/test_http11.rb
|
158
170
|
- test/test_response.rb
|
159
171
|
- test/test_uriclassifier.rb
|
160
172
|
- test/test_ws.rb
|
161
173
|
- lib/mongrel
|
162
174
|
- lib/mongrel.rb
|
175
|
+
- lib/mongrel/camping.rb
|
163
176
|
- lib/mongrel/cgi.rb
|
164
177
|
- lib/mongrel/command
|
165
178
|
- lib/mongrel/command.rb
|
166
179
|
- lib/mongrel/handlers.rb
|
167
|
-
- lib/mongrel/
|
180
|
+
- lib/mongrel/init.rb
|
168
181
|
- lib/mongrel/rails.rb
|
182
|
+
- lib/mongrel/tcphack.rb
|
169
183
|
- ext/http11/ext_help.h
|
170
184
|
- ext/http11/http11_parser.h
|
171
185
|
- ext/http11/tst.h
|
@@ -185,6 +199,8 @@ files:
|
|
185
199
|
- examples/camping/blog.rb
|
186
200
|
- examples/camping/tepee.rb
|
187
201
|
- tools/rakehelp.rb
|
202
|
+
- ext/http11/MANIFEST
|
203
|
+
- setup.rb
|
188
204
|
test_files:
|
189
205
|
- test/test_ws.rb
|
190
206
|
rdoc_options: []
|