mongrel 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/Rakefile +1 -1
  2. data/bin/mongrel_rails +1 -1
  3. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +6 -6
  4. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +28 -28
  5. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +26 -26
  6. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +17 -17
  7. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +24 -24
  8. data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +4 -4
  9. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000047.html +4 -4
  10. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000048.html +4 -4
  11. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000033.html +4 -4
  12. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000034.html +7 -7
  13. data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +3 -3
  14. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000049.html +17 -17
  15. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -7
  16. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000041.html +6 -6
  17. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000042.html +5 -5
  18. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000043.html +4 -4
  19. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +6 -6
  20. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html +7 -7
  21. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +6 -6
  22. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +24 -24
  23. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +50 -50
  24. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +9 -9
  25. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000031.html +4 -4
  26. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000032.html +4 -4
  27. data/doc/rdoc/created.rid +1 -1
  28. data/doc/rdoc/files/lib/mongrel_rb.html +2 -1
  29. data/examples/simpletest.rb +1 -1
  30. data/lib/mongrel.rb +1 -0
  31. metadata +2 -2
data/Rakefile CHANGED
@@ -31,6 +31,6 @@ setup_extension("http11", "http11")
31
31
 
32
32
  summary = "A small fast HTTP library and server that runs Rails, Camping, and Nitro apps."
33
33
  test_file = "test/test_ws.rb"
34
- setup_gem("mongrel", "0.3.2", "Zed A. Shaw", summary, ['mongrel_rails'], test_file) do |spec|
34
+ setup_gem("mongrel", "0.3.3", "Zed A. Shaw", summary, ['mongrel_rails'], test_file) do |spec|
35
35
  spec.add_dependency('daemons', '>= 0.4.2')
36
36
  end
@@ -125,7 +125,7 @@ class StartCommand < Mongrel::Command::Command
125
125
  # save this for later since daemonize will hose it
126
126
  if @daemon
127
127
  puts "Started Mongrel server in #@environment mode at #@address:#@port"
128
- Daemonize.daemonize(log_file=@log_file)
128
+ Daemonize.daemonize(log_file=File.join(@cwd, @log_file))
129
129
 
130
130
  # change back to the original starting directory
131
131
  Dir.chdir(@cwd)
