mongrel 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/Rakefile +38 -15
  2. data/bin/mongrel_rails +13 -11
  3. data/doc/rdoc/classes/Mongrel.html +6 -1
  4. data/doc/rdoc/classes/Mongrel/CGIWrapper.html +49 -49
  5. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html +11 -5
  6. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html +34 -5
  7. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html +21 -6
  8. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000054.html → M000060.html} +0 -0
  9. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000055.html → M000061.html} +0 -0
  10. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/{M000056.html → M000062.html} +0 -0
  11. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000063.html +18 -0
  12. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000064.html +18 -0
  13. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000065.html +19 -0
  14. data/doc/rdoc/classes/Mongrel/Camping.html +177 -0
  15. data/doc/rdoc/classes/Mongrel/Camping.src/M000019.html +22 -0
  16. data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +165 -0
  17. data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000020.html +18 -0
  18. data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000021.html +27 -0
  19. data/doc/rdoc/classes/Mongrel/Command/Base.html +50 -50
  20. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html +11 -5
  21. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html +28 -5
  22. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html +5 -9
  23. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000009.html +5 -5
  24. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html +5 -5
  25. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html +9 -5
  26. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html +5 -5
  27. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000013.html +18 -0
  28. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000014.html +18 -0
  29. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000015.html +18 -0
  30. data/doc/rdoc/classes/Mongrel/Command/Registry.html +15 -15
  31. data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000013.html → M000016.html} +6 -6
  32. data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000014.html → M000017.html} +11 -11
  33. data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000015.html → M000018.html} +32 -32
  34. data/doc/rdoc/classes/Mongrel/Const.html +3 -3
  35. data/doc/rdoc/classes/Mongrel/DirHandler.html +31 -31
  36. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000023.html → M000029.html} +0 -0
  37. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000024.html → M000030.html} +0 -0
  38. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000025.html → M000031.html} +0 -0
  39. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000026.html → M000032.html} +0 -0
  40. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000027.html → M000033.html} +0 -0
  41. data/doc/rdoc/classes/Mongrel/DirHandler.src/{M000028.html → M000034.html} +0 -0
  42. data/doc/rdoc/classes/Mongrel/Error404Handler.html +10 -10
  43. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000060.html → M000066.html} +0 -0
  44. data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000061.html → M000067.html} +0 -0
  45. data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
  46. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000035.html → M000041.html} +4 -4
  47. data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000036.html → M000042.html} +7 -7
  48. data/doc/rdoc/classes/Mongrel/HttpHandler.html +5 -5
  49. data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000037.html → M000043.html} +0 -0
  50. data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
  51. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000022.html +6 -6
  52. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000017.html → M000023.html} +0 -0
  53. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000018.html → M000024.html} +0 -0
  54. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000019.html → M000025.html} +0 -0
  55. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000020.html → M000026.html} +0 -0
  56. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000021.html → M000027.html} +0 -0
  57. data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000016.html → M000028.html} +6 -6
  58. data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
  59. data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000062.html → M000068.html} +24 -24
  60. data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
  61. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +8 -7
  62. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000039.html → M000045.html} +6 -6
  63. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000040.html → M000046.html} +5 -5
  64. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000047.html} +5 -5
  65. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000048.html} +6 -6
  66. data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000049.html} +6 -6
  67. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000050.html +20 -0
  68. data/doc/rdoc/classes/Mongrel/HttpServer.html +33 -33
  69. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000029.html → M000035.html} +22 -22
  70. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000030.html → M000036.html} +43 -43
  71. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000037.html} +34 -34
  72. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000038.html} +4 -4
  73. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000033.html → M000039.html} +4 -4
  74. data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000034.html → M000040.html} +9 -9
  75. data/doc/rdoc/classes/Mongrel/URIClassifier.html +30 -30
  76. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000045.html → M000051.html} +4 -4
  77. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000046.html → M000052.html} +4 -4
  78. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000047.html → M000053.html} +0 -0
  79. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000048.html → M000054.html} +0 -0
  80. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000049.html → M000055.html} +0 -0
  81. data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000050.html → M000056.html} +0 -0
  82. data/doc/rdoc/classes/RailsHandler.html +30 -10
  83. data/doc/rdoc/classes/RailsHandler.src/{M000001.html → M000003.html} +8 -8
  84. data/doc/rdoc/classes/RailsHandler.src/{M000002.html → M000004.html} +34 -34
  85. data/doc/rdoc/classes/RailsHandler.src/M000005.html +23 -0
  86. data/doc/rdoc/classes/TCPServer.html +173 -0
  87. data/doc/rdoc/classes/TCPServer.src/M000001.html +19 -0
  88. data/doc/rdoc/created.rid +1 -1
  89. data/doc/rdoc/files/lib/mongrel/camping_rb.html +108 -0
  90. data/doc/rdoc/files/lib/mongrel/command_rb.html +3 -2
  91. data/doc/rdoc/files/lib/mongrel/{plugins_rb.html → init_rb.html} +5 -4
  92. data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -1
  93. data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +109 -0
  94. data/doc/rdoc/files/lib/mongrel_rb.html +2 -2
  95. data/doc/rdoc/fr_class_index.html +3 -0
  96. data/doc/rdoc/fr_file_index.html +3 -1
  97. data/doc/rdoc/fr_method_index.html +68 -62
  98. data/examples/camping/blog.rb +22 -37
  99. data/examples/camping/tepee.rb +3 -23
  100. data/lib/mongrel.rb +3 -4
  101. data/lib/mongrel/camping.rb +64 -0
  102. data/lib/mongrel/command.rb +3 -2
  103. data/lib/mongrel/{plugins.rb → init.rb} +1 -1
  104. data/lib/mongrel/rails.rb +16 -6
  105. data/lib/mongrel/tcphack.rb +12 -0
  106. data/tools/rakehelp.rb +10 -12
  107. metadata +74 -58
  108. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -24
  109. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -47
  110. data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -34
  111. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000003.html +0 -24
  112. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000004.html +0 -41
  113. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000005.html +0 -18
  114. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000038.html +0 -21
