mongrel 0.3.7.1 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/bin/mongrel_rails_service +2 -2
- data/doc/rdoc/classes/Mongrel/Const.html +1 -1
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000010.html +3 -1
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000011.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000013.html +9 -9
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000028.html +0 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
- data/ext/http11/http11.c +0 -1
- data/lib/mongrel.rb +3 -1
- data/lib/mongrel/cgi.rb +16 -1
- data/lib/mongrel/rails.rb +8 -3
- metadata +2 -2
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]
|
20
|
+
task :package => [:clean,:compile]
|
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}
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
setup_extension("http11", "http11")
|
32
32
|
|
33
|
-
version="0.3.
|
33
|
+
version="0.3.8"
|
34
34
|
summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
|
35
35
|
test_file = "test/test_ws.rb"
|
36
36
|
author="Zed A. Shaw"
|
data/bin/mongrel_rails_service
CHANGED
@@ -20,7 +20,7 @@ module GenericCommand
|
|
20
20
|
def validate
|
21
21
|
valid? @svc_name != nil, "You must specify the service name to be uninstalled."
|
22
22
|
|
23
|
-
#
|
23
|
+
# Validate that the service exists
|
24
24
|
begin
|
25
25
|
valid? Service.exists?(@svc_name), "There is no service with that name, cannot proceed."
|
26
26
|
rescue
|
@@ -108,7 +108,7 @@ class Install < Mongrel::Plugin "/commands"
|
|
108
108
|
@params << "-p #{@port.to_i} " if @port
|
109
109
|
|
110
110
|
# mime
|
111
|
-
@params << "-m #{@mime_map} " if @mime_map
|
111
|
+
@params << "-m \"#{@mime_map}\" " if @mime_map
|
112
112
|
|
113
113
|
# num_procs
|
114
114
|
@params << "-P #{@num_procs.to_i} " if @num_procs
|
@@ -290,7 +290,7 @@ href="../Mongrel.html">Mongrel</a> man).
|
|
290
290
|
<tr class="top-aligned-row context-row">
|
291
291
|
<td class="context-item-name">MONGREL_VERSION</td>
|
292
292
|
<td>=</td>
|
293
|
-
<td class="context-item-value">'Mongrel 0.3.
|
293
|
+
<td class="context-item-value">'Mongrel 0.3.8'</td>
|
294
294
|
<td width="3em"> </td>
|
295
295
|
<td class="context-item-desc">
|
296
296
|
Current <a href="../Mongrel.html">Mongrel</a> version (used for
|
@@ -41,6 +41,8 @@
|
|
41
41
|
445: <span class="ruby-keyword kw">end</span>
|
42
42
|
446:
|
43
43
|
447: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
|
44
|
-
448:
|
44
|
+
448:
|
45
|
+
449: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
|
46
|
+
450: <span class="ruby-keyword kw">end</span></pre>
|
45
47
|
</body>
|
46
48
|
</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.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 456</span>
|
14
|
+
456: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
|
15
|
+
457: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
|
16
|
+
458: <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.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 462</span>
|
14
|
+
462: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
15
|
+
463: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
16
|
+
464: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</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.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 468</span>
|
14
|
+
468: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
15
|
+
469: <span class="ruby-identifier">stopper</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
16
|
+
470: <span class="ruby-ivar">@acceptor</span>[<span class="ruby-identifier">:stopped</span>] = <span class="ruby-keyword kw">true</span>
|
17
|
+
471: <span class="ruby-identifier">exc</span> = <span class="ruby-constant">StopServer</span>.<span class="ruby-identifier">new</span>
|
18
|
+
472: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">raise</span>(<span class="ruby-identifier">exc</span>)
|
19
|
+
473: <span class="ruby-keyword kw">end</span>
|
20
|
+
474: <span class="ruby-identifier">stopper</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">10</span>
|
21
|
+
475: <span class="ruby-keyword kw">end</span></pre>
|
22
22
|
</body>
|
23
23
|
</html>
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat Mar 04 13:27:08 EST 2006
|
data/ext/http11/http11.c
CHANGED
@@ -375,7 +375,6 @@ VALUE URIClassifier_resolve(VALUE self, VALUE uri)
|
|
375
375
|
struct tst *tst = NULL;
|
376
376
|
VALUE result;
|
377
377
|
unsigned char *uri_str = NULL;
|
378
|
-
unsigned char *script_name_str = NULL;
|
379
378
|
|
380
379
|
DATA_GET(self, struct tst, tst);
|
381
380
|
uri_str = (unsigned char *)StringValueCStr(uri);
|
data/lib/mongrel.rb
CHANGED
@@ -140,7 +140,7 @@ module Mongrel
|
|
140
140
|
SERVER_SOFTWARE='SERVER_SOFTWARE'
|
141
141
|
|
142
142
|
# Current Mongrel version (used for SERVER_SOFTWARE and other response headers).
|
143
|
-
MONGREL_VERSION='Mongrel 0.3.
|
143
|
+
MONGREL_VERSION='Mongrel 0.3.8'
|
144
144
|
|
145
145
|
# The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
|
146
146
|
ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: #{MONGREL_VERSION}\r\n\r\nNOT FOUND"
|
@@ -445,6 +445,8 @@ module Mongrel
|
|
445
445
|
end
|
446
446
|
|
447
447
|
@acceptor.priority = 1
|
448
|
+
|
449
|
+
return @acceptor
|
448
450
|
end
|
449
451
|
|
450
452
|
|
data/lib/mongrel/cgi.rb
CHANGED
@@ -1,14 +1,28 @@
|
|
1
1
|
require 'cgi'
|
2
2
|
|
3
3
|
module Mongrel
|
4
|
-
|
4
|
+
# The beginning of a complete wrapper around Mongrel's internal HTTP processing
|
5
5
|
# system but maintaining the original Ruby CGI module. Use this only as a crutch
|
6
6
|
# to get existing CGI based systems working. It should handle everything, but please
|
7
7
|
# notify me if you see special warnings. This work is still very alpha so I need
|
8
8
|
# testers to help work out the various corner cases.
|
9
|
+
#
|
10
|
+
# The CGIWrapper.handler attribute is normally not set and is available for
|
11
|
+
# frameworks that need to get back to the handler. Rails uses this to give
|
12
|
+
# people access to the RailsHandler#files (DirHandler really) so they can
|
13
|
+
# look-up paths and do other things withthe files managed there.
|
14
|
+
#
|
15
|
+
# In Rails you can get the real file for a request with:
|
16
|
+
#
|
17
|
+
# path = @request.cgi.handler.files.can_serve(@request['PATH_INFO'])
|
18
|
+
#
|
19
|
+
# Which is ugly but does the job. Feel free to write a Rails helper for that.
|
20
|
+
# Refer to DirHandler#can_serve for more information on this.
|
9
21
|
class CGIWrapper < ::CGI
|
10
22
|
public :env_table
|
11
23
|
attr_reader :options
|
24
|
+
attr_reader :handler
|
25
|
+
attr_writer :handler
|
12
26
|
|
13
27
|
# these are stripped out of any keys passed to CGIWrapper.header function
|
14
28
|
REMOVED_KEYS = [ "nph","status","server","connection","type",
|
@@ -143,5 +157,6 @@ module Mongrel
|
|
143
157
|
STDERR.puts "WARNING: Your program is doing something not expected. Please tell Zed that stdoutput was used and what software you are running. Thanks."
|
144
158
|
@response.body
|
145
159
|
end
|
160
|
+
|
146
161
|
end
|
147
162
|
end
|
data/lib/mongrel/rails.rb
CHANGED
@@ -19,7 +19,11 @@ require 'mongrel'
|
|
19
19
|
#
|
20
20
|
# This means that if you are using page caching it will actually work with Mongrel
|
21
21
|
# and you should see a decent speed boost (but not as fast as if you use lighttpd).
|
22
|
+
#
|
23
|
+
# An additional feature you can use is
|
22
24
|
class RailsHandler < Mongrel::HttpHandler
|
25
|
+
attr_reader :files
|
26
|
+
|
23
27
|
def initialize(dir, mime_map = {})
|
24
28
|
@files = Mongrel::DirHandler.new(dir,false)
|
25
29
|
@guard = Mutex.new
|
@@ -37,18 +41,19 @@ class RailsHandler < Mongrel::HttpHandler
|
|
37
41
|
def process(request, response)
|
38
42
|
return if response.socket.closed?
|
39
43
|
|
40
|
-
path_info = request.params[
|
41
|
-
page_cached = request.params[
|
44
|
+
path_info = request.params[Mongrel::Const::PATH_INFO]
|
45
|
+
page_cached = request.params[Mongrel::Const::PATH_INFO] + ".html"
|
42
46
|
|
43
47
|
if @files.can_serve(path_info)
|
44
48
|
# File exists as-is so serve it up
|
45
49
|
@files.process(request,response)
|
46
50
|
elsif @files.can_serve(page_cached)
|
47
51
|
# possible cached page, serve it up
|
48
|
-
request.params[
|
52
|
+
request.params[Mongrel::Const::PATH_INFO] = page_cached
|
49
53
|
@files.process(request,response)
|
50
54
|
else
|
51
55
|
cgi = Mongrel::CGIWrapper.new(request, response)
|
56
|
+
cgi.handler = self
|
52
57
|
|
53
58
|
begin
|
54
59
|
@guard.synchronize do
|
metadata
CHANGED
@@ -3,8 +3,8 @@ 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.8
|
7
|
+
date: 2006-03-04 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
|