@@ -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 470</span>
14
- 470: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">listing_allowed</span>=<span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">index_html</span>=<span class="ruby-value str">&quot;index.html&quot;</span>)
15
- 471: <span class="ruby-ivar">@path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
16
- 472: <span class="ruby-ivar">@listing_allowed</span>=<span class="ruby-identifier">listing_allowed</span>
17
- 473: <span class="ruby-ivar">@index_html</span> = <span class="ruby-identifier">index_html</span>
18
- 474: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 471</span>
14
+ 471: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">listing_allowed</span>=<span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">index_html</span>=<span class="ruby-value str">&quot;index.html&quot;</span>)
15
+ 472: <span class="ruby-ivar">@path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
16
+ 473: <span class="ruby-ivar">@listing_allowed</span>=<span class="ruby-identifier">listing_allowed</span>
17
+ 474: <span class="ruby-ivar">@index_html</span> = <span class="ruby-identifier">index_html</span>
18
+ 475: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -10,33 +10,33 @@
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 477</span>
14
- 477: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path_info</span>)
15
- 478: <span class="ruby-identifier">req</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>,<span class="ruby-identifier">path_info</span>), <span class="ruby-ivar">@path</span>)
16
- 479:
17
- 480: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@path</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">req</span>
18
- 481: <span class="ruby-comment cmt"># it exists and it's in the right location</span>
19
- 482: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">req</span>
20
- 483: <span class="ruby-comment cmt"># the request is for a directory</span>
21
- 484: <span class="ruby-identifier">index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">req</span>, <span class="ruby-ivar">@index_html</span>)
22
- 485: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">index</span>
23
- 486: <span class="ruby-comment cmt"># serve the index</span>
24
- 487: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">index</span>
25
- 488: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@listing_allows</span>
26
- 489: <span class="ruby-comment cmt"># serve the directory</span>
27
- 490: <span class="ruby-identifier">req</span>
28
- 491: <span class="ruby-keyword kw">else</span>
29
- 492: <span class="ruby-comment cmt"># do not serve anything</span>
30
- 493: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
31
- 494: <span class="ruby-keyword kw">end</span>
32
- 495: <span class="ruby-keyword kw">else</span>
33
- 496: <span class="ruby-comment cmt"># it's a file and it's there</span>
34
- 497: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">req</span>
35
- 498: <span class="ruby-keyword kw">end</span>
36
- 499: <span class="ruby-keyword kw">else</span>
37
- 500: <span class="ruby-comment cmt"># does not exist or isn't in the right spot</span>
38
- 501: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
39
- 502: <span class="ruby-keyword kw">end</span>
40
- 503: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 478</span>
14
+ 478: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path_info</span>)
15
+ 479: <span class="ruby-identifier">req</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>,<span class="ruby-identifier">path_info</span>), <span class="ruby-ivar">@path</span>)
16
+ 480:
17
+ 481: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@path</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">req</span>
18
+ 482: <span class="ruby-comment cmt"># it exists and it's in the right location</span>
19
+ 483: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">req</span>
20
+ 484: <span class="ruby-comment cmt"># the request is for a directory</span>
21
+ 485: <span class="ruby-identifier">index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">req</span>, <span class="ruby-ivar">@index_html</span>)
22
+ 486: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">index</span>
23
+ 487: <span class="ruby-comment cmt"># serve the index</span>
24
+ 488: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">index</span>
25
+ 489: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@listing_allows</span>
26
+ 490: <span class="ruby-comment cmt"># serve the directory</span>
27
+ 491: <span class="ruby-identifier">req</span>
28
+ 492: <span class="ruby-keyword kw">else</span>
29
+ 493: <span class="ruby-comment cmt"># do not serve anything</span>
30
+ 494: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
31
+ 495: <span class="ruby-keyword kw">end</span>
32
+ 496: <span class="ruby-keyword kw">else</span>
33
+ 497: <span class="ruby-comment cmt"># it's a file and it's there</span>
34
+ 498: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">req</span>
35
+ 499: <span class="ruby-keyword kw">end</span>
36
+ 500: <span class="ruby-keyword kw">else</span>
37
+ 501: <span class="ruby-comment cmt"># does not exist or isn't in the right spot</span>
38
+ 502: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
39
+ 503: <span class="ruby-keyword kw">end</span>
40
+ 504: <span class="ruby-keyword kw">end</span></pre>
41
41
  </body>
42
42
  </html>