@@ -5,16 +5,17 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>finished (Mongrel::HttpResponse)</title>
8
+ <title>new (Mongrel::HttpResponse)</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 302</span>
14
- 302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
- 303: <span class="ruby-identifier">send_status</span>
16
- 304: <span class="ruby-identifier">send_header</span>
17
- 305: <span class="ruby-identifier">send_body</span>
18
- 306: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 260</span>
14
+ 260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
+ 261: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
+ 262: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
+ 263: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
+ 264: <span class="ruby-ivar">@header</span> = <span class="ruby-constant">HeaderOut</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>)
19
+ 265: <span class="ruby-keyword kw">end</span></pre>
19
20
  </body>
20
21
  </html>
@@ -10,11 +10,11 @@
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 270</span>
14
- 270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">status</span>=<span class="ruby-value">200</span>)
15
- 271: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
16
- 272: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
- 273: <span class="ruby-identifier">finished</span>
18
- 274: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 271</span>
14
+ 271: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">status</span>=<span class="ruby-value">200</span>)
15
+ 272: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
16
+ 273: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
+ 274: <span class="ruby-identifier">finished</span>
18
+ 275: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -10,10 +10,10 @@
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 278</span>
14
- 278: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
- 279: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 280: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
- 281: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 279</span>
14
+ 279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
+ 280: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 281: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
+ 282: <span class="ruby-keyword kw">end</span></pre>
18
18
  </body>
19
19
  </html>
@@ -10,10 +10,10 @@
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 283</span>
14
- 283: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
15
- 284: <span class="ruby-identifier">status</span> = <span class="ruby-node">&quot;HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status]}\r\nContent-Length: #{@body.length}\r\nConnection: close\r\n&quot;</span>
16
- 285: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">status</span>)
17
- 286: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 284</span>
14
+ 284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
15
+ 285: <span class="ruby-identifier">status</span> = <span class="ruby-node">&quot;HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status]}\r\nContent-Length: #{@body.length}\r\nConnection: close\r\n&quot;</span>
16
+ 286: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">status</span>)
17
+ 287: <span class="ruby-keyword kw">end</span></pre>
18
18
  </body>
19
19
  </html>
