mongrel 0.3.13.3 → 0.3.13.4
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/Rakefile +5 -4
- data/bin/mongrel_rails +162 -169
- data/doc/rdoc/classes/IO.src/M000001.html +5 -5
- data/doc/rdoc/classes/IO.src/M000002.html +5 -5
- data/doc/rdoc/classes/Kernel.html +10 -10
- data/doc/rdoc/classes/Kernel.src/M000010.html +19 -0
- data/doc/rdoc/classes/Kernel.src/M000011.html +23 -0
- data/doc/rdoc/classes/Mongrel.html +27 -10
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +67 -54
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000101.html → M000112.html} +11 -10
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000102.html → M000113.html} +31 -31
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000103.html → M000114.html} +20 -20
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000115.html +32 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000105.html → M000116.html} +11 -11
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000106.html → M000117.html} +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000107.html → M000118.html} +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000108.html → M000119.html} +4 -4
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000109.html → M000120.html} +5 -5
- data/doc/rdoc/classes/Mongrel/Camping.html +5 -5
- data/doc/rdoc/classes/Mongrel/Camping.src/{M000048.html → M000039.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/{M000049.html → M000040.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/{M000050.html → M000041.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +65 -65
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000016.html +24 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000017.html +42 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000018.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000029.html → M000019.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000030.html → M000020.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000031.html → M000021.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000032.html → M000022.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000033.html → M000023.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000034.html → M000024.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/{M000035.html → M000025.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000026.html +11 -11
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000027.html +11 -29
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000028.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +15 -15
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000039.html → M000029.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000040.html → M000030.html} +10 -6
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000031.html +58 -0
- data/doc/rdoc/classes/Mongrel/Configurator.html +115 -115
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000091.html +27 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000092.html +31 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000093.html +21 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000094.html +20 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000095.html +23 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000115.html → M000096.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000116.html → M000097.html} +24 -24
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000117.html → M000098.html} +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +39 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000119.html → M000100.html} +19 -19
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000120.html → M000101.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000121.html → M000102.html} +10 -10
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000122.html → M000103.html} +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000123.html → M000104.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000124.html → M000105.html} +8 -8
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +22 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/{M000126.html → M000107.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +34 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +23 -14
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +5 -18
- data/doc/rdoc/classes/Mongrel/Const.html +11 -6
- data/doc/rdoc/classes/Mongrel/DeflateFilter.html +10 -10
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000099.html → M000121.html} +5 -5
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000100.html → M000122.html} +14 -14
- data/doc/rdoc/classes/Mongrel/DirHandler.html +31 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000058.html → M000049.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000059.html → M000050.html} +0 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000060.html → M000051.html} +12 -16
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000052.html +63 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000062.html → M000053.html} +25 -25
- data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000063.html → M000054.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000131.html → M000123.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000132.html → M000124.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000072.html → M000064.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000073.html → M000065.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +15 -15
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000078.html → M000070.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000079.html → M000071.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000080.html → M000072.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +20 -20
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/{M000022.html → M000012.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/{M000023.html → M000013.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/{M000024.html → M000014.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/{M000025.html → M000015.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpParams.html +131 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000051.html → M000042.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000052.html → M000043.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000053.html → M000044.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000054.html → M000045.html} +3 -3
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000055.html → M000046.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000056.html → M000047.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000057.html → M000048.html} +1 -1
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +63 -24
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000130.html +47 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000131.html +37 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000132.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000139.html → M000133.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000140.html → M000134.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000141.html → M000135.html} +18 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +66 -72
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000073.html +25 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000074.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +26 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000085.html → M000077.html} +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000086.html → M000078.html} +8 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +31 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000088.html → M000080.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +7 -12
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +7 -12
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000084.html +5 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.html +58 -43
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000064.html → M000055.html} +11 -11
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000065.html → M000056.html} +76 -72
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000066.html → M000057.html} +18 -17
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000067.html → M000058.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000059.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000060.html +62 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000069.html → M000061.html} +20 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000070.html → M000062.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000071.html → M000063.html} +8 -8
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +15 -15
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/{M000042.html → M000032.html} +23 -25
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/{M000043.html → M000033.html} +11 -11
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/{M000044.html → M000034.html} +12 -12
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +30 -15
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/{M000045.html → M000035.html} +9 -8
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000036.html +54 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000037.html +21 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000038.html +25 -0
- data/doc/rdoc/classes/Mongrel/RedirectHandler.html +10 -10
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000136.html → M000128.html} +8 -8
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000137.html → M000129.html} +13 -13
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.html +16 -16
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000125.html +24 -0
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000134.html → M000126.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000135.html → M000127.html} +4 -4
- data/doc/rdoc/classes/{Stats.html → Mongrel/Stats.html} +44 -60
- data/doc/rdoc/classes/Mongrel/Stats.src/M000136.html +19 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000137.html +23 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000138.html +26 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000139.html +18 -0
- data/doc/rdoc/classes/{Stats.src/M000009.html → Mongrel/Stats.src/M000140.html} +6 -6
- data/doc/rdoc/classes/Mongrel/Stats.src/M000141.html +18 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000142.html +23 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000143.html +20 -0
- data/doc/rdoc/classes/Mongrel/StatusHandler.html +20 -20
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/{M000074.html → M000066.html} +4 -4
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/{M000075.html → M000067.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/{M000076.html → M000068.html} +28 -28
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/{M000077.html → M000069.html} +6 -6
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +30 -30
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000093.html → M000085.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000094.html → M000086.html} +4 -4
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000095.html → M000087.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000096.html → M000088.html} +1 -1
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000097.html → M000089.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000098.html → M000090.html} +1 -1
- data/doc/rdoc/classes/MongrelDbg.html +26 -26
- data/doc/rdoc/classes/MongrelDbg.src/M000005.html +24 -0
- data/doc/rdoc/classes/MongrelDbg.src/{M000016.html → M000006.html} +6 -6
- data/doc/rdoc/classes/MongrelDbg.src/{M000017.html → M000007.html} +8 -8
- data/doc/rdoc/classes/MongrelDbg.src/{M000018.html → M000008.html} +7 -7
- data/doc/rdoc/classes/MongrelDbg.src/{M000019.html → M000009.html} +4 -4
- data/doc/rdoc/classes/RequestLog/Access.html +5 -5
- data/doc/rdoc/classes/RequestLog/Access.src/{M000142.html → M000144.html} +5 -5
- data/doc/rdoc/classes/RequestLog/Files.html +5 -5
- data/doc/rdoc/classes/RequestLog/Files.src/{M000143.html → M000145.html} +5 -5
- data/doc/rdoc/classes/RequestLog/Objects.html +12 -6
- data/doc/rdoc/classes/RequestLog/Objects.src/M000147.html +51 -0
- data/doc/rdoc/classes/RequestLog/Params.html +5 -5
- data/doc/rdoc/classes/RequestLog/Params.src/{M000146.html → M000148.html} +5 -5
- data/doc/rdoc/classes/RequestLog/Threads.html +5 -5
- data/doc/rdoc/classes/RequestLog/Threads.src/{M000144.html → M000146.html} +20 -20
- data/doc/rdoc/classes/{ObjectTracker.html → Sync.html} +26 -45
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/COPYING.html +1 -1
- data/doc/rdoc/files/LICENSE.html +1 -1
- data/doc/rdoc/files/README.html +1 -1
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/command_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/configurator_rb.html +111 -0
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/init_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -1
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -4
- data/doc/rdoc/fr_class_index.html +3 -2
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +144 -142
- data/ext/http11/http11.c +69 -52
- data/ext/http11/http11_parser.c +366 -282
- data/ext/http11/http11_parser.h +2 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/lib/mongrel.rb +127 -433
- data/lib/mongrel/cgi.rb +19 -6
- data/lib/mongrel/command.rb +15 -3
- data/lib/mongrel/configurator.rb +374 -0
- data/lib/mongrel/debug.rb +47 -56
- data/lib/mongrel/handlers.rb +16 -20
- data/lib/mongrel/rails.rb +36 -20
- data/lib/mongrel/stats.rb +60 -58
- data/test/test_conditional.rb +37 -30
- data/test/test_http11.rb +14 -14
- data/test/test_stats.rb +2 -2
- data/test/test_ws.rb +4 -2
- data/tools/rakehelp.rb +4 -4
- metadata +262 -260
- data/doc/rdoc/classes/Kernel.src/M000020.html +0 -19
- data/doc/rdoc/classes/Kernel.src/M000021.html +0 -23
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000104.html +0 -27
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000036.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000037.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000038.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000041.html +0 -50
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +0 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +0 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +0 -23
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000118.html +0 -30
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000125.html +0 -25
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000127.html +0 -35
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000128.html +0 -18
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000129.html +0 -33
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000130.html +0 -18
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html +0 -63
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000138.html +0 -56
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000087.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000089.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000090.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000091.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000092.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +0 -50
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000046.html +0 -51
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000047.html +0 -23
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/M000133.html +0 -24
- data/doc/rdoc/classes/MongrelDbg.src/M000015.html +0 -19
- data/doc/rdoc/classes/ObjectTracker.src/M000013.html +0 -27
- data/doc/rdoc/classes/ObjectTracker.src/M000014.html +0 -44
- data/doc/rdoc/classes/RequestLog/Objects.src/M000145.html +0 -19
- data/doc/rdoc/classes/Stats.src/M000005.html +0 -19
- data/doc/rdoc/classes/Stats.src/M000006.html +0 -23
- data/doc/rdoc/classes/Stats.src/M000007.html +0 -26
- data/doc/rdoc/classes/Stats.src/M000008.html +0 -18
- data/doc/rdoc/classes/Stats.src/M000010.html +0 -18
- data/doc/rdoc/classes/Stats.src/M000011.html +0 -23
- data/doc/rdoc/classes/Stats.src/M000012.html +0 -20
- data/lib/http11.so +0 -0
data/lib/mongrel/cgi.rb
CHANGED
|
@@ -27,8 +27,10 @@ module Mongrel
|
|
|
27
27
|
class CGIWrapper < ::CGI
|
|
28
28
|
public :env_table
|
|
29
29
|
attr_reader :options
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
attr_accessor :handler
|
|
31
|
+
# Set this to false if you want calls to CGIWrapper.out to not actually send
|
|
32
|
+
# the response until you force it.
|
|
33
|
+
attr_accessor :default_really_final
|
|
32
34
|
|
|
33
35
|
# these are stripped out of any keys passed to CGIWrapper.header function
|
|
34
36
|
REMOVED_KEYS = [ "nph","status","server","connection","type",
|
|
@@ -44,6 +46,7 @@ module Mongrel
|
|
|
44
46
|
@input = request.body
|
|
45
47
|
@head = {}
|
|
46
48
|
@out_called = false
|
|
49
|
+
@default_really_final=true
|
|
47
50
|
super(*args)
|
|
48
51
|
end
|
|
49
52
|
|
|
@@ -116,17 +119,27 @@ module Mongrel
|
|
|
116
119
|
# So, we just reuse header and then finalize the HttpResponse the right way.
|
|
117
120
|
# Status is taken from the various options and converted to what Mongrel needs
|
|
118
121
|
# via the CGIWrapper.status function.
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
#
|
|
123
|
+
# We also prevent Rails from actually doing the final send by adding a
|
|
124
|
+
# second parameter "really_final". Only Mongrel calls this after Rails
|
|
125
|
+
# is done. Since this will break other frameworks, it defaults to
|
|
126
|
+
# a different setting for rails (false) and (true) for others.
|
|
127
|
+
def out(options = "text/html", really_final=@default_really_final)
|
|
128
|
+
if @out_called || !really_final
|
|
129
|
+
# don't do it more than once or if it's not the really final call
|
|
130
|
+
return
|
|
131
|
+
end
|
|
121
132
|
|
|
122
133
|
header(options)
|
|
123
134
|
|
|
124
|
-
@response.start status do |head,
|
|
135
|
+
@response.start status do |head, body|
|
|
125
136
|
send_cookies(head)
|
|
126
137
|
|
|
127
138
|
@head.each {|k,v| head[k] = v}
|
|
128
|
-
|
|
139
|
+
body.write(yield || "")
|
|
129
140
|
end
|
|
141
|
+
|
|
142
|
+
@out_called = true
|
|
130
143
|
end
|
|
131
144
|
|
|
132
145
|
# Computes the status once, but lazily so that people who call header twice
|
data/lib/mongrel/command.rb
CHANGED
|
@@ -157,6 +157,10 @@ module Mongrel
|
|
|
157
157
|
puts "#{Mongrel::Command::BANNER}\nAvailable commands are:\n\n"
|
|
158
158
|
|
|
159
159
|
self.commands.each do |name|
|
|
160
|
+
if /mongrel::/ =~ name
|
|
161
|
+
name = name[9 .. -1]
|
|
162
|
+
end
|
|
163
|
+
|
|
160
164
|
puts " - #{name[1 .. -1]}\n"
|
|
161
165
|
end
|
|
162
166
|
|
|
@@ -179,12 +183,20 @@ module Mongrel
|
|
|
179
183
|
return true
|
|
180
184
|
end
|
|
181
185
|
|
|
182
|
-
# command exists, set it up and validate it
|
|
183
186
|
begin
|
|
187
|
+
# quick hack so that existing commands will keep working but the Mongrel:: ones can be moved
|
|
188
|
+
if ["start", "stop", "restart"].include? cmd_name
|
|
189
|
+
cmd_name = "mongrel::" + cmd_name
|
|
190
|
+
end
|
|
191
|
+
|
|
184
192
|
command = GemPlugin::Manager.instance.create("/commands/#{cmd_name}", :argv => args)
|
|
193
|
+
rescue OptionParser::InvalidOption
|
|
194
|
+
STDERR.puts "#$! for command '#{cmd_name}'"
|
|
195
|
+
STDERR.puts "Try #{cmd_name} -h to get help."
|
|
196
|
+
return false
|
|
185
197
|
rescue
|
|
186
|
-
STDERR.puts "
|
|
187
|
-
|
|
198
|
+
STDERR.puts "ERROR RUNNING '#{cmd_name}': #$!"
|
|
199
|
+
STDERR.puts "Use help command to get help"
|
|
188
200
|
return false
|
|
189
201
|
end
|
|
190
202
|
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'etc'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module Mongrel
|
|
6
|
+
# Implements a simple DSL for configuring a Mongrel server for your
|
|
7
|
+
# purposes. More used by framework implementers to setup Mongrel
|
|
8
|
+
# how they like, but could be used by regular folks to add more things
|
|
9
|
+
# to an existing mongrel configuration.
|
|
10
|
+
#
|
|
11
|
+
# It is used like this:
|
|
12
|
+
#
|
|
13
|
+
# require 'mongrel'
|
|
14
|
+
# config = Mongrel::Configurator.new :host => "127.0.0.1" do
|
|
15
|
+
# listener :port => 3000 do
|
|
16
|
+
# uri "/app", :handler => Mongrel::DirHandler.new(".", load_mime_map("mime.yaml"))
|
|
17
|
+
# end
|
|
18
|
+
# run
|
|
19
|
+
# end
|
|
20
|
+
#
|
|
21
|
+
# This will setup a simple DirHandler at the current directory and load additional
|
|
22
|
+
# mime types from mimy.yaml. The :host => "127.0.0.1" is actually not
|
|
23
|
+
# specific to the servers but just a hash of default parameters that all
|
|
24
|
+
# server or uri calls receive.
|
|
25
|
+
#
|
|
26
|
+
# When you are inside the block after Mongrel::Configurator.new you can simply
|
|
27
|
+
# call functions that are part of Configurator (like server, uri, daemonize, etc)
|
|
28
|
+
# without having to refer to anything else. You can also call these functions on
|
|
29
|
+
# the resulting object directly for additional configuration.
|
|
30
|
+
#
|
|
31
|
+
# A major thing about Configurator is that it actually lets you configure
|
|
32
|
+
# multiple listeners for any hosts and ports you want. These are kept in a
|
|
33
|
+
# map config.listeners so you can get to them.
|
|
34
|
+
#
|
|
35
|
+
# * :pid_file => Where to write the process ID.
|
|
36
|
+
class Configurator
|
|
37
|
+
attr_reader :listeners
|
|
38
|
+
attr_reader :defaults
|
|
39
|
+
attr_reader :needs_restart
|
|
40
|
+
|
|
41
|
+
# You pass in initial defaults and then a block to continue configuring.
|
|
42
|
+
def initialize(defaults={}, &blk)
|
|
43
|
+
@listener = nil
|
|
44
|
+
@listener_name = nil
|
|
45
|
+
@listeners = {}
|
|
46
|
+
@defaults = defaults
|
|
47
|
+
@needs_restart = false
|
|
48
|
+
@pid_file = defaults[:pid_file]
|
|
49
|
+
|
|
50
|
+
if blk
|
|
51
|
+
cloaker(&blk).bind(self).call
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Change privilege of the process to specified user and group.
|
|
56
|
+
def change_privilege(user, group)
|
|
57
|
+
begin
|
|
58
|
+
if group
|
|
59
|
+
log "Changing group to #{group}."
|
|
60
|
+
Process::GID.change_privilege(Etc.getgrnam(group).gid)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if user
|
|
64
|
+
log "Changing user to #{user}."
|
|
65
|
+
Process::UID.change_privilege(Etc.getpwnam(user).uid)
|
|
66
|
+
end
|
|
67
|
+
rescue Errno::EPERM
|
|
68
|
+
log "FAILED to change user:group #{user}:#{group}: #$!"
|
|
69
|
+
exit 1
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Writes the PID file but only if we're on windows.
|
|
74
|
+
def write_pid_file
|
|
75
|
+
if RUBY_PLATFORM !~ /mswin/
|
|
76
|
+
log "Writing PID file to #{@pid_file}"
|
|
77
|
+
open(@pid_file,"w") {|f| f.write(Process.pid) }
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# generates a class for cloaking the current self and making the DSL nicer
|
|
82
|
+
def cloaking_class
|
|
83
|
+
class << self
|
|
84
|
+
self
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Do not call this. You were warned.
|
|
89
|
+
def cloaker(&blk)
|
|
90
|
+
cloaking_class.class_eval do
|
|
91
|
+
define_method :cloaker_, &blk
|
|
92
|
+
meth = instance_method( :cloaker_ )
|
|
93
|
+
remove_method :cloaker_
|
|
94
|
+
meth
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# This will resolve the given options against the defaults.
|
|
99
|
+
# Normally just used internally.
|
|
100
|
+
def resolve_defaults(options)
|
|
101
|
+
options.merge(@defaults)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Starts a listener block. This is the only one that actually takes
|
|
105
|
+
# a block and then you make Configurator.uri calls in order to setup
|
|
106
|
+
# your URIs and handlers. If you write your Handlers as GemPlugins
|
|
107
|
+
# then you can use load_plugins and plugin to load them.
|
|
108
|
+
#
|
|
109
|
+
# It expects the following options (or defaults):
|
|
110
|
+
#
|
|
111
|
+
# * :host => Host name to bind.
|
|
112
|
+
# * :port => Port to bind.
|
|
113
|
+
# * :num_processors => The maximum number of concurrent threads allowed. (950 default)
|
|
114
|
+
# * :timeout => 1/100th of a second timeout between requests. (10 is 1/10th, 0 is timeout)
|
|
115
|
+
# * :user => User to change to, must have :group as well.
|
|
116
|
+
# * :group => Group to change to, must have :user as well.
|
|
117
|
+
#
|
|
118
|
+
def listener(options={},&blk)
|
|
119
|
+
raise "Cannot call listener inside another listener block." if (@listener or @listener_name)
|
|
120
|
+
ops = resolve_defaults(options)
|
|
121
|
+
ops[:num_processors] ||= 950
|
|
122
|
+
ops[:timeout] ||= 0
|
|
123
|
+
|
|
124
|
+
@listener = Mongrel::HttpServer.new(ops[:host], ops[:port].to_i, ops[:num_processors].to_i, ops[:timeout].to_i)
|
|
125
|
+
@listener_name = "#{ops[:host]}:#{ops[:port]}"
|
|
126
|
+
@listeners[@listener_name] = @listener
|
|
127
|
+
|
|
128
|
+
if ops[:user] and ops[:group]
|
|
129
|
+
change_privilege(ops[:user], ops[:group])
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Does the actual cloaking operation to give the new implicit self.
|
|
133
|
+
if blk
|
|
134
|
+
cloaker(&blk).bind(self).call
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# all done processing this listener setup, reset implicit variables
|
|
138
|
+
@listener = nil
|
|
139
|
+
@listener_name = nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# Called inside a Configurator.listener block in order to
|
|
144
|
+
# add URI->handler mappings for that listener. Use this as
|
|
145
|
+
# many times as you like. It expects the following options
|
|
146
|
+
# or defaults:
|
|
147
|
+
#
|
|
148
|
+
# * :handler => HttpHandler -- Handler to use for this location.
|
|
149
|
+
# * :in_front => true/false -- Rather than appending, it prepends this handler.
|
|
150
|
+
def uri(location, options={})
|
|
151
|
+
ops = resolve_defaults(options)
|
|
152
|
+
@listener.register(location, ops[:handler], ops[:in_front])
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# Daemonizes the current Ruby script turning all the
|
|
157
|
+
# listeners into an actual "server" or detached process.
|
|
158
|
+
# You must call this *before* frameworks that open files
|
|
159
|
+
# as otherwise the files will be closed by this function.
|
|
160
|
+
#
|
|
161
|
+
# Does not work for Win32 systems (the call is silently ignored).
|
|
162
|
+
#
|
|
163
|
+
# Requires the following options or defaults:
|
|
164
|
+
#
|
|
165
|
+
# * :cwd => Directory to change to.
|
|
166
|
+
# * :log_file => Where to write STDOUT and STDERR.
|
|
167
|
+
#
|
|
168
|
+
# It is safe to call this on win32 as it will only require the daemons
|
|
169
|
+
# gem/library if NOT win32.
|
|
170
|
+
def daemonize(options={})
|
|
171
|
+
ops = resolve_defaults(options)
|
|
172
|
+
# save this for later since daemonize will hose it
|
|
173
|
+
if RUBY_PLATFORM !~ /mswin/
|
|
174
|
+
require 'daemons/daemonize'
|
|
175
|
+
|
|
176
|
+
logfile = ops[:log_file]
|
|
177
|
+
if logfile[0].chr != "/"
|
|
178
|
+
logfile = File.join(ops[:cwd],logfile)
|
|
179
|
+
if not File.exist?(File.dirname(logfile))
|
|
180
|
+
log "!!! Log file directory not found at full path #{File.dirname(logfile)}. Update your configuration to use a full path."
|
|
181
|
+
exit 1
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
Daemonize.daemonize(logfile)
|
|
186
|
+
|
|
187
|
+
# change back to the original starting directory
|
|
188
|
+
Dir.chdir(ops[:cwd])
|
|
189
|
+
|
|
190
|
+
else
|
|
191
|
+
log "WARNING: Win32 does not support daemon mode."
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# Uses the GemPlugin system to easily load plugins based on their
|
|
197
|
+
# gem dependencies. You pass in either an :includes => [] or
|
|
198
|
+
# :excludes => [] setting listing the names of plugins to include
|
|
199
|
+
# or exclude from the when determining the dependencies.
|
|
200
|
+
def load_plugins(options={})
|
|
201
|
+
ops = resolve_defaults(options)
|
|
202
|
+
|
|
203
|
+
load_settings = {}
|
|
204
|
+
if ops[:includes]
|
|
205
|
+
ops[:includes].each do |plugin|
|
|
206
|
+
load_settings[plugin] = GemPlugin::INCLUDE
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if ops[:excludes]
|
|
211
|
+
ops[:excludes].each do |plugin|
|
|
212
|
+
load_settings[plugin] = GemPlugin::EXCLUDE
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
GemPlugin::Manager.instance.load(load_settings)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
# Easy way to load a YAML file and apply default settings.
|
|
221
|
+
def load_yaml(file, default={})
|
|
222
|
+
default.merge(YAML.load_file(file))
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
# Loads the MIME map file and checks that it is correct
|
|
227
|
+
# on loading. This is commonly passed to Mongrel::DirHandler
|
|
228
|
+
# or any framework handler that uses DirHandler to serve files.
|
|
229
|
+
# You can also include a set of default MIME types as additional
|
|
230
|
+
# settings. See Mongrel::DirHandler for how the MIME types map
|
|
231
|
+
# is organized.
|
|
232
|
+
def load_mime_map(file, mime={})
|
|
233
|
+
# configure any requested mime map
|
|
234
|
+
mime = load_yaml(file, mime)
|
|
235
|
+
|
|
236
|
+
# check all the mime types to make sure they are the right format
|
|
237
|
+
mime.each {|k,v| log "WARNING: MIME type #{k} must start with '.'" if k.index(".") != 0 }
|
|
238
|
+
|
|
239
|
+
return mime
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# Loads and creates a plugin for you based on the given
|
|
244
|
+
# name and configured with the selected options. The options
|
|
245
|
+
# are merged with the defaults prior to passing them in.
|
|
246
|
+
def plugin(name, options={})
|
|
247
|
+
ops = resolve_defaults(options)
|
|
248
|
+
GemPlugin::Manager.instance.create(name, ops)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Let's you do redirects easily as described in Mongrel::RedirectHandler.
|
|
252
|
+
# You use it inside the configurator like this:
|
|
253
|
+
#
|
|
254
|
+
# redirect("/test", "/to/there") # simple
|
|
255
|
+
# redirect("/to", /t/, 'w') # regexp
|
|
256
|
+
# redirect("/hey", /(w+)/) {|match| ...} # block
|
|
257
|
+
#
|
|
258
|
+
def redirect(from, pattern, replacement = nil, &block)
|
|
259
|
+
uri from, :handler => Mongrel::RedirectHandler.new(pattern, replacement, &block)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Works like a meta run method which goes through all the
|
|
263
|
+
# configured listeners. Use the Configurator.join method
|
|
264
|
+
# to prevent Ruby from exiting until each one is done.
|
|
265
|
+
def run
|
|
266
|
+
@listeners.each {|name,s|
|
|
267
|
+
s.run
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
$mongrel_sleeper_thread = Thread.new { loop { sleep 1 } }
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Calls .stop on all the configured listeners so they
|
|
274
|
+
# stop processing requests (gracefully). By default it
|
|
275
|
+
# assumes that you don't want to restart.
|
|
276
|
+
def stop(needs_restart=false)
|
|
277
|
+
@listeners.each {|name,s|
|
|
278
|
+
s.stop
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@needs_restart = needs_restart
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
# This method should actually be called *outside* of the
|
|
286
|
+
# Configurator block so that you can control it. In other words
|
|
287
|
+
# do it like: config.join.
|
|
288
|
+
def join
|
|
289
|
+
@listeners.values.each {|s| s.acceptor.join }
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# Calling this before you register your URIs to the given location
|
|
294
|
+
# will setup a set of handlers that log open files, objects, and the
|
|
295
|
+
# parameters for each request. This helps you track common problems
|
|
296
|
+
# found in Rails applications that are either slow or become unresponsive
|
|
297
|
+
# after a little while.
|
|
298
|
+
#
|
|
299
|
+
# You can pass an extra parameter *what* to indicate what you want to
|
|
300
|
+
# debug. For example, if you just want to dump rails stuff then do:
|
|
301
|
+
#
|
|
302
|
+
# debug "/", what = [:rails]
|
|
303
|
+
#
|
|
304
|
+
# And it will only produce the log/mongrel_debug/rails.log file.
|
|
305
|
+
# Available options are: :objects, :rails, :files, :threads, :params
|
|
306
|
+
#
|
|
307
|
+
# NOTE: Use [:files] to get accesses dumped to stderr like with WEBrick.
|
|
308
|
+
def debug(location, what = [:objects, :rails, :files, :threads, :params])
|
|
309
|
+
require 'mongrel/debug'
|
|
310
|
+
handlers = {
|
|
311
|
+
:files => "/handlers/requestlog::access",
|
|
312
|
+
:rails => "/handlers/requestlog::files",
|
|
313
|
+
:objects => "/handlers/requestlog::objects",
|
|
314
|
+
:threads => "/handlers/requestlog::threads",
|
|
315
|
+
:params => "/handlers/requestlog::params"
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
# turn on the debugging infrastructure, and ObjectTracker is a pig
|
|
319
|
+
MongrelDbg.configure
|
|
320
|
+
|
|
321
|
+
# now we roll through each requested debug type, turn it on and load that plugin
|
|
322
|
+
what.each do |type|
|
|
323
|
+
MongrelDbg.begin_trace type
|
|
324
|
+
uri location, :handler => plugin(handlers[type])
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Used to allow you to let users specify their own configurations
|
|
329
|
+
# inside your Configurator setup. You pass it a script name and
|
|
330
|
+
# it reads it in and does an eval on the contents passing in the right
|
|
331
|
+
# binding so they can put their own Configurator statements.
|
|
332
|
+
def run_config(script)
|
|
333
|
+
open(script) {|f| eval(f.read, proc {self}) }
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Sets up the standard signal handlers that are used on most Ruby
|
|
337
|
+
# It only configures if the platform is not win32 and doesn't do
|
|
338
|
+
# a HUP signal since this is typically framework specific.
|
|
339
|
+
#
|
|
340
|
+
# Requires a :pid_file option given to Configurator.new to indicate a file to delete.
|
|
341
|
+
# It sets the MongrelConfig.needs_restart attribute if
|
|
342
|
+
# the start command should reload. It's up to you to detect this
|
|
343
|
+
# and do whatever is needed for a "restart".
|
|
344
|
+
#
|
|
345
|
+
# This command is safely ignored if the platform is win32 (with a warning)
|
|
346
|
+
def setup_signals(options={})
|
|
347
|
+
ops = resolve_defaults(options)
|
|
348
|
+
|
|
349
|
+
# forced shutdown, even if previously restarted (actually just like TERM but for CTRL-C)
|
|
350
|
+
trap("INT") { log "INT signal received."; stop(false) }
|
|
351
|
+
|
|
352
|
+
# clean up the pid file always
|
|
353
|
+
at_exit { File.unlink(@pid_file) if @pid_file and File.exists?(@pid_file) }
|
|
354
|
+
|
|
355
|
+
if RUBY_PLATFORM !~ /mswin/
|
|
356
|
+
# graceful shutdown
|
|
357
|
+
trap("TERM") { log "TERM signal received."; stop }
|
|
358
|
+
trap("USR1") { log "USR1 received, toggling $mongrel_debug_client to #{!$mongrel_debug_client}"; $mongrel_debug_client = !$mongrel_debug_client }
|
|
359
|
+
# restart
|
|
360
|
+
trap("USR2") { log "USR2 signal received."; stop(true) }
|
|
361
|
+
|
|
362
|
+
log "Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart)."
|
|
363
|
+
else
|
|
364
|
+
log "Signals ready. INT => stop (no restart)."
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Logs a simple message to STDERR (or the mongrel log if in daemon mode).
|
|
369
|
+
def log(msg)
|
|
370
|
+
STDERR.print "** ", msg, "\n"
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
end
|
|
374
|
+
end
|