mongrel 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Rakefile +20 -2
- data/bin/mongrel_rails +7 -53
- data/doc/rdoc/classes/Mongrel.html +1 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +300 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +23 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +27 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +22 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +26 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +19 -0
- data/doc/rdoc/classes/Mongrel/Const.html +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.html +10 -10
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000047.html → M000055.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000048.html → M000056.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.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/{M000049.html → M000057.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 +5 -4
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html +6 -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 +48 -48
- 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/README.html +2 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +17 -9
- data/lib/mongrel.rb +89 -3
- data/lib/mongrel/command.rb +1 -1
- data/tools/rakehelp.rb +17 -9
- metadata +17 -7
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>header (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 617</span>
|
14
|
+
617: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">"text/html"</span>)
|
15
|
+
618: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
16
|
+
619: <span class="ruby-comment cmt"># passing in a header so need to keep the status around and other options</span>
|
17
|
+
620: <span class="ruby-ivar">@options</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
18
|
+
621: <span class="ruby-keyword kw">else</span>
|
19
|
+
622: <span class="ruby-ivar">@options</span>[<span class="ruby-value str">"Content-Type"</span>] = <span class="ruby-identifier">options</span>
|
20
|
+
623: <span class="ruby-keyword kw">end</span>
|
21
|
+
624:
|
22
|
+
625: <span class="ruby-comment cmt"># doing this fakes out the cgi library to think the headers are empty</span>
|
23
|
+
626: <span class="ruby-comment cmt"># we then do the real headers in the out function call later</span>
|
24
|
+
627: <span class="ruby-value str">""</span>
|
25
|
+
628: <span class="ruby-keyword kw">end</span></pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>out (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 634</span>
|
14
|
+
634: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">out</span>(<span class="ruby-identifier">options</span> = <span class="ruby-value str">"text/html"</span>)
|
15
|
+
635: <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span>)
|
16
|
+
636: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">start</span> <span class="ruby-identifier">status</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>
|
17
|
+
637: <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">head</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">capitalize</span>] = <span class="ruby-identifier">v</span>}
|
18
|
+
638: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-keyword kw">yield</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>)
|
19
|
+
639: <span class="ruby-keyword kw">end</span>
|
20
|
+
640: <span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>status (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 645</span>
|
14
|
+
645: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
|
15
|
+
646: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status</span>
|
16
|
+
647: <span class="ruby-ivar">@status</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">"Status"</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value str">"status"</span>]
|
17
|
+
648:
|
18
|
+
649: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@status</span>
|
19
|
+
650: <span class="ruby-ivar">@status</span>[<span class="ruby-value">0</span> <span class="ruby-operator">...</span> <span class="ruby-ivar">@status</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">' '</span>)] <span class="ruby-operator">||</span> <span class="ruby-value str">"200"</span>
|
20
|
+
651: <span class="ruby-keyword kw">else</span>
|
21
|
+
652: <span class="ruby-ivar">@status</span> = <span class="ruby-value str">"200"</span>
|
22
|
+
653: <span class="ruby-keyword kw">end</span>
|
23
|
+
654: <span class="ruby-keyword kw">end</span>
|
24
|
+
655: <span class="ruby-keyword kw">end</span></pre>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>args (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 658</span>
|
14
|
+
658: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args</span>
|
15
|
+
659: <span class="ruby-ivar">@args</span>
|
16
|
+
660: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>env_table (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 663</span>
|
14
|
+
663: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env_table</span>
|
15
|
+
664: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
|
16
|
+
665: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>stdinput (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 668</span>
|
14
|
+
668: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdinput</span>
|
15
|
+
669: <span class="ruby-ivar">@input</span>
|
16
|
+
670: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>stdoutput (Mongrel::CGIWrapper)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 673</span>
|
14
|
+
673: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdoutput</span>
|
15
|
+
674: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"WARNING: Your program is doing something not expected. Please tell Zed that stdoutput was used and what software you are running. Thanks."</span>
|
16
|
+
675: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span>
|
17
|
+
676: <span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -280,7 +280,7 @@ href="../Mongrel.html">Mongrel</a> man).
|
|
280
280
|
<tr class="top-aligned-row context-row">
|
281
281
|
<td class="context-item-name">MONGREL_VERSION</td>
|
282
282
|
<td>=</td>
|
283
|
-
<td class="context-item-value">'Mongrel 0.
|
283
|
+
<td class="context-item-value">'Mongrel 0.3.4'</td>
|
284
284
|
<td width="3em"> </td>
|
285
285
|
<td class="context-item-desc">
|
286
286
|
Current <a href="../Mongrel.html">Mongrel</a> version (used for
|
@@ -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 473</span>
|
14
|
+
473: <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
|
+
474: <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
|
+
475: <span class="ruby-ivar">@listing_allowed</span>=<span class="ruby-identifier">listing_allowed</span>
|
17
|
+
476: <span class="ruby-ivar">@index_html</span> = <span class="ruby-identifier">index_html</span>
|
18
|
+
477: <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 480</span>
|
14
|
+
480: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path_info</span>)
|
15
|
+
481: <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
|
+
482:
|
17
|
+
483: <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
|
+
484: <span class="ruby-comment cmt"># it exists and it's in the right location</span>
|
19
|
+
485: <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
|
+
486: <span class="ruby-comment cmt"># the request is for a directory</span>
|
21
|
+
487: <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
|
+
488: <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
|
+
489: <span class="ruby-comment cmt"># serve the index</span>
|
24
|
+
490: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">index</span>
|
25
|
+
491: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@listing_allows</span>
|
26
|
+
492: <span class="ruby-comment cmt"># serve the directory</span>
|
27
|
+
493: <span class="ruby-identifier">req</span>
|
28
|
+
494: <span class="ruby-keyword kw">else</span>
|
29
|
+
495: <span class="ruby-comment cmt"># do not serve anything</span>
|
30
|
+
496: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
31
|
+
497: <span class="ruby-keyword kw">end</span>
|
32
|
+
498: <span class="ruby-keyword kw">else</span>
|
33
|
+
499: <span class="ruby-comment cmt"># it's a file and it's there</span>
|
34
|
+
500: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">req</span>
|
35
|
+
501: <span class="ruby-keyword kw">end</span>
|
36
|
+
502: <span class="ruby-keyword kw">else</span>
|
37
|
+
503: <span class="ruby-comment cmt"># does not exist or isn't in the right spot</span>
|
38
|
+
504: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
39
|
+
505: <span class="ruby-keyword kw">end</span>
|
40
|
+
506: <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 513</span>
|
14
|
+
513: <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
|
+
514: <span class="ruby-comment cmt"># take off any trailing / so the links come out right</span>
|
16
|
+
515: <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
|
+
516:
|
18
|
+
517: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@listing_allowed</span>
|
19
|
+
518: <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
|
+
519: <span class="ruby-identifier">head</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">"text/html"</span>
|
21
|
+
520: <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
|
+
521: <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
|
+
522: <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
|
+
523:
|
25
|
+
524: <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
|
+
525: <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
|
+
526: <span class="ruby-keyword kw">else</span>
|
28
|
+
527: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"<a href=\"#{base}/#{child}\">#{child}</a><br/>"</span>
|
29
|
+
528: <span class="ruby-keyword kw">end</span>
|
30
|
+
529: <span class="ruby-keyword kw">end</span>
|
31
|
+
530: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"</body></html>"</span>
|
32
|
+
531: <span class="ruby-keyword kw">end</span>
|
33
|
+
532: <span class="ruby-keyword kw">else</span>
|
34
|
+
533: <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
|
+
534: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"Directory listings not allowed"</span>)
|
36
|
+
535: <span class="ruby-keyword kw">end</span>
|
37
|
+
536: <span class="ruby-keyword kw">end</span>
|
38
|
+
537: <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 542</span>
|
14
|
+
542: <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
|
+
543: <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
|
+
544: <span class="ruby-comment cmt"># set the mime type from our map based on the ending</span>
|
17
|
+
545: <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
|
+
546: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dot_at</span>
|
19
|
+
547: <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
|
+
548: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
|
21
|
+
549: <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
|
+
550: <span class="ruby-keyword kw">end</span>
|
23
|
+
551: <span class="ruby-keyword kw">end</span>
|
24
|
+
552:
|
25
|
+
553: <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
|
+
554: <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
|
+
555: <span class="ruby-keyword kw">end</span>
|
28
|
+
556: <span class="ruby-keyword kw">end</span>
|
29
|
+
557: <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 562</span>
|
14
|
+
562: <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
|
+
563: <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
|
+
564: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">req</span>
|
17
|
+
565: <span class="ruby-comment cmt"># not found, return a 404</span>
|
18
|
+
566: <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
|
+
567: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"File not found"</span>
|
20
|
+
568: <span class="ruby-keyword kw">end</span>
|
21
|
+
569: <span class="ruby-keyword kw">else</span>
|
22
|
+
570: <span class="ruby-keyword kw">begin</span>
|
23
|
+
571: <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
|
+
572: <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
|
+
573: <span class="ruby-keyword kw">else</span>
|
26
|
+
574: <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
|
27
|
+
575: <span class="ruby-keyword kw">end</span>
|
28
|
+
576: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
29
|
+
577: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">reset</span>
|
30
|
+
578: <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
|
+
579: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Error accessing file: #{details}"</span>
|
32
|
+
580: <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
|
+
581: <span class="ruby-keyword kw">end</span>
|
34
|
+
582: <span class="ruby-keyword kw">end</span>
|
35
|
+
583: <span class="ruby-keyword kw">end</span>
|
36
|
+
584: <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 588</span>
|
14
|
+
588: <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
|
+
589: <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">extension</span>] = <span class="ruby-identifier">type</span>
|
16
|
+
590: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -96,8 +96,8 @@ custom message for special URIs.
|
|
96
96
|
<h3 class="section-bar">Methods</h3>
|
97
97
|
|
98
98
|
<div class="name-list">
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
99
|
+
<a href="#M000055">new</a>
|
100
|
+
<a href="#M000056">process</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
103
|
|
@@ -119,12 +119,12 @@ custom message for special URIs.
|
|
119
119
|
<div id="methods">
|
120
120
|
<h3 class="section-bar">Public Class methods</h3>
|
121
121
|
|
122
|
-
<div id="method-
|
123
|
-
<a name="
|
122
|
+
<div id="method-M000055" class="method-detail">
|
123
|
+
<a name="M000055"></a>
|
124
124
|
|
125
125
|
<div class="method-heading">
|
126
|
-
<a href="Error404Handler.src/
|
127
|
-
onclick="popupCode('Error404Handler.src/
|
126
|
+
<a href="Error404Handler.src/M000055.html" target="Code" class="method-signature"
|
127
|
+
onclick="popupCode('Error404Handler.src/M000055.html');return false;">
|
128
128
|
<span class="method-name">new</span><span class="method-args">(msg)</span>
|
129
129
|
</a>
|
130
130
|
</div>
|
@@ -139,12 +139,12 @@ it’s pretty efficient.
|
|
139
139
|
|
140
140
|
<h3 class="section-bar">Public Instance methods</h3>
|
141
141
|
|
142
|
-
<div id="method-
|
143
|
-
<a name="
|
142
|
+
<div id="method-M000056" class="method-detail">
|
143
|
+
<a name="M000056"></a>
|
144
144
|
|
145
145
|
<div class="method-heading">
|
146
|
-
<a href="Error404Handler.src/
|
147
|
-
onclick="popupCode('Error404Handler.src/
|
146
|
+
<a href="Error404Handler.src/M000056.html" target="Code" class="method-signature"
|
147
|
+
onclick="popupCode('Error404Handler.src/M000056.html');return false;">
|
148
148
|
<span class="method-name">process</span><span class="method-args">(request, response)</span>
|
149
149
|
</a>
|
150
150
|
</div>
|