@@ -10,31 +10,31 @@
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 510</span>
14
- 510: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_dir_listing</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">response</span>)
15
- 511: <span class="ruby-comment cmt"># take off any trailing / so the links come out right</span>
16
- 512: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">chop!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>[<span class="ruby-value">-1</span>]
17
- 513:
18
- 514: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@listing_allowed</span>
19
- 515: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">200</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
20
- 516: <span class="ruby-identifier">head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">&quot;text/html&quot;</span>
21
- 517: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;Directory Listing&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&quot;</span>
22
- 518: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">dir</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
23
- 519: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.&quot;</span>
24
- 520:
25
- 521: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;..&quot;</span>
26
- 522: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#{base}/#{child}\&quot;&gt;Up to parent..&lt;/a&gt;&lt;br/&gt;&quot;</span>
27
- 523: <span class="ruby-keyword kw">else</span>
28
- 524: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#{base}/#{child}\&quot;&gt;#{child}&lt;/a&gt;&lt;br/&gt;&quot;</span>
29
- 525: <span class="ruby-keyword kw">end</span>
30
- 526: <span class="ruby-keyword kw">end</span>
31
- 527: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;/body&gt;&lt;/html&gt;&quot;</span>
32
- 528: <span class="ruby-keyword kw">end</span>
33
- 529: <span class="ruby-keyword kw">else</span>
34
- 530: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">403</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
35
- 531: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;Directory listings not allowed&quot;</span>)
36
- 532: <span class="ruby-keyword kw">end</span>
37
- 533: <span class="ruby-keyword kw">end</span>
38
- 534: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 511</span>
14
+ 511: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_dir_listing</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">response</span>)
15
+ 512: <span class="ruby-comment cmt"># take off any trailing / so the links come out right</span>
16
+ 513: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">chop!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;/&quot;</span>[<span class="ruby-value">-1</span>]
17
+ 514:
18
+ 515: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@listing_allowed</span>
19
+ 516: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">200</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
20
+ 517: <span class="ruby-identifier">head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">&quot;text/html&quot;</span>
21
+ 518: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;Directory Listing&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&quot;</span>
22
+ 519: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">dir</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
23
+ 520: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.&quot;</span>
24
+ 521:
25
+ 522: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;..&quot;</span>
26
+ 523: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#{base}/#{child}\&quot;&gt;Up to parent..&lt;/a&gt;&lt;br/&gt;&quot;</span>
27
+ 524: <span class="ruby-keyword kw">else</span>
28
+ 525: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#{base}/#{child}\&quot;&gt;#{child}&lt;/a&gt;&lt;br/&gt;&quot;</span>
29
+ 526: <span class="ruby-keyword kw">end</span>
30
+ 527: <span class="ruby-keyword kw">end</span>
31
+ 528: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;/body&gt;&lt;/html&gt;&quot;</span>
32
+ 529: <span class="ruby-keyword kw">end</span>
33
+ 530: <span class="ruby-keyword kw">else</span>
34
+ 531: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">403</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
35
+ 532: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;Directory listings not allowed&quot;</span>)
36
+ 533: <span class="ruby-keyword kw">end</span>
37
+ 534: <span class="ruby-keyword kw">end</span>
38
+ 535: <span class="ruby-keyword kw">end</span></pre>
39
39
  </body>
40
40
  </html>
@@ -10,22 +10,22 @@
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 539</span>
14
- 539: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
15
- 540: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">200</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
16
- 541: <span class="ruby-comment cmt"># set the mime type from our map based on the ending</span>
17
- 542: <span class="ruby-identifier">dot_at</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value str">&quot;.&quot;</span>)
18
- 543: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dot_at</span>
19
- 544: <span class="ruby-identifier">ext</span> = <span class="ruby-identifier">req</span>[<span class="ruby-identifier">dot_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]
20
- 545: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
21
- 546: <span class="ruby-identifier">head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
22
- 547: <span class="ruby-keyword kw">end</span>
23
- 548: <span class="ruby-keyword kw">end</span>
24
- 549:
25
- 550: <span class="ruby-identifier">open</span>(<span class="ruby-identifier">req</span>, <span class="ruby-value str">&quot;rb&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
26
- 551: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>)
27
- 552: <span class="ruby-keyword kw">end</span>
28
- 553: <span class="ruby-keyword kw">end</span>
29
- 554: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 540</span>
14
+ 540: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
15
+ 541: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">200</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
16
+ 542: <span class="ruby-comment cmt"># set the mime type from our map based on the ending</span>
17
+ 543: <span class="ruby-identifier">dot_at</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value str">&quot;.&quot;</span>)
18
+ 544: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dot_at</span>
19
+ 545: <span class="ruby-identifier">ext</span> = <span class="ruby-identifier">req</span>[<span class="ruby-identifier">dot_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]
20
+ 546: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
21
+ 547: <span class="ruby-identifier">head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
22
+ 548: <span class="ruby-keyword kw">end</span>
23
+ 549: <span class="ruby-keyword kw">end</span>
24
+ 550:
25
+ 551: <span class="ruby-identifier">open</span>(<span class="ruby-identifier">req</span>, <span class="ruby-value str">&quot;rb&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
26
+ 552: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>)
27
+ 553: <span class="ruby-keyword kw">end</span>
28
+ 554: <span class="ruby-keyword kw">end</span>
29
+ 555: <span class="ruby-keyword kw">end</span></pre>
30
30
  </body>
