mongrel 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +4 -3
- data/Rakefile +7 -5
- data/bin/mongrel_rails +5 -4
- data/bin/mongrel_rails_service +237 -0
- data/bin/mongrel_rails_svc +194 -0
- data/doc/rdoc/classes/Mongrel.html +1 -4
- data/doc/rdoc/classes/Mongrel/Const.html +13 -3
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000033.html → M000028.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000034.html → M000029.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000041.html +39 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000034.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000035.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000036.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000037.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000044.html → M000038.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000045.html → M000039.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.html +47 -28
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000022.html +33 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000023.html +57 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000024.html +46 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000025.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000026.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000027.html +19 -0
- data/doc/rdoc/classes/Mongrel/{HttpHandler.html → StopServer.html} +4 -33
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +22 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000035.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000036.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000037.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000038.html → M000033.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +9 -7
- data/doc/rdoc/files/lib/mongrel_rb.html +3 -3
- data/doc/rdoc/fr_class_index.html +1 -4
- data/doc/rdoc/fr_method_index.html +20 -37
- data/examples/mongrel_simple_ctrl.rb +92 -0
- data/examples/mongrel_simple_service.rb +116 -0
- data/examples/simpletest.rb +3 -1
- data/ext/http11/http11_parser.c +176 -263
- data/lib/mongrel.rb +56 -343
- data/lib/mongrel/cgi.rb +147 -0
- data/lib/mongrel/handlers.rb +180 -0
- metadata +28 -46
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -346
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +0 -48
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +0 -27
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -26
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html +0 -19
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -283
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +0 -40
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000056.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000057.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000058.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +0 -38
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +0 -64
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +0 -23
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/doc/rdoc/created.rid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Wed Feb 22 12:20:19 EST 2006
|
data/doc/rdoc/files/README.html
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Sun Feb 19 10:22:19 EST 2006</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -84,9 +84,11 @@ portability issues.
|
|
|
84
84
|
</p>
|
|
85
85
|
<h2>Status</h2>
|
|
86
86
|
<p>
|
|
87
|
-
The 0.3.
|
|
88
|
-
also sports the beginning of a command and plugin infrastructure.
|
|
89
|
-
|
|
87
|
+
The 0.3.6 release supports Ruby On Rails much better than previously, and
|
|
88
|
+
also sports the beginning of a command and plugin infrastructure. There is
|
|
89
|
+
now a more complete CGIWrapper that handles most of the CGI usage, but
|
|
90
|
+
still doesn’t do the MIME decoding or file upload/send (it leaves
|
|
91
|
+
that to CGI).
|
|
90
92
|
</p>
|
|
91
93
|
<p>
|
|
92
94
|
After you’ve installed (either with gem install mongrel or via
|
|
@@ -164,9 +166,9 @@ example:
|
|
|
164
166
|
<p>
|
|
165
167
|
If you run this and access port 3000 with a browser it will say
|
|
166
168
|
"hello!". If you access it with any url other than
|
|
167
|
-
"/test" it will give a simple 404. Check out the
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
"/test" it will give a simple 404. Check out the
|
|
170
|
+
Mongrel::Error404Handler for a basic way to give a more complex 404
|
|
171
|
+
message.
|
|
170
172
|
</p>
|
|
171
173
|
<p>
|
|
172
174
|
This also shows the DirHandler with directory listings. This is still rough
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Mon Feb 20 19:06:43 EST 2006</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
http11
|
|
78
78
|
thread
|
|
79
79
|
stringio
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
mongrel/cgi
|
|
81
|
+
mongrel/handlers
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
|
|
@@ -22,16 +22,13 @@
|
|
|
22
22
|
<div id="index-entries">
|
|
23
23
|
<a href="classes/FactoryError.html">FactoryError</a><br />
|
|
24
24
|
<a href="classes/Mongrel.html">Mongrel</a><br />
|
|
25
|
-
<a href="classes/Mongrel/CGIWrapper.html">Mongrel::CGIWrapper</a><br />
|
|
26
25
|
<a href="classes/Mongrel/Const.html">Mongrel::Const</a><br />
|
|
27
|
-
<a href="classes/Mongrel/DirHandler.html">Mongrel::DirHandler</a><br />
|
|
28
|
-
<a href="classes/Mongrel/Error404Handler.html">Mongrel::Error404Handler</a><br />
|
|
29
26
|
<a href="classes/Mongrel/HeaderOut.html">Mongrel::HeaderOut</a><br />
|
|
30
|
-
<a href="classes/Mongrel/HttpHandler.html">Mongrel::HttpHandler</a><br />
|
|
31
27
|
<a href="classes/Mongrel/HttpParser.html">Mongrel::HttpParser</a><br />
|
|
32
28
|
<a href="classes/Mongrel/HttpRequest.html">Mongrel::HttpRequest</a><br />
|
|
33
29
|
<a href="classes/Mongrel/HttpResponse.html">Mongrel::HttpResponse</a><br />
|
|
34
30
|
<a href="classes/Mongrel/HttpServer.html">Mongrel::HttpServer</a><br />
|
|
31
|
+
<a href="classes/Mongrel/StopServer.html">Mongrel::StopServer</a><br />
|
|
35
32
|
<a href="classes/Mongrel/URIClassifier.html">Mongrel::URIClassifier</a><br />
|
|
36
33
|
<a href="classes/PluginFactory.html">PluginFactory</a><br />
|
|
37
34
|
</div>
|
|
@@ -20,64 +20,47 @@
|
|
|
20
20
|
<div id="index">
|
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
|
-
<a href="classes/Mongrel/HeaderOut.html#
|
|
24
|
-
<a href="classes/Mongrel/DirHandler.html#M000027">add_mime_type (Mongrel::DirHandler)</a><br />
|
|
25
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000052">args (Mongrel::CGIWrapper)</a><br />
|
|
26
|
-
<a href="classes/Mongrel/DirHandler.html#M000023">can_serve (Mongrel::DirHandler)</a><br />
|
|
23
|
+
<a href="classes/Mongrel/HeaderOut.html#M000029">[]= (Mongrel::HeaderOut)</a><br />
|
|
27
24
|
<a href="classes/PluginFactory.html#M000009">create (PluginFactory)</a><br />
|
|
28
25
|
<a href="classes/PluginFactory.html#M000008">derivativeClasses (PluginFactory)</a><br />
|
|
29
26
|
<a href="classes/PluginFactory.html#M000005">derivatives (PluginFactory)</a><br />
|
|
30
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000053">env_table (Mongrel::CGIWrapper)</a><br />
|
|
31
27
|
<a href="classes/Mongrel/HttpParser.html#M000019">error? (Mongrel::HttpParser)</a><br />
|
|
32
28
|
<a href="classes/Mongrel/HttpParser.html#M000018">execute (Mongrel::HttpParser)</a><br />
|
|
33
29
|
<a href="classes/PluginFactory.html#M000004">extend_object (PluginFactory)</a><br />
|
|
34
30
|
<a href="classes/PluginFactory.html#M000006">factoryType (PluginFactory)</a><br />
|
|
35
31
|
<a href="classes/Mongrel/HttpParser.html#M000017">finish (Mongrel::HttpParser)</a><br />
|
|
36
|
-
<a href="classes/Mongrel/HttpResponse.html#
|
|
32
|
+
<a href="classes/Mongrel/HttpResponse.html#M000040">finished (Mongrel::HttpResponse)</a><br />
|
|
37
33
|
<a href="classes/Mongrel/HttpParser.html#M000020">finished? (Mongrel::HttpParser)</a><br />
|
|
38
34
|
<a href="classes/PluginFactory.html#M000012">getModuleName (PluginFactory)</a><br />
|
|
39
35
|
<a href="classes/PluginFactory.html#M000010">getSubclass (PluginFactory)</a><br />
|
|
40
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000048">header (Mongrel::CGIWrapper)</a><br />
|
|
41
36
|
<a href="classes/PluginFactory.html#M000003">included (PluginFactory)</a><br />
|
|
42
37
|
<a href="classes/PluginFactory.html#M000007">inherited (PluginFactory)</a><br />
|
|
43
38
|
<a href="classes/PluginFactory.html#M000011">loadDerivative (PluginFactory)</a><br />
|
|
44
39
|
<a href="classes/PluginFactory.html#M000002">log (PluginFactory)</a><br />
|
|
45
40
|
<a href="classes/PluginFactory.html#M000014">makeRequirePath (PluginFactory)</a><br />
|
|
46
|
-
<a href="classes/Mongrel/
|
|
47
|
-
<a href="classes/Mongrel/
|
|
48
|
-
<a href="classes/Mongrel/Error404Handler.html#M000056">new (Mongrel::Error404Handler)</a><br />
|
|
41
|
+
<a href="classes/Mongrel/HeaderOut.html#M000028">new (Mongrel::HeaderOut)</a><br />
|
|
42
|
+
<a href="classes/Mongrel/HttpResponse.html#M000034">new (Mongrel::HttpResponse)</a><br />
|
|
49
43
|
<a href="classes/Mongrel/HttpParser.html#M000015">new (Mongrel::HttpParser)</a><br />
|
|
50
|
-
<a href="classes/Mongrel/HttpServer.html#
|
|
51
|
-
<a href="classes/Mongrel/
|
|
52
|
-
<a href="classes/Mongrel/HeaderOut.html#M000033">new (Mongrel::HeaderOut)</a><br />
|
|
53
|
-
<a href="classes/Mongrel/URIClassifier.html#M000035">new (Mongrel::URIClassifier)</a><br />
|
|
44
|
+
<a href="classes/Mongrel/HttpServer.html#M000022">new (Mongrel::HttpServer)</a><br />
|
|
45
|
+
<a href="classes/Mongrel/URIClassifier.html#M000030">new (Mongrel::URIClassifier)</a><br />
|
|
54
46
|
<a href="classes/FactoryError.html#M000001">new (FactoryError)</a><br />
|
|
55
|
-
<a href="classes/Mongrel/HttpRequest.html#
|
|
47
|
+
<a href="classes/Mongrel/HttpRequest.html#M000041">new (Mongrel::HttpRequest)</a><br />
|
|
56
48
|
<a href="classes/Mongrel/HttpParser.html#M000021">nread (Mongrel::HttpParser)</a><br />
|
|
57
|
-
<a href="classes/Mongrel/
|
|
58
|
-
<a href="classes/Mongrel/
|
|
59
|
-
<a href="classes/Mongrel/
|
|
60
|
-
<a href="classes/Mongrel/DirHandler.html#M000026">process (Mongrel::DirHandler)</a><br />
|
|
61
|
-
<a href="classes/Mongrel/HttpServer.html#M000029">process_client (Mongrel::HttpServer)</a><br />
|
|
62
|
-
<a href="classes/Mongrel/URIClassifier.html#M000036">register (Mongrel::URIClassifier)</a><br />
|
|
63
|
-
<a href="classes/Mongrel/HttpServer.html#M000031">register (Mongrel::HttpServer)</a><br />
|
|
49
|
+
<a href="classes/Mongrel/HttpServer.html#M000023">process_client (Mongrel::HttpServer)</a><br />
|
|
50
|
+
<a href="classes/Mongrel/HttpServer.html#M000025">register (Mongrel::HttpServer)</a><br />
|
|
51
|
+
<a href="classes/Mongrel/URIClassifier.html#M000031">register (Mongrel::URIClassifier)</a><br />
|
|
64
52
|
<a href="classes/PluginFactory.html#M000013">requireDerivative (PluginFactory)</a><br />
|
|
53
|
+
<a href="classes/Mongrel/HttpResponse.html#M000036">reset (Mongrel::HttpResponse)</a><br />
|
|
65
54
|
<a href="classes/Mongrel/HttpParser.html#M000016">reset (Mongrel::HttpParser)</a><br />
|
|
66
|
-
<a href="classes/Mongrel/
|
|
67
|
-
<a href="classes/Mongrel/
|
|
68
|
-
<a href="classes/Mongrel/
|
|
69
|
-
<a href="classes/Mongrel/HttpResponse.html#
|
|
70
|
-
<a href="classes/Mongrel/
|
|
71
|
-
<a href="classes/Mongrel/
|
|
72
|
-
<a href="classes/Mongrel/
|
|
73
|
-
<a href="classes/Mongrel/
|
|
74
|
-
<a href="classes/Mongrel/
|
|
75
|
-
<a href="classes/Mongrel/HttpResponse.html#M000041">start (Mongrel::HttpResponse)</a><br />
|
|
76
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000051">status (Mongrel::CGIWrapper)</a><br />
|
|
77
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000054">stdinput (Mongrel::CGIWrapper)</a><br />
|
|
78
|
-
<a href="classes/Mongrel/CGIWrapper.html#M000055">stdoutput (Mongrel::CGIWrapper)</a><br />
|
|
79
|
-
<a href="classes/Mongrel/URIClassifier.html#M000037">unregister (Mongrel::URIClassifier)</a><br />
|
|
80
|
-
<a href="classes/Mongrel/HttpServer.html#M000032">unregister (Mongrel::HttpServer)</a><br />
|
|
55
|
+
<a href="classes/Mongrel/URIClassifier.html#M000033">resolve (Mongrel::URIClassifier)</a><br />
|
|
56
|
+
<a href="classes/Mongrel/HttpServer.html#M000024">run (Mongrel::HttpServer)</a><br />
|
|
57
|
+
<a href="classes/Mongrel/HttpResponse.html#M000039">send_body (Mongrel::HttpResponse)</a><br />
|
|
58
|
+
<a href="classes/Mongrel/HttpResponse.html#M000038">send_header (Mongrel::HttpResponse)</a><br />
|
|
59
|
+
<a href="classes/Mongrel/HttpResponse.html#M000037">send_status (Mongrel::HttpResponse)</a><br />
|
|
60
|
+
<a href="classes/Mongrel/HttpResponse.html#M000035">start (Mongrel::HttpResponse)</a><br />
|
|
61
|
+
<a href="classes/Mongrel/HttpServer.html#M000027">stop (Mongrel::HttpServer)</a><br />
|
|
62
|
+
<a href="classes/Mongrel/URIClassifier.html#M000032">unregister (Mongrel::URIClassifier)</a><br />
|
|
63
|
+
<a href="classes/Mongrel/HttpServer.html#M000026">unregister (Mongrel::HttpServer)</a><br />
|
|
81
64
|
</div>
|
|
82
65
|
</div>
|
|
83
66
|
</body>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
###############################################
|
|
2
|
+
# mongrel_simple_ctrl.rb
|
|
3
|
+
#
|
|
4
|
+
# Control script for the Mongrel server
|
|
5
|
+
###############################################
|
|
6
|
+
require "optparse"
|
|
7
|
+
require "win32/service"
|
|
8
|
+
include Win32
|
|
9
|
+
|
|
10
|
+
# I start the service name with an 'A' so that it appears at the top
|
|
11
|
+
SERVICE_NAME = "MongrelSvc"
|
|
12
|
+
SERVICE_DISPLAYNAME = "Mongrel HTTP Server"
|
|
13
|
+
SCRIPT_ROOT = File.join(File.dirname(__FILE__), '.')
|
|
14
|
+
SCRIPT_NAME = "mongrel_simple_service.rb"
|
|
15
|
+
SERVICE_SCRIPT = File.expand_path(SCRIPT_ROOT + '/' + SCRIPT_NAME)
|
|
16
|
+
|
|
17
|
+
OPTIONS = {}
|
|
18
|
+
|
|
19
|
+
ARGV.options do |opts|
|
|
20
|
+
opts.on("-d", "--delete", "Delete the service"){ OPTIONS[:delete] = true }
|
|
21
|
+
opts.on("-u", "--uninstall","Delete the service"){ OPTIONS[:uninstall] = true }
|
|
22
|
+
opts.on("-s", "--start", "Start the service"){ OPTIONS[:start] = true }
|
|
23
|
+
opts.on("-x", "--stop", "Stop the service"){ OPTIONS[:stop] = true }
|
|
24
|
+
opts.on("-i", "--install","Install the service"){ OPTIONS[:install] = true }
|
|
25
|
+
|
|
26
|
+
opts.on("-h", "--help", "Show this help message."){ puts opts; exit }
|
|
27
|
+
|
|
28
|
+
opts.parse!
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Install the service
|
|
32
|
+
if OPTIONS[:install]
|
|
33
|
+
require 'rbconfig'
|
|
34
|
+
|
|
35
|
+
svc = Service.new
|
|
36
|
+
svc.create_service{ |s|
|
|
37
|
+
s.service_name = SERVICE_NAME
|
|
38
|
+
s.display_name = SERVICE_DISPLAYNAME
|
|
39
|
+
s.binary_path_name = Config::CONFIG['bindir'] + '/ruby ' + SERVICE_SCRIPT
|
|
40
|
+
s.dependencies = []
|
|
41
|
+
}
|
|
42
|
+
svc.close
|
|
43
|
+
puts "#{SERVICE_DISPLAYNAME} service installed"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Start the service
|
|
47
|
+
if OPTIONS[:start]
|
|
48
|
+
Service.start(SERVICE_NAME)
|
|
49
|
+
started = false
|
|
50
|
+
while started == false
|
|
51
|
+
s = Service.status(SERVICE_NAME)
|
|
52
|
+
started = true if s.current_state == "running"
|
|
53
|
+
break if started == true
|
|
54
|
+
puts "One moment, " + s.current_state
|
|
55
|
+
sleep 1
|
|
56
|
+
end
|
|
57
|
+
puts "#{SERVICE_DISPLAYNAME} service started"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Stop the service
|
|
61
|
+
if OPTIONS[:stop]
|
|
62
|
+
Service.stop(SERVICE_NAME)
|
|
63
|
+
stopped = false
|
|
64
|
+
while stopped == false
|
|
65
|
+
s = Service.status(SERVICE_NAME)
|
|
66
|
+
stopped = true if s.current_state == "stopped"
|
|
67
|
+
break if stopped == true
|
|
68
|
+
puts "One moment, " + s.current_state
|
|
69
|
+
sleep 1
|
|
70
|
+
end
|
|
71
|
+
puts "#{SERVICE_DISPLAYNAME} service stopped"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Delete the service. Stop it first.
|
|
75
|
+
if OPTIONS[:delete] || OPTIONS[:uninstall]
|
|
76
|
+
begin
|
|
77
|
+
Service.stop(SERVICE_NAME)
|
|
78
|
+
rescue
|
|
79
|
+
end
|
|
80
|
+
begin
|
|
81
|
+
Service.delete(SERVICE_NAME)
|
|
82
|
+
rescue
|
|
83
|
+
end
|
|
84
|
+
puts "#{SERVICE_DISPLAYNAME} service deleted"
|
|
85
|
+
end
|
|
86
|
+
# END mongrel_rails_ctrl.rb
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# This script emualtes script/server behavior but running webrick http server
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
|
|
4
|
+
require 'mongrel'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
require 'zlib'
|
|
7
|
+
|
|
8
|
+
require 'win32/service'
|
|
9
|
+
|
|
10
|
+
DEBUG_LOG_FILE = File.expand_path(File.dirname(__FILE__) + '/debug.log')
|
|
11
|
+
|
|
12
|
+
class SimpleHandler < Mongrel::HttpHandler
|
|
13
|
+
def process(request, response)
|
|
14
|
+
response.start do |head,out|
|
|
15
|
+
head["Content-Type"] = "text/html"
|
|
16
|
+
results = "<html><body>Your request:<br /><pre>#{request.params.to_yaml}</pre><a href=\"/files\">View the files.</a></body></html>"
|
|
17
|
+
if request.params["HTTP_ACCEPT_ENCODING"] == "gzip,deflate"
|
|
18
|
+
head["Content-Encoding"] = "deflate"
|
|
19
|
+
# send it back deflated
|
|
20
|
+
out << Zlib::Deflate.deflate(results)
|
|
21
|
+
else
|
|
22
|
+
# no gzip supported, send it back normal
|
|
23
|
+
out << results
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class MongrelDaemon < Win32::Daemon
|
|
30
|
+
def initialize(options)
|
|
31
|
+
@options = options
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def service_init
|
|
35
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - service_init entered") }
|
|
36
|
+
|
|
37
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("Mongrel running on #{@options[:ip]}:#{@options[:port]} with docroot #{@options[:server_root]}") }
|
|
38
|
+
|
|
39
|
+
@simple = SimpleHandler.new
|
|
40
|
+
@files = Mongrel::DirHandler.new(@options[:server_root])
|
|
41
|
+
|
|
42
|
+
@http_server = Mongrel::HttpServer.new(@options[:ip], @options[:port])
|
|
43
|
+
@http_server.register("/", @simple)
|
|
44
|
+
@http_server.register("/files", @files)
|
|
45
|
+
|
|
46
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - service_init left") }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def service_stop
|
|
50
|
+
File.open(DEBUG_LOG_FILE,"a+"){ |f|
|
|
51
|
+
f.puts "stop signal received: " + Time.now.to_s
|
|
52
|
+
f.puts "sending stop to mongrel threads: " + Time.now.to_s
|
|
53
|
+
}
|
|
54
|
+
#@http_server.stop
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def service_pause
|
|
58
|
+
File.open(DEBUG_LOG_FILE,"a+"){ |f|
|
|
59
|
+
f.puts "pause signal received: " + Time.now.to_s
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def service_resume
|
|
64
|
+
File.open(DEBUG_LOG_FILE,"a+"){ |f|
|
|
65
|
+
f.puts "continue/resume signal received: " + Time.now.to_s
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def service_main
|
|
70
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - service_main entered") }
|
|
71
|
+
|
|
72
|
+
begin
|
|
73
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - http_server.run") }
|
|
74
|
+
@http_server.run
|
|
75
|
+
|
|
76
|
+
# No runner thread was needed after all!
|
|
77
|
+
#@runner = Thread.new do
|
|
78
|
+
# @http_server.acceptor.join
|
|
79
|
+
#end
|
|
80
|
+
#File.open("d:\\test.log","a+") { |f| f.puts("#{Time.now} - runner.run") }
|
|
81
|
+
#@runner.run
|
|
82
|
+
|
|
83
|
+
# here is where magic happens!
|
|
84
|
+
# if put blocking code here, the thread never left service_main, and the rb_func_call in service.c
|
|
85
|
+
# never exit, even if the stop signal is received.
|
|
86
|
+
#
|
|
87
|
+
# to probe my theory, just comment the while loop and remove the '1' from sleep function
|
|
88
|
+
# service start ok, but fail to stop.
|
|
89
|
+
#
|
|
90
|
+
# Even if no functional code is in service_main (because we have other working threads),
|
|
91
|
+
# we must monitor the state of the service to exit when the STOP event is received.
|
|
92
|
+
#
|
|
93
|
+
# Note: maybe not loop in 1 second intervals?
|
|
94
|
+
while state == RUNNING
|
|
95
|
+
sleep 1
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
rescue StandardError, Exception, interrupt => err
|
|
99
|
+
File.open(DEBUG_LOG_FILE,"a+"){ |f| f.puts("#{Time.now} - Error: #{err}") }
|
|
100
|
+
File.open(DEBUG_LOG_FILE,"a+"){ |f| f.puts("BACKTRACE: " + err.backtrace.join("\n")) }
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - service_main left") }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
OPTIONS = {
|
|
110
|
+
:port => 3000,
|
|
111
|
+
:ip => "0.0.0.0",
|
|
112
|
+
:server_root => File.expand_path(File.dirname(__FILE__)),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
web_server = MongrelDaemon.new(OPTIONS)
|
|
116
|
+
web_server.mainloop
|
data/examples/simpletest.rb
CHANGED
|
@@ -24,11 +24,13 @@ if ARGV.length != 3
|
|
|
24
24
|
exit(1)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
h = Mongrel::HttpServer.new(ARGV[0], ARGV[1])
|
|
27
|
+
h = Mongrel::HttpServer.new(ARGV[0], ARGV[1].to_i)
|
|
28
28
|
h.register("/", SimpleHandler.new)
|
|
29
29
|
h.register("/files", Mongrel::DirHandler.new(ARGV[2]))
|
|
30
30
|
h.run
|
|
31
31
|
|
|
32
|
+
trap("INT") { h.stop }
|
|
33
|
+
|
|
32
34
|
puts "Mongrel running on #{ARGV[0]}:#{ARGV[1]} with docroot #{ARGV[2]}"
|
|
33
35
|
|
|
34
36
|
h.acceptor.join
|
data/ext/http11/http11_parser.c
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
#line 18 "ext/http11/http11_parser.c"
|
|
18
18
|
static int http_parser_start = 0;
|
|
19
19
|
|
|
20
|
-
static int http_parser_first_final =
|
|
20
|
+
static int http_parser_first_final = 53;
|
|
21
21
|
|
|
22
22
|
static int http_parser_error = 1;
|
|
23
23
|
|
|
@@ -162,7 +162,7 @@ tr34:
|
|
|
162
162
|
parser->request_uri(parser->data, parser->mark, p - parser->mark);
|
|
163
163
|
}
|
|
164
164
|
goto st10;
|
|
165
|
-
|
|
165
|
+
tr46:
|
|
166
166
|
#line 37 "ext/http11/http11_parser.rl"
|
|
167
167
|
{
|
|
168
168
|
if(parser->query_string != NULL)
|
|
@@ -249,11 +249,21 @@ tr37:
|
|
|
249
249
|
parser->http_version(parser->data, parser->mark, p - parser->mark);
|
|
250
250
|
}
|
|
251
251
|
goto st19;
|
|
252
|
+
tr49:
|
|
253
|
+
#line 22 "ext/http11/http11_parser.rl"
|
|
254
|
+
{
|
|
255
|
+
if(parser->http_field != NULL) {
|
|
256
|
+
parser->http_field(parser->data,
|
|
257
|
+
parser->field_start, parser->field_len,
|
|
258
|
+
parser->mark+1, p - (parser->mark +1));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
goto st19;
|
|
252
262
|
st19:
|
|
253
263
|
if ( ++p == pe )
|
|
254
264
|
goto _out19;
|
|
255
265
|
case 19:
|
|
256
|
-
#line
|
|
266
|
+
#line 267 "ext/http11/http11_parser.c"
|
|
257
267
|
if ( (*p) == 10 )
|
|
258
268
|
goto st20;
|
|
259
269
|
goto st1;
|
|
@@ -295,14 +305,14 @@ case 21:
|
|
|
295
305
|
tr40:
|
|
296
306
|
#line 46 "ext/http11/http11_parser.rl"
|
|
297
307
|
{
|
|
298
|
-
parser->body_start = p+1; goto
|
|
308
|
+
parser->body_start = p+1; goto _out53;
|
|
299
309
|
}
|
|
300
|
-
goto
|
|
301
|
-
|
|
310
|
+
goto st53;
|
|
311
|
+
st53:
|
|
302
312
|
if ( ++p == pe )
|
|
303
|
-
goto
|
|
304
|
-
case
|
|
305
|
-
#line
|
|
313
|
+
goto _out53;
|
|
314
|
+
case 53:
|
|
315
|
+
#line 316 "ext/http11/http11_parser.c"
|
|
306
316
|
goto st1;
|
|
307
317
|
tr36:
|
|
308
318
|
#line 16 "ext/http11/http11_parser.rl"
|
|
@@ -312,7 +322,7 @@ st22:
|
|
|
312
322
|
if ( ++p == pe )
|
|
313
323
|
goto _out22;
|
|
314
324
|
case 22:
|
|
315
|
-
#line
|
|
325
|
+
#line 326 "ext/http11/http11_parser.c"
|
|
316
326
|
switch( (*p) ) {
|
|
317
327
|
case 33: goto st22;
|
|
318
328
|
case 58: goto tr32;
|
|
@@ -347,11 +357,11 @@ st23:
|
|
|
347
357
|
if ( ++p == pe )
|
|
348
358
|
goto _out23;
|
|
349
359
|
case 23:
|
|
350
|
-
#line
|
|
360
|
+
#line 361 "ext/http11/http11_parser.c"
|
|
351
361
|
if ( (*p) == 13 )
|
|
352
|
-
goto
|
|
353
|
-
goto
|
|
354
|
-
|
|
362
|
+
goto tr49;
|
|
363
|
+
goto tr52;
|
|
364
|
+
tr52:
|
|
355
365
|
#line 21 "ext/http11/http11_parser.rl"
|
|
356
366
|
{ MARK(parser, p); }
|
|
357
367
|
goto st24;
|
|
@@ -359,141 +369,47 @@ st24:
|
|
|
359
369
|
if ( ++p == pe )
|
|
360
370
|
goto _out24;
|
|
361
371
|
case 24:
|
|
362
|
-
#line
|
|
372
|
+
#line 373 "ext/http11/http11_parser.c"
|
|
363
373
|
if ( (*p) == 13 )
|
|
364
|
-
goto
|
|
374
|
+
goto tr49;
|
|
365
375
|
goto st24;
|
|
366
|
-
|
|
367
|
-
#line
|
|
368
|
-
{
|
|
369
|
-
if(parser->http_field != NULL) {
|
|
370
|
-
parser->http_field(parser->data,
|
|
371
|
-
parser->field_start, parser->field_len,
|
|
372
|
-
parser->mark+1, p - (parser->mark +1));
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
goto st25;
|
|
376
|
-
tr56:
|
|
377
|
-
#line 21 "ext/http11/http11_parser.rl"
|
|
376
|
+
tr28:
|
|
377
|
+
#line 14 "ext/http11/http11_parser.rl"
|
|
378
378
|
{ MARK(parser, p); }
|
|
379
|
-
#line 22 "ext/http11/http11_parser.rl"
|
|
380
|
-
{
|
|
381
|
-
if(parser->http_field != NULL) {
|
|
382
|
-
parser->http_field(parser->data,
|
|
383
|
-
parser->field_start, parser->field_len,
|
|
384
|
-
parser->mark+1, p - (parser->mark +1));
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
379
|
goto st25;
|
|
388
380
|
st25:
|
|
389
381
|
if ( ++p == pe )
|
|
390
382
|
goto _out25;
|
|
391
383
|
case 25:
|
|
392
|
-
#line
|
|
393
|
-
switch( (*p) ) {
|
|
394
|
-
case 10: goto st26;
|
|
395
|
-
case 13: goto tr51;
|
|
396
|
-
}
|
|
397
|
-
goto st24;
|
|
398
|
-
st26:
|
|
399
|
-
if ( ++p == pe )
|
|
400
|
-
goto _out26;
|
|
401
|
-
case 26:
|
|
384
|
+
#line 385 "ext/http11/http11_parser.c"
|
|
402
385
|
switch( (*p) ) {
|
|
403
|
-
case
|
|
404
|
-
case
|
|
405
|
-
case 124: goto tr42;
|
|
406
|
-
case 126: goto tr42;
|
|
407
|
-
}
|
|
408
|
-
if ( (*p) < 45 ) {
|
|
409
|
-
if ( (*p) > 39 ) {
|
|
410
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
|
411
|
-
goto tr42;
|
|
412
|
-
} else if ( (*p) >= 35 )
|
|
413
|
-
goto tr42;
|
|
414
|
-
} else if ( (*p) > 46 ) {
|
|
415
|
-
if ( (*p) < 65 ) {
|
|
416
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
|
417
|
-
goto tr42;
|
|
418
|
-
} else if ( (*p) > 90 ) {
|
|
419
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
|
420
|
-
goto tr42;
|
|
421
|
-
} else
|
|
422
|
-
goto tr42;
|
|
423
|
-
} else
|
|
424
|
-
goto tr42;
|
|
425
|
-
goto st24;
|
|
426
|
-
tr42:
|
|
427
|
-
#line 16 "ext/http11/http11_parser.rl"
|
|
428
|
-
{ parser->field_start = p; }
|
|
429
|
-
goto st27;
|
|
430
|
-
st27:
|
|
431
|
-
if ( ++p == pe )
|
|
432
|
-
goto _out27;
|
|
433
|
-
case 27:
|
|
434
|
-
#line 435 "ext/http11/http11_parser.c"
|
|
435
|
-
switch( (*p) ) {
|
|
436
|
-
case 13: goto tr51;
|
|
437
|
-
case 33: goto st27;
|
|
438
|
-
case 58: goto tr32;
|
|
439
|
-
case 124: goto st27;
|
|
440
|
-
case 126: goto st27;
|
|
441
|
-
}
|
|
442
|
-
if ( (*p) < 45 ) {
|
|
443
|
-
if ( (*p) > 39 ) {
|
|
444
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
|
445
|
-
goto st27;
|
|
446
|
-
} else if ( (*p) >= 35 )
|
|
447
|
-
goto st27;
|
|
448
|
-
} else if ( (*p) > 46 ) {
|
|
449
|
-
if ( (*p) < 65 ) {
|
|
450
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
|
451
|
-
goto st27;
|
|
452
|
-
} else if ( (*p) > 90 ) {
|
|
453
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
|
454
|
-
goto st27;
|
|
455
|
-
} else
|
|
456
|
-
goto st27;
|
|
457
|
-
} else
|
|
458
|
-
goto st27;
|
|
459
|
-
goto st24;
|
|
460
|
-
tr28:
|
|
461
|
-
#line 14 "ext/http11/http11_parser.rl"
|
|
462
|
-
{ MARK(parser, p); }
|
|
463
|
-
goto st28;
|
|
464
|
-
st28:
|
|
465
|
-
if ( ++p == pe )
|
|
466
|
-
goto _out28;
|
|
467
|
-
case 28:
|
|
468
|
-
#line 469 "ext/http11/http11_parser.c"
|
|
469
|
-
switch( (*p) ) {
|
|
470
|
-
case 43: goto st28;
|
|
471
|
-
case 58: goto st29;
|
|
386
|
+
case 43: goto st25;
|
|
387
|
+
case 58: goto st26;
|
|
472
388
|
}
|
|
473
389
|
if ( (*p) < 48 ) {
|
|
474
390
|
if ( 45 <= (*p) && (*p) <= 46 )
|
|
475
|
-
goto
|
|
391
|
+
goto st25;
|
|
476
392
|
} else if ( (*p) > 57 ) {
|
|
477
393
|
if ( (*p) > 90 ) {
|
|
478
394
|
if ( 97 <= (*p) && (*p) <= 122 )
|
|
479
|
-
goto
|
|
395
|
+
goto st25;
|
|
480
396
|
} else if ( (*p) >= 65 )
|
|
481
|
-
goto
|
|
397
|
+
goto st25;
|
|
482
398
|
} else
|
|
483
|
-
goto
|
|
399
|
+
goto st25;
|
|
484
400
|
goto st1;
|
|
485
401
|
tr30:
|
|
486
402
|
#line 14 "ext/http11/http11_parser.rl"
|
|
487
403
|
{ MARK(parser, p); }
|
|
488
|
-
goto
|
|
489
|
-
|
|
404
|
+
goto st26;
|
|
405
|
+
st26:
|
|
490
406
|
if ( ++p == pe )
|
|
491
|
-
goto
|
|
492
|
-
case
|
|
493
|
-
#line
|
|
407
|
+
goto _out26;
|
|
408
|
+
case 26:
|
|
409
|
+
#line 410 "ext/http11/http11_parser.c"
|
|
494
410
|
switch( (*p) ) {
|
|
495
411
|
case 32: goto tr34;
|
|
496
|
-
case 37: goto
|
|
412
|
+
case 37: goto st27;
|
|
497
413
|
case 60: goto st1;
|
|
498
414
|
case 62: goto st1;
|
|
499
415
|
case 127: goto st1;
|
|
@@ -503,49 +419,49 @@ case 29:
|
|
|
503
419
|
goto st1;
|
|
504
420
|
} else if ( (*p) >= 0 )
|
|
505
421
|
goto st1;
|
|
506
|
-
goto
|
|
507
|
-
|
|
422
|
+
goto st26;
|
|
423
|
+
st27:
|
|
508
424
|
if ( ++p == pe )
|
|
509
|
-
goto
|
|
510
|
-
case
|
|
425
|
+
goto _out27;
|
|
426
|
+
case 27:
|
|
511
427
|
if ( (*p) < 65 ) {
|
|
512
428
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
513
|
-
goto
|
|
429
|
+
goto st28;
|
|
514
430
|
} else if ( (*p) > 70 ) {
|
|
515
431
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
516
|
-
goto
|
|
432
|
+
goto st28;
|
|
517
433
|
} else
|
|
518
|
-
goto
|
|
434
|
+
goto st28;
|
|
519
435
|
goto st1;
|
|
520
|
-
|
|
436
|
+
st28:
|
|
521
437
|
if ( ++p == pe )
|
|
522
|
-
goto
|
|
523
|
-
case
|
|
438
|
+
goto _out28;
|
|
439
|
+
case 28:
|
|
524
440
|
if ( (*p) < 65 ) {
|
|
525
441
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
526
|
-
goto
|
|
442
|
+
goto st26;
|
|
527
443
|
} else if ( (*p) > 70 ) {
|
|
528
444
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
529
|
-
goto
|
|
445
|
+
goto st26;
|
|
530
446
|
} else
|
|
531
|
-
goto
|
|
447
|
+
goto st26;
|
|
532
448
|
goto st1;
|
|
533
449
|
tr29:
|
|
534
450
|
#line 14 "ext/http11/http11_parser.rl"
|
|
535
451
|
{ MARK(parser, p); }
|
|
536
|
-
goto
|
|
537
|
-
|
|
452
|
+
goto st29;
|
|
453
|
+
st29:
|
|
538
454
|
if ( ++p == pe )
|
|
539
|
-
goto
|
|
540
|
-
case
|
|
541
|
-
#line
|
|
455
|
+
goto _out29;
|
|
456
|
+
case 29:
|
|
457
|
+
#line 458 "ext/http11/http11_parser.c"
|
|
542
458
|
switch( (*p) ) {
|
|
543
459
|
case 32: goto tr34;
|
|
544
|
-
case 37: goto
|
|
460
|
+
case 37: goto st31;
|
|
545
461
|
case 47: goto st1;
|
|
546
462
|
case 60: goto st1;
|
|
547
463
|
case 62: goto st1;
|
|
548
|
-
case 63: goto
|
|
464
|
+
case 63: goto tr44;
|
|
549
465
|
case 127: goto st1;
|
|
550
466
|
}
|
|
551
467
|
if ( (*p) > 31 ) {
|
|
@@ -553,17 +469,17 @@ case 32:
|
|
|
553
469
|
goto st1;
|
|
554
470
|
} else if ( (*p) >= 0 )
|
|
555
471
|
goto st1;
|
|
556
|
-
goto
|
|
557
|
-
|
|
472
|
+
goto st30;
|
|
473
|
+
st30:
|
|
558
474
|
if ( ++p == pe )
|
|
559
|
-
goto
|
|
560
|
-
case
|
|
475
|
+
goto _out30;
|
|
476
|
+
case 30:
|
|
561
477
|
switch( (*p) ) {
|
|
562
478
|
case 32: goto tr34;
|
|
563
|
-
case 37: goto
|
|
479
|
+
case 37: goto st31;
|
|
564
480
|
case 60: goto st1;
|
|
565
481
|
case 62: goto st1;
|
|
566
|
-
case 63: goto
|
|
482
|
+
case 63: goto tr44;
|
|
567
483
|
case 127: goto st1;
|
|
568
484
|
}
|
|
569
485
|
if ( (*p) > 31 ) {
|
|
@@ -571,48 +487,48 @@ case 33:
|
|
|
571
487
|
goto st1;
|
|
572
488
|
} else if ( (*p) >= 0 )
|
|
573
489
|
goto st1;
|
|
574
|
-
goto
|
|
575
|
-
|
|
490
|
+
goto st30;
|
|
491
|
+
st31:
|
|
576
492
|
if ( ++p == pe )
|
|
577
|
-
goto
|
|
578
|
-
case
|
|
493
|
+
goto _out31;
|
|
494
|
+
case 31:
|
|
579
495
|
if ( (*p) < 65 ) {
|
|
580
496
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
581
|
-
goto
|
|
497
|
+
goto st32;
|
|
582
498
|
} else if ( (*p) > 70 ) {
|
|
583
499
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
584
|
-
goto
|
|
500
|
+
goto st32;
|
|
585
501
|
} else
|
|
586
|
-
goto
|
|
502
|
+
goto st32;
|
|
587
503
|
goto st1;
|
|
588
|
-
|
|
504
|
+
st32:
|
|
589
505
|
if ( ++p == pe )
|
|
590
|
-
goto
|
|
591
|
-
case
|
|
506
|
+
goto _out32;
|
|
507
|
+
case 32:
|
|
592
508
|
if ( (*p) < 65 ) {
|
|
593
509
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
594
|
-
goto
|
|
510
|
+
goto st30;
|
|
595
511
|
} else if ( (*p) > 70 ) {
|
|
596
512
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
597
|
-
goto
|
|
513
|
+
goto st30;
|
|
598
514
|
} else
|
|
599
|
-
goto
|
|
515
|
+
goto st30;
|
|
600
516
|
goto st1;
|
|
601
|
-
|
|
517
|
+
tr44:
|
|
602
518
|
#line 33 "ext/http11/http11_parser.rl"
|
|
603
519
|
{
|
|
604
520
|
if(parser->request_uri != NULL)
|
|
605
521
|
parser->request_uri(parser->data, parser->mark, p - parser->mark);
|
|
606
522
|
}
|
|
607
|
-
goto
|
|
608
|
-
|
|
523
|
+
goto st33;
|
|
524
|
+
st33:
|
|
609
525
|
if ( ++p == pe )
|
|
610
|
-
goto
|
|
611
|
-
case
|
|
612
|
-
#line
|
|
526
|
+
goto _out33;
|
|
527
|
+
case 33:
|
|
528
|
+
#line 529 "ext/http11/http11_parser.c"
|
|
613
529
|
switch( (*p) ) {
|
|
614
|
-
case 32: goto
|
|
615
|
-
case 37: goto
|
|
530
|
+
case 32: goto tr46;
|
|
531
|
+
case 37: goto tr51;
|
|
616
532
|
case 60: goto st1;
|
|
617
533
|
case 62: goto st1;
|
|
618
534
|
case 127: goto st1;
|
|
@@ -622,19 +538,19 @@ case 36:
|
|
|
622
538
|
goto st1;
|
|
623
539
|
} else if ( (*p) >= 0 )
|
|
624
540
|
goto st1;
|
|
625
|
-
goto
|
|
626
|
-
|
|
541
|
+
goto tr50;
|
|
542
|
+
tr50:
|
|
627
543
|
#line 14 "ext/http11/http11_parser.rl"
|
|
628
544
|
{ MARK(parser, p); }
|
|
629
|
-
goto
|
|
630
|
-
|
|
545
|
+
goto st34;
|
|
546
|
+
st34:
|
|
631
547
|
if ( ++p == pe )
|
|
632
|
-
goto
|
|
633
|
-
case
|
|
634
|
-
#line
|
|
548
|
+
goto _out34;
|
|
549
|
+
case 34:
|
|
550
|
+
#line 551 "ext/http11/http11_parser.c"
|
|
635
551
|
switch( (*p) ) {
|
|
636
|
-
case 32: goto
|
|
637
|
-
case 37: goto
|
|
552
|
+
case 32: goto tr46;
|
|
553
|
+
case 37: goto st35;
|
|
638
554
|
case 60: goto st1;
|
|
639
555
|
case 62: goto st1;
|
|
640
556
|
case 127: goto st1;
|
|
@@ -644,58 +560,84 @@ case 37:
|
|
|
644
560
|
goto st1;
|
|
645
561
|
} else if ( (*p) >= 0 )
|
|
646
562
|
goto st1;
|
|
647
|
-
goto
|
|
648
|
-
|
|
563
|
+
goto st34;
|
|
564
|
+
tr51:
|
|
649
565
|
#line 14 "ext/http11/http11_parser.rl"
|
|
650
566
|
{ MARK(parser, p); }
|
|
651
|
-
goto
|
|
652
|
-
|
|
567
|
+
goto st35;
|
|
568
|
+
st35:
|
|
653
569
|
if ( ++p == pe )
|
|
654
|
-
goto
|
|
655
|
-
case
|
|
656
|
-
#line
|
|
570
|
+
goto _out35;
|
|
571
|
+
case 35:
|
|
572
|
+
#line 573 "ext/http11/http11_parser.c"
|
|
657
573
|
if ( (*p) < 65 ) {
|
|
658
574
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
659
|
-
goto
|
|
575
|
+
goto st36;
|
|
660
576
|
} else if ( (*p) > 70 ) {
|
|
661
577
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
662
|
-
goto
|
|
578
|
+
goto st36;
|
|
663
579
|
} else
|
|
664
|
-
goto
|
|
580
|
+
goto st36;
|
|
665
581
|
goto st1;
|
|
666
|
-
|
|
582
|
+
st36:
|
|
667
583
|
if ( ++p == pe )
|
|
668
|
-
goto
|
|
669
|
-
case
|
|
584
|
+
goto _out36;
|
|
585
|
+
case 36:
|
|
670
586
|
if ( (*p) < 65 ) {
|
|
671
587
|
if ( 48 <= (*p) && (*p) <= 57 )
|
|
672
|
-
goto
|
|
588
|
+
goto st34;
|
|
673
589
|
} else if ( (*p) > 70 ) {
|
|
674
590
|
if ( 97 <= (*p) && (*p) <= 102 )
|
|
675
|
-
goto
|
|
591
|
+
goto st34;
|
|
676
592
|
} else
|
|
677
|
-
goto
|
|
593
|
+
goto st34;
|
|
678
594
|
goto st1;
|
|
679
595
|
tr14:
|
|
680
596
|
#line 14 "ext/http11/http11_parser.rl"
|
|
681
597
|
{ MARK(parser, p); }
|
|
682
|
-
goto
|
|
598
|
+
goto st37;
|
|
599
|
+
st37:
|
|
600
|
+
if ( ++p == pe )
|
|
601
|
+
goto _out37;
|
|
602
|
+
case 37:
|
|
603
|
+
#line 604 "ext/http11/http11_parser.c"
|
|
604
|
+
if ( (*p) == 69 )
|
|
605
|
+
goto st38;
|
|
606
|
+
goto st1;
|
|
607
|
+
st38:
|
|
608
|
+
if ( ++p == pe )
|
|
609
|
+
goto _out38;
|
|
610
|
+
case 38:
|
|
611
|
+
if ( (*p) == 84 )
|
|
612
|
+
goto st7;
|
|
613
|
+
goto st1;
|
|
614
|
+
tr15:
|
|
615
|
+
#line 14 "ext/http11/http11_parser.rl"
|
|
616
|
+
{ MARK(parser, p); }
|
|
617
|
+
goto st39;
|
|
618
|
+
st39:
|
|
619
|
+
if ( ++p == pe )
|
|
620
|
+
goto _out39;
|
|
621
|
+
case 39:
|
|
622
|
+
#line 623 "ext/http11/http11_parser.c"
|
|
623
|
+
if ( (*p) == 69 )
|
|
624
|
+
goto st40;
|
|
625
|
+
goto st1;
|
|
683
626
|
st40:
|
|
684
627
|
if ( ++p == pe )
|
|
685
628
|
goto _out40;
|
|
686
629
|
case 40:
|
|
687
|
-
|
|
688
|
-
if ( (*p) == 69 )
|
|
630
|
+
if ( (*p) == 65 )
|
|
689
631
|
goto st41;
|
|
690
632
|
goto st1;
|
|
691
633
|
st41:
|
|
692
634
|
if ( ++p == pe )
|
|
693
635
|
goto _out41;
|
|
694
636
|
case 41:
|
|
695
|
-
if ( (*p) ==
|
|
637
|
+
if ( (*p) == 68 )
|
|
696
638
|
goto st7;
|
|
697
639
|
goto st1;
|
|
698
|
-
|
|
640
|
+
tr16:
|
|
699
641
|
#line 14 "ext/http11/http11_parser.rl"
|
|
700
642
|
{ MARK(parser, p); }
|
|
701
643
|
goto st42;
|
|
@@ -703,115 +645,89 @@ st42:
|
|
|
703
645
|
if ( ++p == pe )
|
|
704
646
|
goto _out42;
|
|
705
647
|
case 42:
|
|
706
|
-
#line
|
|
707
|
-
if ( (*p) ==
|
|
648
|
+
#line 649 "ext/http11/http11_parser.c"
|
|
649
|
+
if ( (*p) == 80 )
|
|
708
650
|
goto st43;
|
|
709
651
|
goto st1;
|
|
710
652
|
st43:
|
|
711
653
|
if ( ++p == pe )
|
|
712
654
|
goto _out43;
|
|
713
655
|
case 43:
|
|
714
|
-
if ( (*p) ==
|
|
656
|
+
if ( (*p) == 84 )
|
|
715
657
|
goto st44;
|
|
716
658
|
goto st1;
|
|
717
659
|
st44:
|
|
718
660
|
if ( ++p == pe )
|
|
719
661
|
goto _out44;
|
|
720
662
|
case 44:
|
|
721
|
-
if ( (*p) ==
|
|
722
|
-
goto
|
|
663
|
+
if ( (*p) == 73 )
|
|
664
|
+
goto st45;
|
|
723
665
|
goto st1;
|
|
724
|
-
tr16:
|
|
725
|
-
#line 14 "ext/http11/http11_parser.rl"
|
|
726
|
-
{ MARK(parser, p); }
|
|
727
|
-
goto st45;
|
|
728
666
|
st45:
|
|
729
667
|
if ( ++p == pe )
|
|
730
668
|
goto _out45;
|
|
731
669
|
case 45:
|
|
732
|
-
|
|
733
|
-
if ( (*p) == 80 )
|
|
670
|
+
if ( (*p) == 79 )
|
|
734
671
|
goto st46;
|
|
735
672
|
goto st1;
|
|
736
673
|
st46:
|
|
737
674
|
if ( ++p == pe )
|
|
738
675
|
goto _out46;
|
|
739
676
|
case 46:
|
|
740
|
-
if ( (*p) ==
|
|
677
|
+
if ( (*p) == 78 )
|
|
741
678
|
goto st47;
|
|
742
679
|
goto st1;
|
|
743
680
|
st47:
|
|
744
681
|
if ( ++p == pe )
|
|
745
682
|
goto _out47;
|
|
746
683
|
case 47:
|
|
747
|
-
if ( (*p) ==
|
|
748
|
-
goto
|
|
684
|
+
if ( (*p) == 83 )
|
|
685
|
+
goto st7;
|
|
749
686
|
goto st1;
|
|
687
|
+
tr17:
|
|
688
|
+
#line 14 "ext/http11/http11_parser.rl"
|
|
689
|
+
{ MARK(parser, p); }
|
|
690
|
+
goto st48;
|
|
750
691
|
st48:
|
|
751
692
|
if ( ++p == pe )
|
|
752
693
|
goto _out48;
|
|
753
694
|
case 48:
|
|
754
|
-
|
|
755
|
-
|
|
695
|
+
#line 696 "ext/http11/http11_parser.c"
|
|
696
|
+
switch( (*p) ) {
|
|
697
|
+
case 79: goto st49;
|
|
698
|
+
case 85: goto st38;
|
|
699
|
+
}
|
|
756
700
|
goto st1;
|
|
757
701
|
st49:
|
|
758
702
|
if ( ++p == pe )
|
|
759
703
|
goto _out49;
|
|
760
704
|
case 49:
|
|
761
|
-
if ( (*p) ==
|
|
762
|
-
goto
|
|
705
|
+
if ( (*p) == 83 )
|
|
706
|
+
goto st38;
|
|
763
707
|
goto st1;
|
|
708
|
+
tr18:
|
|
709
|
+
#line 14 "ext/http11/http11_parser.rl"
|
|
710
|
+
{ MARK(parser, p); }
|
|
711
|
+
goto st50;
|
|
764
712
|
st50:
|
|
765
713
|
if ( ++p == pe )
|
|
766
714
|
goto _out50;
|
|
767
715
|
case 50:
|
|
768
|
-
|
|
769
|
-
|
|
716
|
+
#line 717 "ext/http11/http11_parser.c"
|
|
717
|
+
if ( (*p) == 82 )
|
|
718
|
+
goto st51;
|
|
770
719
|
goto st1;
|
|
771
|
-
tr17:
|
|
772
|
-
#line 14 "ext/http11/http11_parser.rl"
|
|
773
|
-
{ MARK(parser, p); }
|
|
774
|
-
goto st51;
|
|
775
720
|
st51:
|
|
776
721
|
if ( ++p == pe )
|
|
777
722
|
goto _out51;
|
|
778
723
|
case 51:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
case 79: goto st52;
|
|
782
|
-
case 85: goto st41;
|
|
783
|
-
}
|
|
724
|
+
if ( (*p) == 65 )
|
|
725
|
+
goto st52;
|
|
784
726
|
goto st1;
|
|
785
727
|
st52:
|
|
786
728
|
if ( ++p == pe )
|
|
787
729
|
goto _out52;
|
|
788
730
|
case 52:
|
|
789
|
-
if ( (*p) == 83 )
|
|
790
|
-
goto st41;
|
|
791
|
-
goto st1;
|
|
792
|
-
tr18:
|
|
793
|
-
#line 14 "ext/http11/http11_parser.rl"
|
|
794
|
-
{ MARK(parser, p); }
|
|
795
|
-
goto st53;
|
|
796
|
-
st53:
|
|
797
|
-
if ( ++p == pe )
|
|
798
|
-
goto _out53;
|
|
799
|
-
case 53:
|
|
800
|
-
#line 801 "ext/http11/http11_parser.c"
|
|
801
|
-
if ( (*p) == 82 )
|
|
802
|
-
goto st54;
|
|
803
|
-
goto st1;
|
|
804
|
-
st54:
|
|
805
|
-
if ( ++p == pe )
|
|
806
|
-
goto _out54;
|
|
807
|
-
case 54:
|
|
808
|
-
if ( (*p) == 65 )
|
|
809
|
-
goto st55;
|
|
810
|
-
goto st1;
|
|
811
|
-
st55:
|
|
812
|
-
if ( ++p == pe )
|
|
813
|
-
goto _out55;
|
|
814
|
-
case 55:
|
|
815
731
|
if ( (*p) == 67 )
|
|
816
732
|
goto st6;
|
|
817
733
|
goto st1;
|
|
@@ -837,7 +753,7 @@ case 55:
|
|
|
837
753
|
_out19: cs = 19; goto _out;
|
|
838
754
|
_out20: cs = 20; goto _out;
|
|
839
755
|
_out21: cs = 21; goto _out;
|
|
840
|
-
|
|
756
|
+
_out53: cs = 53; goto _out;
|
|
841
757
|
_out22: cs = 22; goto _out;
|
|
842
758
|
_out23: cs = 23; goto _out;
|
|
843
759
|
_out24: cs = 24; goto _out;
|
|
@@ -869,9 +785,6 @@ case 55:
|
|
|
869
785
|
_out50: cs = 50; goto _out;
|
|
870
786
|
_out51: cs = 51; goto _out;
|
|
871
787
|
_out52: cs = 52; goto _out;
|
|
872
|
-
_out53: cs = 53; goto _out;
|
|
873
|
-
_out54: cs = 54; goto _out;
|
|
874
|
-
_out55: cs = 55; goto _out;
|
|
875
788
|
|
|
876
789
|
_out: {}
|
|
877
790
|
}
|
|
@@ -882,7 +795,7 @@ case 55:
|
|
|
882
795
|
if(parser->body_start) {
|
|
883
796
|
/* final \r\n combo encountered so stop right here */
|
|
884
797
|
|
|
885
|
-
#line
|
|
798
|
+
#line 799 "ext/http11/http11_parser.c"
|
|
886
799
|
#line 131 "ext/http11/http11_parser.rl"
|
|
887
800
|
parser->nread++;
|
|
888
801
|
}
|
|
@@ -895,7 +808,7 @@ int http_parser_finish(http_parser *parser)
|
|
|
895
808
|
int cs = parser->cs;
|
|
896
809
|
|
|
897
810
|
|
|
898
|
-
#line
|
|
811
|
+
#line 812 "ext/http11/http11_parser.c"
|
|
899
812
|
#line 142 "ext/http11/http11_parser.rl"
|
|
900
813
|
|
|
901
814
|
parser->cs = cs;
|