@@ -10,11 +10,11 @@
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 288</span>
14
- 288: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
15
- 289: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 290: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">read</span>)
17
- 291: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
18
- 292: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 289</span>
14
+ 289: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
15
+ 290: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 291: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">read</span>)
17
+ 292: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
18
+ 293: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -10,11 +10,11 @@
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 294</span>
14
- 294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
15
- 295: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
16
- 296: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
17
- 297: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
18
- 298: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 295</span>
14
+ 295: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
15
+ 296: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
16
+ 297: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
17
+ 298: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
18
+ 299: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -0,0 +1,20 @@
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>finished (Mongrel::HttpResponse)</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 303</span>
14
+ 303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
+ 304: <span class="ruby-identifier">send_status</span>
16
+ 305: <span class="ruby-identifier">send_header</span>
17
+ 306: <span class="ruby-identifier">send_body</span>
18
+ 307: <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -85,7 +85,7 @@ Mognrel::HttpParser and <a
85
85
  href="URIClassifier.html">Mongrel::URIClassifier</a> make up the majority
86
86
  of how the server functions. It&#8217;s a very simple class that just has a
87
87
  thread accepting connections and a simple <a
88
- href="HttpServer.html#M000030">HttpServer.process_client</a> function to do
88
+ href="HttpServer.html#M000036">HttpServer.process_client</a> function to do
89
89
  the heavy lifting with the IO and Ruby.
90
90
  </p>
91
91
  <p>
@@ -119,12 +119,12 @@ finally useful.
119
119
  <h3 class="section-bar">Methods</h3>
120
120
 
121
121
  <div class="name-list">
122
- <a href="#M000029">new</a>&nbsp;&nbsp;
123
- <a href="#M000030">process_client</a>&nbsp;&nbsp;
124
- <a href="#M000032">register</a>&nbsp;&nbsp;
125
- <a href="#M000031">run</a>&nbsp;&nbsp;
126
- <a href="#M000034">stop</a>&nbsp;&nbsp;
127
- <a href="#M000033">unregister</a>&nbsp;&nbsp;
122
+ <a href="#M000035">new</a>&nbsp;&nbsp;
123
+ <a href="#M000036">process_client</a>&nbsp;&nbsp;
124
+ <a href="#M000038">register</a>&nbsp;&nbsp;
125
+ <a href="#M000037">run</a>&nbsp;&nbsp;
126
+ <a href="#M000040">stop</a>&nbsp;&nbsp;
127
+ <a href="#M000039">unregister</a>&nbsp;&nbsp;
128
128
  </div>
129
129
  </div>
130
130
 
@@ -159,12 +159,12 @@ finally useful.
159
159
  <div id="methods">
160
160
  <h3 class="section-bar">Public Class methods</h3>
161
161
 
162
- <div id="method-M000029" class="method-detail">
163
- <a name="M000029"></a>
162
+ <div id="method-M000035" class="method-detail">
163
+ <a name="M000035"></a>
164
164
 
165
165
  <div class="method-heading">
166
- <a href="HttpServer.src/M000029.html" target="Code" class="method-signature"
167
- onclick="popupCode('HttpServer.src/M000029.html');return false;">
166
+ <a href="HttpServer.src/M000035.html" target="Code" class="method-signature"
167
+ onclick="popupCode('HttpServer.src/M000035.html');return false;">
168
168
  <span class="method-name">new</span><span class="method-args">(host, port, num_processors=20, timeout=120)</span>
169
169
  </a>
170
170
  </div>
@@ -195,12 +195,12 @@ tuned your stuff of course).
195
195
 
196
196
  <h3 class="section-bar">Public Instance methods</h3>
197
197
 
198
- <div id="method-M000030" class="method-detail">
199
- <a name="M000030"></a>
198
+ <div id="method-M000036" class="method-detail">
199
+ <a name="M000036"></a>
200
200
 
201
201
  <div class="method-heading">
202
- <a href="HttpServer.src/M000030.html" target="Code" class="method-signature"
203
- onclick="popupCode('HttpServer.src/M000030.html');return false;">
202
+ <a href="HttpServer.src/M000036.html" target="Code" class="method-signature"
203
+ onclick="popupCode('HttpServer.src/M000036.html');return false;">
204
204
  <span class="method-name">process_client</span><span class="method-args">(client)</span>
205
205
  </a>
206
206
  </div>
@@ -217,12 +217,12 @@ crack at it.
217
217
  </div>
218
218
  </div>
219
219
 
220
- <div id="method-M000032" class="method-detail">
221
- <a name="M000032"></a>
220
+ <div id="method-M000038" class="method-detail">
221
+ <a name="M000038"></a>
222
222
 