31
31
  </html>
@@ -10,29 +10,29 @@
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 559</span>
14
- 559: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
- 560: <span class="ruby-identifier">req</span> = <span class="ruby-identifier">can_serve</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">'PATH_INFO'</span>]
16
- 561: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">req</span>
17
- 562: <span class="ruby-comment cmt"># not found, return a 404</span>
18
- 563: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">404</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
19
- 564: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;File not found&quot;</span>
20
- 565: <span class="ruby-keyword kw">end</span>
21
- 566: <span class="ruby-keyword kw">else</span>
22
- 567: <span class="ruby-keyword kw">begin</span>
23
- 568: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">req</span>
24
- 569: <span class="ruby-identifier">send_dir_listing</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;REQUEST_URI&quot;</span>],<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
25
- 570: <span class="ruby-keyword kw">else</span>
26
- 571: <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
27
- 572: <span class="ruby-keyword kw">end</span>
28
- 573: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
29
- 574: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">reset</span>
30
- 575: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">403</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
31
- 576: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Error accessing file: #{details}&quot;</span>
32
- 577: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</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>)
33
- 578: <span class="ruby-keyword kw">end</span>
34
- 579: <span class="ruby-keyword kw">end</span>
35
- 580: <span class="ruby-keyword kw">end</span>
36
- 581: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 560</span>
14
+ 560: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
+ 561: <span class="ruby-identifier">req</span> = <span class="ruby-identifier">can_serve</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">'PATH_INFO'</span>]
16
+ 562: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">req</span>
17
+ 563: <span class="ruby-comment cmt"># not found, return a 404</span>
18
+ 564: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">404</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
19
+ 565: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;File not found&quot;</span>
20
+ 566: <span class="ruby-keyword kw">end</span>
21
+ 567: <span class="ruby-keyword kw">else</span>
22
+ 568: <span class="ruby-keyword kw">begin</span>
23
+ 569: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">req</span>
24
+ 570: <span class="ruby-identifier">send_dir_listing</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;REQUEST_URI&quot;</span>],<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
25
+ 571: <span class="ruby-keyword kw">else</span>
26
+ 572: <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
27
+ 573: <span class="ruby-keyword kw">end</span>
28
+ 574: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
29
+ 575: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">reset</span>
30
+ 576: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">403</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
31
+ 577: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Error accessing file: #{details}&quot;</span>
32
+ 578: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</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>)
33
+ 579: <span class="ruby-keyword kw">end</span>
34
+ 580: <span class="ruby-keyword kw">end</span>
35
+ 581: <span class="ruby-keyword kw">end</span>
36
+ 582: <span class="ruby-keyword kw">end</span></pre>
37
37
  </body>
38
38
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 585</span>
14
- 585: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">DirHandler</span><span class="ruby-operator">::</span><span class="ruby-identifier">add_mime_type</span>(<span class="ruby-identifier">extension</span>, <span class="ruby-identifier">type</span>)
15
- 586: <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">extension</span>] = <span class="ruby-identifier">type</span>
16
- 587: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 586</span>
14
+ 586: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">DirHandler</span><span class="ruby-operator">::</span><span class="ruby-identifier">add_mime_type</span>(<span class="ruby-identifier">extension</span>, <span class="ruby-identifier">type</span>)
15
+ 587: <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">extension</span>] = <span class="ruby-identifier">type</span>
16
+ 588: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 431</span>
14
- 431: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
15
- 432: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
16
- 433: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 432</span>
14
+ 432: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
15
+ 433: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
16
+ 434: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 436</span>
14
- 436: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
- 437: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
16
- 438: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 437</span>
14
+ 437: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
+ 438: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
16
+ 439: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 171</span>
14
- 171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">out</span>)
15
- 172: <span class="ruby-ivar">@out</span> = <span class="ruby-identifier">out</span>
16
- 173: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 172</span>
14
+ 172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">out</span>)
15
+ 173: <span class="ruby-ivar">@out</span> = <span class="ruby-identifier">out</span>
16
+ 174: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -10,12 +10,12 @@
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 176</span>
14
- 176: <span class="ruby-keyword kw">def</span><span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span>)
15
- 177: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>)
16
- 178: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;: &quot;</span>)
17
- 179: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">value</span>)
18
- 180: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
19
- 181: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 177</span>
14
+ 177: <span class="ruby-keyword kw">def</span><span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span>)
15
+ 178: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>)
16
+ 179: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;: &quot;</span>)
17
+ 180: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">value</span>)
18
+ 181: <span class="ruby-ivar">@out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
19
+ 182: <span class="ruby-keyword kw">end</span></pre>
20
20
  </body>
