mongrel 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/bin/mongrel_rails +1 -1
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +6 -6
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +28 -28
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +26 -26
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +17 -17
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +24 -24
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000047.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000048.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000033.html +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000034.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +3 -3
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000049.html +17 -17
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000041.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000042.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000043.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +24 -24
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +50 -50
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +9 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000031.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000032.html +4 -4
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -1
- data/examples/simpletest.rb +1 -1
- data/lib/mongrel.rb +1 -0
- 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.
|
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
|
data/bin/mongrel_rails
CHANGED
@@ -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
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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">"index.html"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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">"/"</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">"text/html"</span>
|
21
|
+
518: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"<html><head><title>Directory Listing</title></head><body>"</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">"."</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">".."</span>
|
26
|
+
523: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"<a href=\"#{base}/#{child}\">Up to parent..</a><br/>"</span>
|
27
|
+
524: <span class="ruby-keyword kw">else</span>
|
28
|
+
525: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"<a href=\"#{base}/#{child}\">#{child}</a><br/>"</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"><<</span> <span class="ruby-value str">"</body></html>"</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">"Directory listings not allowed"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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">"."</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">"rb"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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"><<</span> <span class="ruby-value str">"File not found"</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">"REQUEST_URI"</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">></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"><<</span> <span class="ruby-node">"Error accessing file: #{details}"</span>
|
32
|
+
578: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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">": "</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">"\r\n"</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
|
14
|
-
|
15
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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">""</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"><</span> <span class="ruby-identifier">clen</span>
|
27
|
+
156: <span class="ruby-ivar">@body</span> <span class="ruby-operator"><<</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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">"HTTP/1.1 #{@status.to_i} #{HTTP_STATUS_CODES[@status.to_i]}\r\nContent-Length:#{body.length}\r\nConnection: close\r\n"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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">"\r\n"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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">"WARNING: Request took longer than #@timeout second timeout"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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"><<</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">></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">"ERROR(#{details.class}): #{details}"</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">"\n"</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
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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"><<</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
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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>
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
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>
|
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
|
78
78
|
thread
|
79
79
|
stringio
|
80
|
+
timeout
|
80
81
|
</div>
|
81
82
|
</div>
|
82
83
|
|
data/examples/simpletest.rb
CHANGED
@@ -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
|
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)
|
data/lib/mongrel.rb
CHANGED
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.
|
7
|
-
date: 2006-02-
|
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
|