223
223
  <div class="method-heading">
224
- <a href="HttpServer.src/M000032.html" target="Code" class="method-signature"
225
- onclick="popupCode('HttpServer.src/M000032.html');return false;">
224
+ <a href="HttpServer.src/M000038.html" target="Code" class="method-signature"
225
+ onclick="popupCode('HttpServer.src/M000038.html');return false;">
226
226
  <span class="method-name">register</span><span class="method-args">(uri, handler)</span>
227
227
  </a>
228
228
  </div>
@@ -233,18 +233,18 @@ Simply registers a handler with the internal <a
233
233
  href="URIClassifier.html">URIClassifier</a>. When the URI is found in the
234
234
  prefix of a request then your handler&#8217;s HttpHandler::process method
235
235
  is called. See <a
236
- href="URIClassifier.html#M000048">Mongrel::URIClassifier#register</a> for
236
+ href="URIClassifier.html#M000054">Mongrel::URIClassifier#register</a> for
237
237
  more information.
238
238
  </p>
239
239
  </div>
240
240
  </div>
241
241
 
242
- <div id="method-M000031" class="method-detail">
243
- <a name="M000031"></a>
242
+ <div id="method-M000037" class="method-detail">
243
+ <a name="M000037"></a>
244
244
 
245
245
  <div class="method-heading">
246
- <a href="HttpServer.src/M000031.html" target="Code" class="method-signature"
247
- onclick="popupCode('HttpServer.src/M000031.html');return false;">
246
+ <a href="HttpServer.src/M000037.html" target="Code" class="method-signature"
247
+ onclick="popupCode('HttpServer.src/M000037.html');return false;">
248
248
  <span class="method-name">run</span><span class="method-args">()</span>
249
249
  </a>
250
250
  </div>
@@ -258,12 +258,12 @@ later.
258
258
  </div>
259
259
  </div>
260
260
 
261
- <div id="method-M000034" class="method-detail">
262
- <a name="M000034"></a>
261
+ <div id="method-M000040" class="method-detail">
262
+ <a name="M000040"></a>
263
263
 
264
264
  <div class="method-heading">
265
- <a href="HttpServer.src/M000034.html" target="Code" class="method-signature"
266
- onclick="popupCode('HttpServer.src/M000034.html');return false;">
265
+ <a href="HttpServer.src/M000040.html" target="Code" class="method-signature"
266
+ onclick="popupCode('HttpServer.src/M000040.html');return false;">
267
267
  <span class="method-name">stop</span><span class="method-args">()</span>
268
268
  </a>
269
269
  </div>
@@ -276,12 +276,12 @@ the request queue before finally exiting.
276
276
  </div>
277
277
  </div>
278
278
 
279
- <div id="method-M000033" class="method-detail">
280
- <a name="M000033"></a>
279
+ <div id="method-M000039" class="method-detail">
280
+ <a name="M000039"></a>
281
281
 
282
282
  <div class="method-heading">
283
- <a href="HttpServer.src/M000033.html" target="Code" class="method-signature"
284
- onclick="popupCode('HttpServer.src/M000033.html');return false;">
283
+ <a href="HttpServer.src/M000039.html" target="Code" class="method-signature"
284
+ onclick="popupCode('HttpServer.src/M000039.html');return false;">
285
285
  <span class="method-name">unregister</span><span class="method-args">(uri)</span>
286
286
  </a>
287
287
  </div>
@@ -289,7 +289,7 @@ the request queue before finally exiting.
289
289
  <div class="method-description">
290
290
  <p>
291
291
  Removes any handler registered at the given URI. See <a
292
- href="URIClassifier.html#M000049">Mongrel::URIClassifier#unregister</a> for
292
+ href="URIClassifier.html#M000055">Mongrel::URIClassifier#unregister</a> for
293
293
  more information.
294
294
  </p>
295
295
  </div>