21
21
  </html>
@@ -10,8 +10,8 @@
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 276</span>
14
- 276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
- 277: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 277</span>
14
+ 277: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
15
+ 278: <span class="ruby-keyword kw">end</span></pre>
16
16
  </body>
17
17
  </html>
@@ -10,22 +10,22 @@
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 142</span>
14
- 142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">initial_body</span>, <span class="ruby-identifier">socket</span>)
15
- 143: <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">initial_body</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>
16
- 144: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
17
- 145: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
18
- 146:
19
- 147: <span class="ruby-comment cmt"># fix up the CGI requirements</span>
20
- 148: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_LENGTH</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
21
- 149: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_TYPE</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_TYPE</span>]
22
- 150:
23
- 151: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
24
- 152: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
25
- 153: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
26
- 154: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">clen</span>
27
- 155: <span class="ruby-ivar">@body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">clen</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span>)
28
- 156: <span class="ruby-keyword kw">end</span>
29
- 157: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 143</span>
14
+ 143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">initial_body</span>, <span class="ruby-identifier">socket</span>)
15
+ 144: <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">initial_body</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>
16
+ 145: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
17
+ 146: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
18
+ 147:
19
+ 148: <span class="ruby-comment cmt"># fix up the CGI requirements</span>
20
+ 149: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_LENGTH</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
21
+ 150: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CONTENT_TYPE</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_TYPE</span>]
22
+ 151:
23
+ 152: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
24
+ 153: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
25
+ 154: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
26
+ 155: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">clen</span>
27
+ 156: <span class="ruby-ivar">@body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">clen</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">length</span>)
28
+ 157: <span class="ruby-keyword kw">end</span>
29
+ 158: <span class="ruby-keyword kw">end</span></pre>
30
30
  </body>
31
31
  </html>
@@ -10,12 +10,12 @@
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 220</span>
14
- 220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
- 221: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
- 222: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
- 223: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
- 224: <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
- 225: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 221</span>
14
+ 221: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">socket</span>)
15
+ 222: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
16
+ 223: <span class="ruby-ivar">@body</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
17
+ 224: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
18
+ 225: <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
+ 226: <span class="ruby-keyword kw">end</span></pre>
20
20
  </body>
21
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 231</span>
14
- 231: <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
- 232: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
16
- 233: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
- 234: <span class="ruby-identifier">finished</span>
18
- 235: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 232</span>
14
+ 232: <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
+ 233: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span>
16
+ 234: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@header</span>, <span class="ruby-ivar">@body</span>
17
+ 235: <span class="ruby-identifier">finished</span>
18
+ 236: <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 239</span>
14
- 239: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
- 240: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 241: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
- 242: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 240</span>
14
+ 240: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
+ 241: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 242: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
17
+ 243: <span class="ruby-keyword kw">end</span></pre>
18
18
  </body>
