mongrel 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -3
- data/Rakefile +7 -5
- data/bin/mongrel_rails +5 -4
- data/bin/mongrel_rails_service +237 -0
- data/bin/mongrel_rails_svc +194 -0
- data/doc/rdoc/classes/Mongrel.html +1 -4
- data/doc/rdoc/classes/Mongrel/Const.html +13 -3
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +10 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000033.html → M000028.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/{M000034.html → M000029.html} +7 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000041.html +39 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +36 -36
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000034.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000041.html → M000035.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000042.html → M000036.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000043.html → M000037.html} +5 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000044.html → M000038.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/{M000045.html → M000039.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000040.html +7 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.html +47 -28
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000022.html +33 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000023.html +57 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000024.html +46 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000031.html → M000025.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/{M000032.html → M000026.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000027.html +19 -0
- data/doc/rdoc/classes/Mongrel/{HttpHandler.html → StopServer.html} +4 -33
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +22 -23
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000035.html → M000030.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000036.html → M000031.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000037.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/{M000038.html → M000033.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +9 -7
- data/doc/rdoc/files/lib/mongrel_rb.html +3 -3
- data/doc/rdoc/fr_class_index.html +1 -4
- data/doc/rdoc/fr_method_index.html +20 -37
- data/examples/mongrel_simple_ctrl.rb +92 -0
- data/examples/mongrel_simple_service.rb +116 -0
- data/examples/simpletest.rb +3 -1
- data/ext/http11/http11_parser.c +176 -263
- data/lib/mongrel.rb +56 -343
- data/lib/mongrel/cgi.rb +147 -0
- data/lib/mongrel/handlers.rb +180 -0
- metadata +28 -46
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -346
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000047.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000048.html +0 -48
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000049.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000050.html +0 -27
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000051.html +0 -26
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000052.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000053.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000054.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000055.html +0 -19
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -283
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +0 -40
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000056.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000057.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000039.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000058.html +0 -31
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +0 -38
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +0 -64
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000030.html +0 -23
@@ -1,27 +0,0 @@
|
|
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 688</span>
|
14
|
-
688: <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
|
-
689: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@out_called</span> <span class="ruby-comment cmt"># don't do this more than once</span>
|
16
|
-
690:
|
17
|
-
691: <span class="ruby-identifier">header</span>(<span class="ruby-identifier">options</span>)
|
18
|
-
692:
|
19
|
-
693: <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>
|
20
|
-
694: <span class="ruby-identifier">send_cookies</span>(<span class="ruby-identifier">head</span>)
|
21
|
-
695:
|
22
|
-
696: <span class="ruby-ivar">@head</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">v</span>}
|
23
|
-
697: <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>)
|
24
|
-
698: <span class="ruby-keyword kw">end</span>
|
25
|
-
699: <span class="ruby-keyword kw">end</span></pre>
|
26
|
-
</body>
|
27
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
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 704</span>
|
14
|
-
704: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
|
15
|
-
705: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@status</span>
|
16
|
-
706: <span class="ruby-ivar">@status</span> = <span class="ruby-ivar">@head</span>[<span class="ruby-value str">"Status"</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@head</span>[<span class="ruby-value str">"status"</span>]
|
17
|
-
707:
|
18
|
-
708: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@status</span>
|
19
|
-
709: <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
|
-
710: <span class="ruby-keyword kw">else</span>
|
21
|
-
711: <span class="ruby-ivar">@status</span> = <span class="ruby-value str">"200"</span>
|
22
|
-
712: <span class="ruby-keyword kw">end</span>
|
23
|
-
713: <span class="ruby-keyword kw">end</span>
|
24
|
-
714: <span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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 717</span>
|
14
|
-
717: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args</span>
|
15
|
-
718: <span class="ruby-ivar">@args</span>
|
16
|
-
719: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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 722</span>
|
14
|
-
722: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env_table</span>
|
15
|
-
723: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
|
16
|
-
724: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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 727</span>
|
14
|
-
727: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdinput</span>
|
15
|
-
728: <span class="ruby-ivar">@input</span>
|
16
|
-
729: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
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 732</span>
|
14
|
-
732: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdoutput</span>
|
15
|
-
733: <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
|
-
734: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span>
|
17
|
-
735: <span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,283 +0,0 @@
|
|
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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Mongrel::DirHandler</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Mongrel::DirHandler</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/mongrel_rb.html">
|
59
|
-
lib/mongrel.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="HttpHandler.html">
|
69
|
-
HttpHandler
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
<div id="description">
|
84
|
-
<p>
|
85
|
-
Serves the contents of a directory. You give it the path to the root where
|
86
|
-
the files are located, and it tries to find the files based on the
|
87
|
-
PATH_INFO inside the directory. If the requested path is a directory then
|
88
|
-
it returns a simple directory listing.
|
89
|
-
</p>
|
90
|
-
<p>
|
91
|
-
It does a simple protection against going outside it’s root path by
|
92
|
-
converting all paths to an absolute expanded path, and then making sure
|
93
|
-
that the final expanded path includes the root path. If it doesn’t
|
94
|
-
than it simply gives a 404.
|
95
|
-
</p>
|
96
|
-
|
97
|
-
</div>
|
98
|
-
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<div id="method-list">
|
103
|
-
<h3 class="section-bar">Methods</h3>
|
104
|
-
|
105
|
-
<div class="name-list">
|
106
|
-
<a href="#M000027">add_mime_type</a>
|
107
|
-
<a href="#M000023">can_serve</a>
|
108
|
-
<a href="#M000022">new</a>
|
109
|
-
<a href="#M000026">process</a>
|
110
|
-
<a href="#M000024">send_dir_listing</a>
|
111
|
-
<a href="#M000025">send_file</a>
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
|
115
|
-
</div>
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if includes -->
|
119
|
-
|
120
|
-
<div id="section">
|
121
|
-
|
122
|
-
|
123
|
-
<div id="constants-list">
|
124
|
-
<h3 class="section-bar">Constants</h3>
|
125
|
-
|
126
|
-
<div class="name-list">
|
127
|
-
<table summary="Constants">
|
128
|
-
<tr class="top-aligned-row context-row">
|
129
|
-
<td class="context-item-name">MIME_TYPES</td>
|
130
|
-
<td>=</td>
|
131
|
-
<td class="context-item-value">{ ".css" => "text/css", ".gif" => "image/gif", ".htm" => "text/html", ".html" => "text/html", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".js" => "text/javascript", ".png" => "image/png", ".swf" => "application/x-shockwave-flash", ".txt" => "text/plain"</td>
|
132
|
-
</tr>
|
133
|
-
</table>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<div id="attribute-list">
|
140
|
-
<h3 class="section-bar">Attributes</h3>
|
141
|
-
|
142
|
-
<div class="name-list">
|
143
|
-
<table>
|
144
|
-
<tr class="top-aligned-row context-row">
|
145
|
-
<td class="context-item-name">path</td>
|
146
|
-
<td class="context-item-value"> [R] </td>
|
147
|
-
<td class="context-item-desc"></td>
|
148
|
-
</tr>
|
149
|
-
</table>
|
150
|
-
</div>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<!-- if method_list -->
|
156
|
-
<div id="methods">
|
157
|
-
<h3 class="section-bar">Public Class methods</h3>
|
158
|
-
|
159
|
-
<div id="method-M000027" class="method-detail">
|
160
|
-
<a name="M000027"></a>
|
161
|
-
|
162
|
-
<div class="method-heading">
|
163
|
-
<a href="DirHandler.src/M000027.html" target="Code" class="method-signature"
|
164
|
-
onclick="popupCode('DirHandler.src/M000027.html');return false;">
|
165
|
-
<span class="method-name">add_mime_type</span><span class="method-args">(extension, type)</span>
|
166
|
-
</a>
|
167
|
-
</div>
|
168
|
-
|
169
|
-
<div class="method-description">
|
170
|
-
<p>
|
171
|
-
There is a small number of default mime types for extensions, but this lets
|
172
|
-
you add any others you’ll need when serving content.
|
173
|
-
</p>
|
174
|
-
</div>
|
175
|
-
</div>
|
176
|
-
|
177
|
-
<div id="method-M000022" class="method-detail">
|
178
|
-
<a name="M000022"></a>
|
179
|
-
|
180
|
-
<div class="method-heading">
|
181
|
-
<a href="DirHandler.src/M000022.html" target="Code" class="method-signature"
|
182
|
-
onclick="popupCode('DirHandler.src/M000022.html');return false;">
|
183
|
-
<span class="method-name">new</span><span class="method-args">(path, listing_allowed=true, index_html="index.html")</span>
|
184
|
-
</a>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<div class="method-description">
|
188
|
-
<p>
|
189
|
-
You give it the path to the directory root and an (optional)
|
190
|
-
</p>
|
191
|
-
</div>
|
192
|
-
</div>
|
193
|
-
|
194
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
195
|
-
|
196
|
-
<div id="method-M000023" class="method-detail">
|
197
|
-
<a name="M000023"></a>
|
198
|
-
|
199
|
-
<div class="method-heading">
|
200
|
-
<a href="DirHandler.src/M000023.html" target="Code" class="method-signature"
|
201
|
-
onclick="popupCode('DirHandler.src/M000023.html');return false;">
|
202
|
-
<span class="method-name">can_serve</span><span class="method-args">(path_info)</span>
|
203
|
-
</a>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
<div class="method-description">
|
207
|
-
<p>
|
208
|
-
Checks if the given path can be served and returns the full path (or nil if
|
209
|
-
not).
|
210
|
-
</p>
|
211
|
-
</div>
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div id="method-M000026" class="method-detail">
|
215
|
-
<a name="M000026"></a>
|
216
|
-
|
217
|
-
<div class="method-heading">
|
218
|
-
<a href="DirHandler.src/M000026.html" target="Code" class="method-signature"
|
219
|
-
onclick="popupCode('DirHandler.src/M000026.html');return false;">
|
220
|
-
<span class="method-name">process</span><span class="method-args">(request, response)</span>
|
221
|
-
</a>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
<div class="method-description">
|
225
|
-
<p>
|
226
|
-
Process the request to either serve a file or a directory listing if
|
227
|
-
allowed (based on the listing_allowed paramter to the constructor).
|
228
|
-
</p>
|
229
|
-
</div>
|
230
|
-
</div>
|
231
|
-
|
232
|
-
<div id="method-M000024" class="method-detail">
|
233
|
-
<a name="M000024"></a>
|
234
|
-
|
235
|
-
<div class="method-heading">
|
236
|
-
<a href="DirHandler.src/M000024.html" target="Code" class="method-signature"
|
237
|
-
onclick="popupCode('DirHandler.src/M000024.html');return false;">
|
238
|
-
<span class="method-name">send_dir_listing</span><span class="method-args">(base, dir, response)</span>
|
239
|
-
</a>
|
240
|
-
</div>
|
241
|
-
|
242
|
-
<div class="method-description">
|
243
|
-
<p>
|
244
|
-
Returns a simplistic directory listing if they’re enabled, otherwise
|
245
|
-
a 403. Base is the base URI from the REQUEST_URI, dir is the directory to
|
246
|
-
serve on the file system (comes from <a
|
247
|
-
href="DirHandler.html#M000023">can_serve</a>()), and response is the <a
|
248
|
-
href="HttpResponse.html">HttpResponse</a> object to send the results on.
|
249
|
-
</p>
|
250
|
-
</div>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
<div id="method-M000025" class="method-detail">
|
254
|
-
<a name="M000025"></a>
|
255
|
-
|
256
|
-
<div class="method-heading">
|
257
|
-
<a href="DirHandler.src/M000025.html" target="Code" class="method-signature"
|
258
|
-
onclick="popupCode('DirHandler.src/M000025.html');return false;">
|
259
|
-
<span class="method-name">send_file</span><span class="method-args">(req, response)</span>
|
260
|
-
</a>
|
261
|
-
</div>
|
262
|
-
|
263
|
-
<div class="method-description">
|
264
|
-
<p>
|
265
|
-
Sends the contents of a file back to the user. Not terribly efficient since
|
266
|
-
it’s opening and closing the file for each read.
|
267
|
-
</p>
|
268
|
-
</div>
|
269
|
-
</div>
|
270
|
-
|
271
|
-
|
272
|
-
</div>
|
273
|
-
|
274
|
-
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
<div id="validator-badges">
|
279
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
280
|
-
</div>
|
281
|
-
|
282
|
-
</body>
|
283
|
-
</html>
|
@@ -1,20 +0,0 @@
|
|
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>new (Mongrel::DirHandler)</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 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
|
-
</body>
|
20
|
-
</html>
|
@@ -1,42 +0,0 @@
|
|
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>can_serve (Mongrel::DirHandler)</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 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_allowed</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
|
-
</body>
|
42
|
-
</html>
|