@@ -10,27 +10,27 @@
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 345</span>
14
- 345: <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">20</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-value">120</span>)
15
- 346: <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
- 347:
17
- 348: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
- 349: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
- 350: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
- 351: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
- 352: <span class="ruby-ivar">@processors</span> = []
22
- 353:
23
- 354: <span class="ruby-comment cmt"># create the worker threads</span>
24
- 355: <span class="ruby-identifier">num_processors</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
25
- 356: <span class="ruby-ivar">@processors</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
26
- 357: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">client</span> = <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">deq</span>
27
- 358: <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">timeout</span>) <span class="ruby-keyword kw">do</span>
28
- 359: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
29
- 360: <span class="ruby-keyword kw">end</span>
30
- 361: <span class="ruby-keyword kw">end</span>
31
- 362: <span class="ruby-keyword kw">end</span>
32
- 363: <span class="ruby-keyword kw">end</span>
33
- 364:
34
- 365: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 346</span>
14
+ 346: <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">20</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-value">120</span>)
15
+ 347: <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
+ 348:
17
+ 349: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
+ 350: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
+ 351: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
+ 352: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
+ 353: <span class="ruby-ivar">@processors</span> = []
22
+ 354:
23
+ 355: <span class="ruby-comment cmt"># create the worker threads</span>
24
+ 356: <span class="ruby-identifier">num_processors</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
25
+ 357: <span class="ruby-ivar">@processors</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
26
+ 358: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">client</span> = <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">deq</span>
27
+ 359: <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">timeout</span>) <span class="ruby-keyword kw">do</span>
28
+ 360: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
29
+ 361: <span class="ruby-keyword kw">end</span>
30
+ 362: <span class="ruby-keyword kw">end</span>
31
+ 363: <span class="ruby-keyword kw">end</span>
32
+ 364: <span class="ruby-keyword kw">end</span>
33
+ 365:
34
+ 366: <span class="ruby-keyword kw">end</span></pre>
35
35
  </body>
36
36
  </html>
@@ -10,48 +10,48 @@
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 373</span>
14
- 373: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
- 374: <span class="ruby-keyword kw">begin</span>
16
- 375: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
- 376: <span class="ruby-identifier">params</span> = {}
18
- 377: <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>)
19
- 378:
20
- 379: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
- 380: <span class="ruby-identifier">nread</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>)
22
- 381: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
- 382: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handler</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>])
24
- 383:
25
- 384: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
- 385: <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>
27
- 386: <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>
28
- 387: <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">nread</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>], <span class="ruby-identifier">client</span>)
29
- 388: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
30
- 389: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
31
- 390: <span class="ruby-keyword kw">else</span>
32
- 391: <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>)
33
- 392: <span class="ruby-keyword kw">end</span>
34
- 393:
35
- 394: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
36
- 395: <span class="ruby-keyword kw">else</span>
37
- 396: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
38
- 397: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
39
- 398: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
40
- 399: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</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>)
41
- 400: <span class="ruby-keyword kw">end</span>
42
- 401: <span class="ruby-keyword kw">end</span>
43
- 402: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
44
- 403: <span class="ruby-comment cmt"># ignored</span>
45
- 404: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
46
- 405: <span class="ruby-comment cmt"># ignored</span>
47
- 406: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
48
- 407: <span class="ruby-comment cmt"># ignored</span>
49
- 408: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
50
- 409: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
51
- 410: <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">&quot;\n&quot;</span>)
52
- 411: <span class="ruby-keyword kw">ensure</span>
53
- 412: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
54
- 413: <span class="ruby-keyword kw">end</span>
55
- 414: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 374</span>
14
+ 374: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
+ 375: <span class="ruby-keyword kw">begin</span>
16
+ 376: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
+ 377: <span class="ruby-identifier">params</span> = {}
18
+ 378: <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>)
19
+ 379:
20
+ 380: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
+ 381: <span class="ruby-identifier">nread</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>)
22
+ 382: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
+ 383: <span class="ruby-identifier">script_name</span>, <span class="ruby-identifier">path_info</span>, <span class="ruby-identifier">handler</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>])
24
+ 384:
25
+ 385: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
+ 386: <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>
27
+ 387: <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>
28
+ 388: <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">nread</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span>], <span class="ruby-identifier">client</span>)
29
+ 389: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
30
+ 390: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
31
+ 391: <span class="ruby-keyword kw">else</span>
32
+ 392: <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>)
33
+ 393: <span class="ruby-keyword kw">end</span>
34
+ 394:
35
+ 395: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt">#done</span>
36
+ 396: <span class="ruby-keyword kw">else</span>
37
+ 397: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
38
+ 398: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
39
+ 399: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
40
+ 400: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</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>)
41
+ 401: <span class="ruby-keyword kw">end</span>
42
+ 402: <span class="ruby-keyword kw">end</span>
43
+ 403: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
44
+ 404: <span class="ruby-comment cmt"># ignored</span>
45
+ 405: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
46
+ 406: <span class="ruby-comment cmt"># ignored</span>
47
+ 407: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
48
+ 408: <span class="ruby-comment cmt"># ignored</span>
49
+ 409: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
50
+ 410: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
51
+ 411: <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">&quot;\n&quot;</span>)
52
+ 412: <span class="ruby-keyword kw">ensure</span>
53
+ 413: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
54
+ 414: <span class="ruby-keyword kw">end</span>
55
+ 415: <span class="ruby-keyword kw">end</span></pre>
56
56
  </body>