19
19
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 244</span>
14
- 244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
15
- 245: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;HTTP/1.1 #{@status.to_i} #{HTTP_STATUS_CODES[@status.to_i]}\r\nContent-Length:#{body.length}\r\nConnection: close\r\n&quot;</span>)
16
- 246: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 245</span>
14
+ 245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_status</span>
15
+ 246: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;HTTP/1.1 #{@status.to_i} #{HTTP_STATUS_CODES[@status.to_i]}\r\nContent-Length:#{body.length}\r\nConnection: close\r\n&quot;</span>)
16
+ 247: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </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 248</span>
14
- 248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
15
- 249: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
- 250: <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
- 251: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
18
- 252: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 249</span>
14
+ 249: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_header</span>
15
+ 250: <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>
16
+ 251: <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
+ 252: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
18
+ 253: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -10,12 +10,12 @@
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 254</span>
14
- 254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
15
- 255: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
16
- 256:
17
- 257: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
18
- 258: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
19
- 259: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 255</span>
14
+ 255: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>
15
+ 256: <span class="ruby-ivar">@body</span>.<span class="ruby-identifier">rewind</span>
16
+ 257:
17
+ 258: <span class="ruby-comment cmt"># connection: close is also added to ensure that the client does not pipeline.</span>
18
+ 259: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@body</span>.<span class="ruby-identifier">read</span>)
19
+ 260: <span class="ruby-keyword kw">end</span></pre>
20
20
  </body>
21
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 263</span>
14
- 263: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
- 264: <span class="ruby-identifier">send_status</span>
16
- 265: <span class="ruby-identifier">send_header</span>
17
- 266: <span class="ruby-identifier">send_body</span>
18
- 267: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 264</span>
14
+ 264: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finished</span>
15
+ 265: <span class="ruby-identifier">send_status</span>
16
+ 266: <span class="ruby-identifier">send_header</span>
17
+ 267: <span class="ruby-identifier">send_body</span>
18
+ 268: <span class="ruby-keyword kw">end</span></pre>
19
19
  </body>
20
20
  </html>
@@ -10,29 +10,29 @@
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 317</span>
14
- 317: <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
- 318: <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
- 319:
17
- 320: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
- 321: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
- 322: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
- 323: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
- 324: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
22
- 325: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
23
- 326:
24
- 327: <span class="ruby-ivar">@num_processors</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
25
- 328: <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>
26
- 329: <span class="ruby-keyword kw">begin</span>
27
- 330: <span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-ivar">@timeout</span>) <span class="ruby-keyword kw">do</span>
28
- 331: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
29
- 332: <span class="ruby-keyword kw">end</span>
30
- 333: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
31
- 334: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;WARNING: Request took longer than #@timeout second timeout&quot;</span>
32
- 335: <span class="ruby-keyword kw">end</span>
33
- 336: <span class="ruby-keyword kw">end</span>
34
- 337: <span class="ruby-keyword kw">end</span>
35
- 338: }
36
- 339: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 318</span>
14
+ 318: <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
+ 319: <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
+ 320:
17
+ 321: <span class="ruby-ivar">@classifier</span> = <span class="ruby-constant">URIClassifier</span>.<span class="ruby-identifier">new</span>
18
+ 322: <span class="ruby-ivar">@req_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
19
+ 323: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
20
+ 324: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
21
+ 325: <span class="ruby-ivar">@num_processors</span> = <span class="ruby-identifier">num_processors</span>
22
+ 326: <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
23
+ 327:
24
+ 328: <span class="ruby-ivar">@num_processors</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
25
+ 329: <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>
26
+ 330: <span class="ruby-keyword kw">begin</span>
27
+ 331: <span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-ivar">@timeout</span>) <span class="ruby-keyword kw">do</span>
28
+ 332: <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
29
+ 333: <span class="ruby-keyword kw">end</span>
30
+ 334: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
31
+ 335: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;WARNING: Request took longer than #@timeout second timeout&quot;</span>
32
+ 336: <span class="ruby-keyword kw">end</span>
33
+ 337: <span class="ruby-keyword kw">end</span>
34
+ 338: <span class="ruby-keyword kw">end</span>
35
+ 339: }
36
+ 340: <span class="ruby-keyword kw">end</span></pre>
37
37
  </body>
