mongrel 0.3.13.1 → 0.3.13.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/doc/rdoc/classes/Mongrel.html +3 -2
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +49 -49
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000101.html +11 -14
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000102.html +34 -12
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000103.html +21 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000104.html +14 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000105.html +12 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000106.html +5 -6
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000107.html +18 -0
- data/doc/rdoc/classes/Mongrel/{URIClassifier.src/M000090.html → CGIWrapper.src/M000108.html} +5 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000109.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +5 -5
- data/doc/rdoc/classes/Mongrel/Camping.src/{M000047.html → M000048.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000049.html +5 -38
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000050.html +51 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +65 -65
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000026.html +11 -29
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000027.html +29 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000028.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000031.html +5 -9
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000032.html +9 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000033.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000034.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000035.html +5 -11
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000036.html +11 -11
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000037.html +11 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000038.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +15 -15
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000039.html +7 -12
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000040.html +12 -37
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000041.html +50 -0
- data/doc/rdoc/classes/Mongrel/Configurator.html +120 -114
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +14 -7
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +18 -10
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +7 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +7 -21
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +10 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000115.html +5 -17
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000116.html +25 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000117.html +6 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000118.html +17 -11
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000119.html +20 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000120.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000121.html +11 -9
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000122.html +6 -12
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000123.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000124.html +9 -22
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000125.html +12 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000126.html +5 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000127.html +22 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000128.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000129.html +33 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000130.html +18 -0
- data/doc/rdoc/classes/Mongrel/Const.html +1 -1
- data/doc/rdoc/classes/Mongrel/DeflateFilter.html +10 -10
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000096.html → M000099.html} +5 -5
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000097.html → M000100.html} +14 -14
- data/doc/rdoc/classes/Mongrel/DirHandler.html +31 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000058.html +8 -30
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000059.html +30 -29
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000060.html +29 -50
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html +50 -26
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000062.html +26 -5
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000063.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000128.html → M000131.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000129.html → M000132.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000070.html → M000072.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000071.html → M000073.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +31 -10
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000076.html → M000078.html} +0 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000079.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000077.html → M000080.html} +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +25 -10
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000022.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000023.html +4 -6
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000024.html +6 -4
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000025.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000051.html +5 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000052.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000053.html +7 -37
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +37 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000055.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000056.html +5 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000050.html → M000057.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +30 -21
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000138.html +43 -19
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000136.html → M000139.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000137.html → M000140.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000141.html +32 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +61 -61
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +12 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +7 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +12 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000084.html +9 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000085.html +9 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000086.html +9 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000087.html +18 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000088.html +8 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000089.html +7 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000090.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000091.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000092.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +63 -41
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +12 -76
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +74 -13
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +18 -50
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +8 -21
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +38 -5
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +21 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +22 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +15 -15
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000042.html +26 -12
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000043.html +12 -13
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000044.html +26 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +15 -15
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000045.html +9 -38
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000046.html +38 -10
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000047.html +23 -0
- data/doc/rdoc/classes/Mongrel/RedirectHandler.html +10 -10
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000133.html → M000136.html} +8 -8
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000134.html → M000137.html} +13 -13
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.html +16 -16
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000130.html → M000133.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000131.html → M000134.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000132.html → M000135.html} +4 -4
- data/doc/rdoc/classes/Mongrel/StatusHandler.html +20 -20
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000074.html +5 -29
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000075.html +11 -7
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000076.html +42 -0
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000077.html +20 -0
- data/doc/rdoc/classes/Mongrel/TimeoutError.html +117 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +30 -30
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000093.html +5 -38
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000094.html +5 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000095.html +16 -60
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000096.html +51 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000097.html +36 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000098.html +83 -0
- data/doc/rdoc/classes/RequestLog/Access.html +5 -5
- data/doc/rdoc/classes/RequestLog/Access.src/{M000139.html → M000142.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Files.html +5 -5
- data/doc/rdoc/classes/RequestLog/Files.src/{M000140.html → M000143.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Objects.html +5 -5
- data/doc/rdoc/classes/RequestLog/Objects.src/{M000142.html → M000145.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Params.html +5 -5
- data/doc/rdoc/classes/RequestLog/Params.src/{M000143.html → M000146.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Threads.html +5 -5
- data/doc/rdoc/classes/RequestLog/Threads.src/{M000141.html → M000144.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/command_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/init_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -2
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +125 -122
- data/ext/http11/http11.c +2 -2
- data/ext/http11/http11_parser.c +1 -1
- data/ext/http11/http11_parser.h +1 -1
- data/lib/mongrel.rb +70 -53
- data/lib/mongrel/camping.rb +1 -1
- data/lib/mongrel/cgi.rb +1 -1
- data/lib/mongrel/command.rb +1 -1
- data/lib/mongrel/debug.rb +1 -1
- data/lib/mongrel/handlers.rb +10 -1
- data/lib/mongrel/init.rb +1 -1
- data/lib/mongrel/rails.rb +1 -1
- data/lib/mongrel/stats.rb +1 -1
- data/lib/mongrel/tcphack.rb +1 -1
- data/test/test_command.rb +1 -1
- data/test/test_conditional.rb +1 -1
- data/test/test_configurator.rb +1 -1
- data/test/test_debug.rb +1 -1
- data/test/test_handlers.rb +1 -1
- data/test/test_http11.rb +1 -1
- data/test/test_response.rb +1 -1
- data/test/test_stats.rb +1 -1
- data/test/test_uriclassifier.rb +1 -1
- data/test/test_ws.rb +1 -1
- data/tools/trickletest.rb +28 -20
- metadata +50 -46
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000098.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000099.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000100.html +0 -34
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000048.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000025.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000038.html +0 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +0 -29
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +0 -31
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000057.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000135.html +0 -52
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000063.html +0 -25
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000041.html +0 -39
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000044.html +0 -22
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000072.html +0 -18
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000073.html +0 -24
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000091.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000092.html +0 -39
@@ -5,85 +5,21 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>new (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
526: <span class="ruby-comment cmt"># with the read operation on the client socket. Effect is to stop processing when the</span>
|
25
|
-
527: <span class="ruby-comment cmt"># socket can't fill the buffer for further parsing.</span>
|
26
|
-
528: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">nparsed</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>
|
27
|
-
529: <span class="ruby-identifier">nparsed</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">nparsed</span>)
|
28
|
-
530:
|
29
|
-
531: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
30
|
-
532: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handlers</span> = <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REQUEST_URI</span>])
|
31
|
-
533:
|
32
|
-
534: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handlers</span>
|
33
|
-
535: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">path_info</span>
|
34
|
-
536: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SCRIPT_NAME</span>] = <span class="ruby-identifier">script_name</span>
|
35
|
-
537: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REMOTE_ADDR</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_X_FORWARDED_FOR</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">peeraddr</span>.<span class="ruby-identifier">last</span>
|
36
|
-
538: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>[<span class="ruby-identifier">nparsed</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
|
37
|
-
539:
|
38
|
-
540: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handlers</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">request_notify</span>
|
39
|
-
541: <span class="ruby-comment cmt"># this first handler wants to be notified when the process starts</span>
|
40
|
-
542: <span class="ruby-identifier">handlers</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">request_begins</span>(<span class="ruby-identifier">params</span>)
|
41
|
-
543: <span class="ruby-keyword kw">end</span>
|
42
|
-
544:
|
43
|
-
545: <span class="ruby-comment cmt"># TODO: Find a faster/better way to carve out the range, preferably without copying.</span>
|
44
|
-
546: <span class="ruby-identifier">request</span> = <span class="ruby-constant">HttpRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">client</span>)
|
45
|
-
547:
|
46
|
-
548: <span class="ruby-comment cmt"># in the case of large file uploads the user could close the socket, so skip those requests</span>
|
47
|
-
549: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># nil signals from HttpRequest::initialize that the request was aborted</span>
|
48
|
-
550:
|
49
|
-
551: <span class="ruby-comment cmt"># request is good so far, continue processing the response</span>
|
50
|
-
552: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
51
|
-
553:
|
52
|
-
554: <span class="ruby-comment cmt"># Process each handler in registered order until we run out or one finalizes the response.</span>
|
53
|
-
555: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
|
54
|
-
556: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
55
|
-
557: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
56
|
-
558: <span class="ruby-keyword kw">end</span>
|
57
|
-
559:
|
58
|
-
560: <span class="ruby-comment cmt"># And finally, if nobody closed the response off, we finalize it.</span>
|
59
|
-
561: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
60
|
-
562: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">finished</span>
|
61
|
-
563: <span class="ruby-keyword kw">end</span>
|
62
|
-
564: <span class="ruby-keyword kw">else</span>
|
63
|
-
565: <span class="ruby-comment cmt"># Didn't find it, return a stock 404 response.</span>
|
64
|
-
566: <span class="ruby-comment cmt"># TODO: Implement customer 404 files (but really they should use a real web server).</span>
|
65
|
-
567: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span>)
|
66
|
-
568: <span class="ruby-keyword kw">end</span>
|
67
|
-
569:
|
68
|
-
570: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
69
|
-
571: <span class="ruby-keyword kw">else</span>
|
70
|
-
572: <span class="ruby-comment cmt"># Parser is not done, queue up more data to read and continue parsing</span>
|
71
|
-
573: <span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
72
|
-
574: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_HEADER</span>
|
73
|
-
575: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpParserError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"HEADER is longer than allowed, aborting client early."</span>)
|
74
|
-
576: <span class="ruby-keyword kw">end</span>
|
75
|
-
577: <span class="ruby-keyword kw">end</span>
|
76
|
-
578: <span class="ruby-keyword kw">end</span>
|
77
|
-
579: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EINVAL</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EBADF</span>
|
78
|
-
580: <span class="ruby-comment cmt"># ignored</span>
|
79
|
-
581: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpParserError</span>
|
80
|
-
582: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now}: BAD CLIENT (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #$!"</span>
|
81
|
-
583: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
82
|
-
584: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now}: ERROR: #$!"</span>
|
83
|
-
585: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
84
|
-
586: <span class="ruby-keyword kw">ensure</span>
|
85
|
-
587: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
86
|
-
588: <span class="ruby-keyword kw">end</span>
|
87
|
-
589: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 509</span>
|
14
|
+
509: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">num_processors</span>=(<span class="ruby-value">2</span><span class="ruby-operator">**</span><span class="ruby-value">30</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>), <span class="ruby-identifier">timeout</span>=<span class="ruby-value">0</span>)
|
15
|
+
510: <span class="ruby-ivar">@socket</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>)
|
16
|
+
511: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
|
17
|
+
512: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
|
18
|
+
513: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
|
19
|
+
514: <span class="ruby-ivar">@workers</span> = <span class="ruby-constant">ThreadGroup</span>.<span class="ruby-identifier">new</span>
|
20
|
+
515: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
|
21
|
+
516: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
|
22
|
+
517: <span class="ruby-ivar">@death_time</span> = <span class="ruby-value">60</span>
|
23
|
+
518: <span class="ruby-keyword kw">end</span></pre>
|
88
24
|
</body>
|
89
25
|
</html>
|
@@ -5,22 +5,83 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>process_client (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 526</span>
|
14
|
+
526: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
|
15
|
+
527: <span class="ruby-keyword kw">begin</span>
|
16
|
+
528: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
|
17
|
+
529: <span class="ruby-identifier">params</span> = {}
|
18
|
+
530: <span class="ruby-identifier">request</span> = <span class="ruby-keyword kw">nil</span>
|
19
|
+
531: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
20
|
+
532: <span class="ruby-identifier">nparsed</span> = <span class="ruby-value">0</span>
|
21
|
+
533:
|
22
|
+
534: <span class="ruby-comment cmt"># Assumption: nparsed will always be less since data will get filled with more</span>
|
23
|
+
535: <span class="ruby-comment cmt"># after each parsing. If it doesn't get more then there was a problem</span>
|
24
|
+
536: <span class="ruby-comment cmt"># with the read operation on the client socket. Effect is to stop processing when the</span>
|
25
|
+
537: <span class="ruby-comment cmt"># socket can't fill the buffer for further parsing.</span>
|
26
|
+
538: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">nparsed</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>
|
27
|
+
539: <span class="ruby-identifier">nparsed</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">nparsed</span>)
|
28
|
+
540:
|
29
|
+
541: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
|
30
|
+
542: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handlers</span> = <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REQUEST_URI</span>])
|
31
|
+
543:
|
32
|
+
544: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handlers</span>
|
33
|
+
545: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">path_info</span>
|
34
|
+
546: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SCRIPT_NAME</span>] = <span class="ruby-identifier">script_name</span>
|
35
|
+
547: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REMOTE_ADDR</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_X_FORWARDED_FOR</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">peeraddr</span>.<span class="ruby-identifier">last</span>
|
36
|
+
548: <span class="ruby-identifier">notifier</span> = <span class="ruby-identifier">handlers</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">request_notify</span> <span class="ruby-value">? </span><span class="ruby-identifier">handlers</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
|
37
|
+
549:
|
38
|
+
550: <span class="ruby-comment cmt"># TODO: Find a faster/better way to carve out the range, preferably without copying.</span>
|
39
|
+
551: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>[<span class="ruby-identifier">nparsed</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
|
40
|
+
552:
|
41
|
+
553: <span class="ruby-identifier">request</span> = <span class="ruby-constant">HttpRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">client</span>, <span class="ruby-identifier">notifier</span>)
|
42
|
+
554:
|
43
|
+
555: <span class="ruby-comment cmt"># in the case of large file uploads the user could close the socket, so skip those requests</span>
|
44
|
+
556: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># nil signals from HttpRequest::initialize that the request was aborted</span>
|
45
|
+
557:
|
46
|
+
558: <span class="ruby-comment cmt"># request is good so far, continue processing the response</span>
|
47
|
+
559: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
|
48
|
+
560:
|
49
|
+
561: <span class="ruby-comment cmt"># Process each handler in registered order until we run out or one finalizes the response.</span>
|
50
|
+
562: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
|
51
|
+
563: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
52
|
+
564: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
53
|
+
565: <span class="ruby-keyword kw">end</span>
|
54
|
+
566:
|
55
|
+
567: <span class="ruby-comment cmt"># And finally, if nobody closed the response off, we finalize it.</span>
|
56
|
+
568: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
57
|
+
569: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">finished</span>
|
58
|
+
570: <span class="ruby-keyword kw">end</span>
|
59
|
+
571: <span class="ruby-keyword kw">else</span>
|
60
|
+
572: <span class="ruby-comment cmt"># Didn't find it, return a stock 404 response.</span>
|
61
|
+
573: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span>)
|
62
|
+
574: <span class="ruby-keyword kw">end</span>
|
63
|
+
575:
|
64
|
+
576: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
|
65
|
+
577: <span class="ruby-keyword kw">else</span>
|
66
|
+
578: <span class="ruby-comment cmt"># Parser is not done, queue up more data to read and continue parsing</span>
|
67
|
+
579: <span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CHUNK_SIZE</span>)
|
68
|
+
580: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_HEADER</span>
|
69
|
+
581: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpParserError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"HEADER is longer than allowed, aborting client early."</span>)
|
70
|
+
582: <span class="ruby-keyword kw">end</span>
|
71
|
+
583: <span class="ruby-keyword kw">end</span>
|
72
|
+
584: <span class="ruby-keyword kw">end</span>
|
73
|
+
585: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EINVAL</span>,<span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EBADF</span>
|
74
|
+
586: <span class="ruby-comment cmt"># ignored</span>
|
75
|
+
587: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpParserError</span>
|
76
|
+
588: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now}: BAD CLIENT (#{params[Const::HTTP_X_FORWARDED_FOR] || client.peeraddr.last}): #$!"</span>
|
77
|
+
589: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
|
78
|
+
590: <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-value str">'too many files'</span>)
|
79
|
+
591: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
|
80
|
+
592: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now}: ERROR: #$!"</span>
|
81
|
+
593: <span class="ruby-keyword kw">ensure</span>
|
82
|
+
594: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">closed?</span>
|
83
|
+
595: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Tempfile</span>
|
84
|
+
596: <span class="ruby-keyword kw">end</span>
|
85
|
+
597: <span class="ruby-keyword kw">end</span></pre>
|
25
86
|
</body>
|
26
87
|
</html>
|
@@ -5,59 +5,27 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>reap_dead_workers (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
625: <span class="ruby-keyword kw">end</span>
|
31
|
-
626:
|
32
|
-
627: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:started_on</span>] = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
33
|
-
628: <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">priority</span>=<span class="ruby-value">1</span>
|
34
|
-
629: <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">thread</span>)
|
35
|
-
630:
|
36
|
-
631: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@timeout</span><span class="ruby-operator">/</span><span class="ruby-value">100</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@timeout</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
37
|
-
632: <span class="ruby-keyword kw">end</span>
|
38
|
-
633: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
|
39
|
-
634: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
40
|
-
635: <span class="ruby-keyword kw">break</span>
|
41
|
-
636: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
|
42
|
-
637: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Too many open files. Try increasing ulimits."</span>
|
43
|
-
638: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
|
44
|
-
639: <span class="ruby-keyword kw">end</span>
|
45
|
-
640: <span class="ruby-keyword kw">end</span>
|
46
|
-
641:
|
47
|
-
642: <span class="ruby-comment cmt"># troll through the threads that are waiting and kill any that take too long</span>
|
48
|
-
643: <span class="ruby-comment cmt"># TODO: Allow for death time to be set if people ask for it.</span>
|
49
|
-
644: <span class="ruby-ivar">@death_time</span> = <span class="ruby-value">10</span>
|
50
|
-
645: <span class="ruby-identifier">shutdown_start</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
51
|
-
646:
|
52
|
-
647: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
53
|
-
648: <span class="ruby-identifier">waited_for</span> = (<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">shutdown_start</span>).<span class="ruby-identifier">ceil</span>
|
54
|
-
649: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"Shutdown waited #{waited_for} for #{@workers.list.length} requests, could take #{@death_time + @timeout} seconds.\r"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
55
|
-
650: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
|
56
|
-
651: <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>)
|
57
|
-
652: <span class="ruby-keyword kw">end</span>
|
58
|
-
653: <span class="ruby-keyword kw">end</span>
|
59
|
-
654:
|
60
|
-
655: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
|
61
|
-
656: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 603</span>
|
14
|
+
603: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-identifier">reason</span>=<span class="ruby-value str">'unknown'</span>)
|
15
|
+
604: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
16
|
+
605: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{Time.now}: Reaping #{@workers.list.length} threads for slow workers because of '#{reason}'"</span>
|
17
|
+
606: <span class="ruby-identifier">mark</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
18
|
+
607: <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span>
|
19
|
+
608: <span class="ruby-identifier">w</span>[<span class="ruby-identifier">:started_on</span>] = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">w</span>[<span class="ruby-identifier">:started_on</span>]
|
20
|
+
609:
|
21
|
+
610: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mark</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">w</span>[<span class="ruby-identifier">:started_on</span>] <span class="ruby-operator">></span> <span class="ruby-ivar">@death_time</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@timeout</span>
|
22
|
+
611: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Thread #{w.inspect} is too old, killing."</span>
|
23
|
+
612: <span class="ruby-identifier">w</span>.<span class="ruby-identifier">raise</span>(<span class="ruby-constant">TimeoutError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Timed out thread."</span>))
|
24
|
+
613: <span class="ruby-keyword kw">end</span>
|
25
|
+
614: <span class="ruby-keyword kw">end</span>
|
26
|
+
615: <span class="ruby-keyword kw">end</span>
|
27
|
+
616:
|
28
|
+
617: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">length</span>
|
29
|
+
618: <span class="ruby-keyword kw">end</span></pre>
|
62
30
|
</body>
|
63
31
|
</html>
|
@@ -5,30 +5,17 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>graceful_shutdown (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
671: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path_info</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">script_name</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SLASH</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">path_info</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SLASH</span>)
|
21
|
-
672: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">in_front</span>
|
22
|
-
673: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">handler</span>)
|
23
|
-
674: <span class="ruby-keyword kw">else</span>
|
24
|
-
675: <span class="ruby-identifier">handlers</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">handler</span>
|
25
|
-
676: <span class="ruby-keyword kw">end</span>
|
26
|
-
677: <span class="ruby-keyword kw">else</span>
|
27
|
-
678: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, [<span class="ruby-identifier">handler</span>])
|
28
|
-
679: <span class="ruby-keyword kw">end</span>
|
29
|
-
680: <span class="ruby-keyword kw">end</span>
|
30
|
-
681:
|
31
|
-
682: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">listener</span> = <span class="ruby-keyword kw">self</span>
|
32
|
-
683: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 624</span>
|
14
|
+
624: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">graceful_shutdown</span>
|
15
|
+
625: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-value str">"shutdown"</span>) <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
16
|
+
626: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"Waiting for #{@workers.list.length} requests to finish, could take #{@death_time + @timeout} seconds."</span>
|
17
|
+
627: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@death_time</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span>
|
18
|
+
628: <span class="ruby-keyword kw">end</span>
|
19
|
+
629: <span class="ruby-keyword kw">end</span></pre>
|
33
20
|
</body>
|
34
21
|
</html>
|
@@ -5,14 +5,47 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>run (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <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 634</span>
|
14
|
+
634: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
15
|
+
635: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
|
16
|
+
636:
|
17
|
+
637: <span class="ruby-ivar">@acceptor</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
18
|
+
638: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
19
|
+
639: <span class="ruby-keyword kw">begin</span>
|
20
|
+
640: <span class="ruby-identifier">client</span> = <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
|
21
|
+
641: <span class="ruby-identifier">worker_list</span> = <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">list</span>
|
22
|
+
642:
|
23
|
+
643: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">worker_list</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@num_processors</span>
|
24
|
+
644: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Server overloaded with #{worker_list.length} processors (#@num_processors max). Dropping connection."</span>
|
25
|
+
645: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
26
|
+
646: <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-value str">"max processors"</span>)
|
27
|
+
647: <span class="ruby-keyword kw">else</span>
|
28
|
+
648: <span class="ruby-identifier">thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>) }
|
29
|
+
649:
|
30
|
+
650: <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">abort_on_exception</span> = <span class="ruby-keyword kw">true</span>
|
31
|
+
651: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:started_on</span>] = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
32
|
+
652: <span class="ruby-ivar">@workers</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">thread</span>)
|
33
|
+
653:
|
34
|
+
654: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@timeout</span><span class="ruby-operator">/</span><span class="ruby-value">100</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@timeout</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
35
|
+
655: <span class="ruby-keyword kw">end</span>
|
36
|
+
656: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
|
37
|
+
657: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
38
|
+
658: <span class="ruby-keyword kw">break</span>
|
39
|
+
659: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
|
40
|
+
660: <span class="ruby-identifier">reap_dead_workers</span>(<span class="ruby-value str">"too many open files"</span>)
|
41
|
+
661: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
|
42
|
+
662: <span class="ruby-keyword kw">end</span>
|
43
|
+
663: <span class="ruby-keyword kw">end</span>
|
44
|
+
664:
|
45
|
+
665: <span class="ruby-identifier">graceful_shutdown</span>
|
46
|
+
666: <span class="ruby-keyword kw">end</span>
|
47
|
+
667:
|
48
|
+
668: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
|
49
|
+
669: <span class="ruby-keyword kw">end</span></pre>
|
17
50
|
</body>
|
18
51
|
</html>
|
@@ -5,18 +5,30 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>register (Mongrel::HttpServer)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 678</span>
|
14
|
+
678: <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>, <span class="ruby-identifier">in_front</span>=<span class="ruby-keyword kw">false</span>)
|
15
|
+
679: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handlers</span> = <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">uri</span>)
|
16
|
+
680:
|
17
|
+
681: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">handlers</span>
|
18
|
+
682: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, [<span class="ruby-identifier">handler</span>])
|
19
|
+
683: <span class="ruby-keyword kw">else</span>
|
20
|
+
684: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path_info</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">script_name</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SLASH</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">path_info</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SLASH</span>)
|
21
|
+
685: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">in_front</span>
|
22
|
+
686: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">handler</span>)
|
23
|
+
687: <span class="ruby-keyword kw">else</span>
|
24
|
+
688: <span class="ruby-identifier">handlers</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">handler</span>
|
25
|
+
689: <span class="ruby-keyword kw">end</span>
|
26
|
+
690: <span class="ruby-keyword kw">else</span>
|
27
|
+
691: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, [<span class="ruby-identifier">handler</span>])
|
28
|
+
692: <span class="ruby-keyword kw">end</span>
|
29
|
+
693: <span class="ruby-keyword kw">end</span>
|
30
|
+
694:
|
31
|
+
695: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">listener</span> = <span class="ruby-keyword kw">self</span>
|
32
|
+
696: <span class="ruby-keyword kw">end</span></pre>
|
21
33
|
</body>
|
22
34
|
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>unregister (Mongrel::HttpServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 701</span>
|
14
|
+
701: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
15
|
+
702: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
|
16
|
+
703: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>stop (Mongrel::HttpServer)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 707</span>
|
14
|
+
707: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
15
|
+
708: <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
|
+
709: <span class="ruby-identifier">exc</span> = <span class="ruby-constant">StopServer</span>.<span class="ruby-identifier">new</span>
|
17
|
+
710: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">raise</span>(<span class="ruby-identifier">exc</span>)
|
18
|
+
711: <span class="ruby-keyword kw">end</span>
|
19
|
+
712: <span class="ruby-identifier">stopper</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">10</span>
|
20
|
+
713: <span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|