57
57
  </html>
@@ -10,39 +10,39 @@
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 418</span>
14
- 418: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
- 419: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
- 420: <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>
17
- 421: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>] = <span class="ruby-keyword kw">false</span>
18
- 422:
19
- 423: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>]
20
- 424: <span class="ruby-keyword kw">begin</span>
21
- 425: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
22
- 426: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
23
- 427: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Server stopped. Exiting.&quot;</span>
24
- 428: <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>
25
- 429: <span class="ruby-keyword kw">break</span>
26
- 430: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
27
- 431: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Too many open files. Try increasing ulimits.&quot;</span>
28
- 432: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
29
- 433: <span class="ruby-keyword kw">end</span>
30
- 434: <span class="ruby-keyword kw">end</span>
31
- 435:
32
- 436: <span class="ruby-comment cmt"># now that processing is done we feed enough false onto the request queue to get</span>
33
- 437: <span class="ruby-comment cmt"># each processor to exit and stop processing.</span>
34
- 438: <span class="ruby-ivar">@processors</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> { <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">false</span> }
35
- 439:
36
- 440: <span class="ruby-comment cmt"># finally we wait until the queue is empty</span>
37
- 441: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
38
- 442: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Shutdown waiting for #{@req_queue.length} requests&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
39
- 443: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
40
- 444: <span class="ruby-keyword kw">end</span>
41
- 445: <span class="ruby-keyword kw">end</span>
42
- 446:
43
- 447: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
44
- 448:
45
- 449: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
46
- 450: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 419</span>
14
+ 419: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
+ 420: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
+ 421: <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>
17
+ 422: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>] = <span class="ruby-keyword kw">false</span>
18
+ 423:
19
+ 424: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:stopped</span>]
20
+ 425: <span class="ruby-keyword kw">begin</span>
21
+ 426: <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">accept</span>
22
+ 427: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StopServer</span>
23
+ 428: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Server stopped. Exiting.&quot;</span>
24
+ 429: <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>
25
+ 430: <span class="ruby-keyword kw">break</span>
26
+ 431: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EMFILE</span>
27
+ 432: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Too many open files. Try increasing ulimits.&quot;</span>
28
+ 433: <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
29
+ 434: <span class="ruby-keyword kw">end</span>
30
+ 435: <span class="ruby-keyword kw">end</span>
31
+ 436:
32
+ 437: <span class="ruby-comment cmt"># now that processing is done we feed enough false onto the request queue to get</span>
33
+ 438: <span class="ruby-comment cmt"># each processor to exit and stop processing.</span>
34
+ 439: <span class="ruby-ivar">@processors</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> { <span class="ruby-ivar">@req_queue</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">false</span> }
35
+ 440:
36
+ 441: <span class="ruby-comment cmt"># finally we wait until the queue is empty</span>
37
+ 442: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
38
+ 443: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Shutdown waiting for #{@req_queue.length} requests&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@req_queue</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
39
+ 444: <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span>
40
+ 445: <span class="ruby-keyword kw">end</span>
41
+ 446: <span class="ruby-keyword kw">end</span>
42
+ 447:
43
+ 448: <span class="ruby-ivar">@acceptor</span>.<span class="ruby-identifier">priority</span> = <span class="ruby-value">1</span>
44
+ 449:
45
+ 450: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@acceptor</span>
46
+ 451: <span class="ruby-keyword kw">end</span></pre>
47
47
  </body>
48
48
  </html>