38
38
  </html>
@@ -10,55 +10,55 @@
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 347</span>
14
- 347: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
- 348: <span class="ruby-keyword kw">begin</span>
16
- 349: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
- 350: <span class="ruby-identifier">params</span> = {}
18
- 351: <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
- 352:
20
- 353: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
- 354: <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
- 355: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
- 356: <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
- 357:
25
- 358: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
- 359: <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
- 360: <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
- 361: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE_VALUE</span>
29
- 362: <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">client</span>.<span class="ruby-identifier">peeraddr</span>[<span class="ruby-value">3</span>]
30
- 363: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_NAME</span>]=<span class="ruby-ivar">@host</span>
31
- 364: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PORT</span>]=<span class="ruby-ivar">@port</span>
32
- 365: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL_VALUE</span>
33
- 366: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_SOFTWARE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MONGREL_VERSION</span>
34
- 367:
35
- 368: <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>)
36
- 369: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
37
- 370: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
38
- 371: <span class="ruby-keyword kw">else</span>
39
- 372: <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>)
40
- 373: <span class="ruby-keyword kw">end</span>
41
- 374:
42
- 375: <span class="ruby-keyword kw">break</span>
43
- 376: <span class="ruby-keyword kw">else</span>
44
- 377: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
45
- 378: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
46
- 379: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
47
- 380: <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>)
48
- 381: <span class="ruby-keyword kw">end</span>
49
- 382: <span class="ruby-keyword kw">end</span>
50
- 383: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
51
- 384: <span class="ruby-comment cmt"># ignored</span>
52
- 385: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
53
- 386: <span class="ruby-comment cmt"># ignored</span>
54
- 387: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
55
- 388: <span class="ruby-comment cmt"># ignored</span>
56
- 389: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
57
- 390: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
58
- 391: <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>)
59
- 392: <span class="ruby-keyword kw">ensure</span>
60
- 393: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
61
- 394: <span class="ruby-keyword kw">end</span>
62
- 395: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 348</span>
14
+ 348: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_client</span>(<span class="ruby-identifier">client</span>)
15
+ 349: <span class="ruby-keyword kw">begin</span>
16
+ 350: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpParser</span>.<span class="ruby-identifier">new</span>
17
+ 351: <span class="ruby-identifier">params</span> = {}
18
+ 352: <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
+ 353:
20
+ 354: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
+ 355: <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
+ 356: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
+ 357: <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
+ 358:
25
+ 359: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>
26
+ 360: <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
+ 361: <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
+ 362: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">GATEWAY_INTERFACE_VALUE</span>
29
+ 363: <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">client</span>.<span class="ruby-identifier">peeraddr</span>[<span class="ruby-value">3</span>]
30
+ 364: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_NAME</span>]=<span class="ruby-ivar">@host</span>
31
+ 365: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PORT</span>]=<span class="ruby-ivar">@port</span>
32
+ 366: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_PROTOCOL_VALUE</span>
33
+ 367: <span class="ruby-identifier">params</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SERVER_SOFTWARE</span>]=<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">MONGREL_VERSION</span>
34
+ 368:
35
+ 369: <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>)
36
+ 370: <span class="ruby-identifier">response</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client</span>)
37
+ 371: <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
38
+ 372: <span class="ruby-keyword kw">else</span>
39
+ 373: <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>)
40
+ 374: <span class="ruby-keyword kw">end</span>
41
+ 375:
42
+ 376: <span class="ruby-keyword kw">break</span>
43
+ 377: <span class="ruby-keyword kw">else</span>
44
+ 378: <span class="ruby-comment cmt"># gotta stream and read again until we can get the parser to be character safe</span>
45
+ 379: <span class="ruby-comment cmt"># TODO: make this more efficient since this means we're parsing a lot repeatedly</span>
46
+ 380: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
47
+ 381: <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>)
48
+ 382: <span class="ruby-keyword kw">end</span>
49
+ 383: <span class="ruby-keyword kw">end</span>
50
+ 384: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
51
+ 385: <span class="ruby-comment cmt"># ignored</span>
52
+ 386: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span>
53
+ 387: <span class="ruby-comment cmt"># ignored</span>
54
+ 388: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPIPE</span>
55
+ 389: <span class="ruby-comment cmt"># ignored</span>
56
+ 390: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>
57
+ 391: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR(#{details.class}): #{details}&quot;</span>
58
+ 392: <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>)
59
+ 393: <span class="ruby-keyword kw">ensure</span>
60
+ 394: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
61
+ 395: <span class="ruby-keyword kw">end</span>
62
+ 396: <span class="ruby-keyword kw">end</span></pre>
63
63
  </body>
64
64
  </html>
@@ -10,14 +10,14 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 399</span>
14
- 399: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
- 400: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
- 401: <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
- 402: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
18
- 403: <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>
19
- 404: <span class="ruby-keyword kw">end</span>
20
- 405: <span class="ruby-keyword kw">end</span>
21
- 406: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 400</span>
14
+ 400: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
15
+ 401: <span class="ruby-constant">BasicSocket</span>.<span class="ruby-identifier">do_not_reverse_lookup</span>=<span class="ruby-keyword kw">true</span>
16
+ 402: <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
+ 403: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
18
+ 404: <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>
19
+ 405: <span class="ruby-keyword kw">end</span>
20
+ 406: <span class="ruby-keyword kw">end</span>
21
+ 407: <span class="ruby-keyword kw">end</span></pre>
22
22
  </body>
23
23
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 412</span>
14
- 412: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
15
- 413: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
16
- 414: <span class="ruby-keyword kw">end</span></pre>
13
+ <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 413</span>
14
+ 413: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
15
+ 414: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">handler</span>)
16
+ 415: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 418</span>
14
- 418: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
15
- 419: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
16
- 420: <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">unregister</span>(<span class="ruby-identifier">uri</span>)
15
+ 420: <span class="ruby-ivar">@classifier</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">uri</span>)
16
+ 421: <span class="ruby-keyword kw">end</span></pre>
17
17
  </body>
18
18
  </html>
@@ -1 +1 @@
1
- Mon Feb 13 18:33:47 EST 2006
1
+ Tue Feb 14 08:17:08 EST 2006
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Feb 13 18:04:38 EST 2006</td>
59
+ <td>Tue Feb 14 08:08:55 EST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -77,6 +77,7 @@
77
77
  http11&nbsp;&nbsp;
78
78
  thread&nbsp;&nbsp;
79
79
  stringio&nbsp;&nbsp;
80
+ timeout&nbsp;&nbsp;
80
81
  </div>
81
82
  </div>
82
83
 
@@ -7,7 +7,7 @@ class SimpleHandler < Mongrel::HttpHandler
7
7
  response.start do |head,out|
8
8
  head["Content-Type"] = "text/html"
9
9
  results = "<html><body>Your request:<br /><pre>#{request.params.to_yaml}</pre><a href=\"/files\">View the files.</a></body></html>"
10
- if not request.params["HTTP_ACCEPT_ENCODING"] == "gzip,deflate"
10
+ if request.params["HTTP_ACCEPT_ENCODING"] == "gzip,deflate"
11
11
  head["Content-Encoding"] = "deflate"
12
12
  # send it back deflated
13
13
  out << Zlib::Deflate.deflate(results)
@@ -2,6 +2,7 @@ require 'socket'
2
2
  require 'http11'
3
3
  require 'thread'
4
4
  require 'stringio'
5
+ require 'timeout'
5
6
 
6
7
  # Mongrel module containing all of the classes (include C extensions) for running
7
8
  # a Mongrel web server. It contains a minimalist HTTP server with just enough
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: mongrel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.2
7
- date: 2006-02-13 00:00:00 -05:00
6
+ version: 0.3.3
7
+ date: 2006-02-14 00:00:00 -05:00
8
8
  summary: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.
9
9
  require_paths:
10
10
  - lib