mongrel 0.3.10.1 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -2
- data/bin/mongrel_rails +7 -1
- data/bin/mongrel_rails_service +4 -4
- data/lib/mongrel.rb +5 -6
- data/tools/rakehelp.rb +4 -2
- metadata +3 -134
- data/doc/rdoc/classes/Mongrel.html +0 -175
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -381
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000057.html +0 -24
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000058.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000059.html +0 -34
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000060.html +0 -27
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000061.html +0 -25
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000062.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000063.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000064.html +0 -18
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000065.html +0 -19
- data/doc/rdoc/classes/Mongrel/Camping.html +0 -177
- data/doc/rdoc/classes/Mongrel/Camping.src/M000019.html +0 -22
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +0 -165
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000020.html +0 -18
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000021.html +0 -27
- data/doc/rdoc/classes/Mongrel/Command.html +0 -119
- data/doc/rdoc/classes/Mongrel/Command/Base.html +0 -332
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000006.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000007.html +0 -41
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000008.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000009.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000010.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000011.html +0 -22
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000012.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000013.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000014.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000015.html +0 -18
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +0 -192
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000016.html +0 -20
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000017.html +0 -25
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000018.html +0 -46
- data/doc/rdoc/classes/Mongrel/Const.html +0 -352
- data/doc/rdoc/classes/Mongrel/DirHandler.html +0 -283
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000029.html +0 -20
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000030.html +0 -42
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000031.html +0 -40
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000032.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000033.html +0 -38
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000034.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000066.html +0 -18
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000067.html +0 -18
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +0 -185
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000041.html +0 -18
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000042.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +0 -146
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000043.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpParser.html +0 -271
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000022.html +0 -28
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000023.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000024.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000025.html +0 -41
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000026.html +0 -27
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000027.html +0 -27
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000028.html +0 -28
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +0 -177
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000068.html +0 -39
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +0 -321
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000044.html +0 -21
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000045.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000046.html +0 -19
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000047.html +0 -19
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000048.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000049.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000050.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.html +0 -310
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000035.html +0 -36
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000036.html +0 -57
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000037.html +0 -48
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000038.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000039.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000040.html +0 -23
- data/doc/rdoc/classes/Mongrel/StopServer.html +0 -117
- data/doc/rdoc/classes/Mongrel/TimeoutWorker.html +0 -117
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +0 -301
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000051.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000052.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000053.html +0 -39
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000054.html +0 -51
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000055.html +0 -36
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000056.html +0 -83
- data/doc/rdoc/classes/RailsHandler.html +0 -245
- data/doc/rdoc/classes/RailsHandler.src/M000003.html +0 -22
- data/doc/rdoc/classes/RailsHandler.src/M000004.html +0 -48
- data/doc/rdoc/classes/RailsHandler.src/M000005.html +0 -23
- data/doc/rdoc/classes/TCPServer.html +0 -173
- data/doc/rdoc/classes/TCPServer.src/M000001.html +0 -19
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -756
- data/doc/rdoc/files/LICENSE.html +0 -756
- data/doc/rdoc/files/README.html +0 -302
- data/doc/rdoc/files/ext/http11/http11_c.html +0 -101
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +0 -108
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +0 -108
- data/doc/rdoc/files/lib/mongrel/command_rb.html +0 -111
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +0 -101
- data/doc/rdoc/files/lib/mongrel/init_rb.html +0 -109
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +0 -109
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +0 -109
- data/doc/rdoc/files/lib/mongrel_rb.html +0 -116
- data/doc/rdoc/fr_class_index.html +0 -47
- data/doc/rdoc/fr_file_index.html +0 -38
- data/doc/rdoc/fr_method_index.html +0 -94
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
@@ -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>uris (Mongrel::URIClassifier)</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 21</span>
|
14
|
-
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uris</span>
|
15
|
-
22: <span class="ruby-ivar">@handler_map</span>.<span class="ruby-identifier">keys</span>
|
16
|
-
23: <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>inspect (Mongrel::URIClassifier)</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 26</span>
|
14
|
-
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
15
|
-
27: <span class="ruby-ivar">@handler_map</span>.<span class="ruby-identifier">inspect</span>
|
16
|
-
28: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,39 +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::URIClassifier)</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>/**
|
14
|
-
* call-seq:
|
15
|
-
* URIClassifier.new -> URIClassifier
|
16
|
-
*
|
17
|
-
* Initializes a new URIClassifier object that you can use to associate URI sequences
|
18
|
-
* with objects. You can actually use it with any string sequence and any objects,
|
19
|
-
* but it's mostly used with URIs.
|
20
|
-
*
|
21
|
-
* It uses TST from http://www.octavian.org/cs/software.html to build an ternary search
|
22
|
-
* trie to hold all of the URIs. It uses this to do an initial search for the a URI
|
23
|
-
* prefix, and then to break the URI into SCRIPT_NAME and PATH_INFO portions. It actually
|
24
|
-
* will do two searches most of the time in order to find the right handler for the
|
25
|
-
* registered prefix portion.
|
26
|
-
*
|
27
|
-
*/
|
28
|
-
VALUE URIClassifier_init(VALUE self)
|
29
|
-
{
|
30
|
-
VALUE hash;
|
31
|
-
|
32
|
-
// we create an internal hash to protect stuff from the GC
|
33
|
-
hash = rb_hash_new();
|
34
|
-
rb_ivar_set(self, id_handler_map, hash);
|
35
|
-
|
36
|
-
return self;
|
37
|
-
}</pre>
|
38
|
-
</body>
|
39
|
-
</html>
|
@@ -1,51 +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>register (Mongrel::URIClassifier)</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>/**
|
14
|
-
* call-seq:
|
15
|
-
* uc.register("/someuri", SampleHandler.new) -> nil
|
16
|
-
*
|
17
|
-
* Registers the SampleHandler (one for all requests) with the "/someuri".
|
18
|
-
* When URIClassifier::resolve is called with "/someuri" it'll return
|
19
|
-
* SampleHandler immediately. When called with "/someuri/iwant" it'll also
|
20
|
-
* return SomeHandler immediatly, with no additional searches, but it will
|
21
|
-
* return path info with "/iwant".
|
22
|
-
*
|
23
|
-
* You actually can reuse this class to register nearly anything and
|
24
|
-
* quickly resolve it. This could be used for caching, fast mapping, etc.
|
25
|
-
* The downside is it uses much more memory than a Hash, but it can be
|
26
|
-
* a lot faster. It's main advantage is that it works on prefixes, which
|
27
|
-
* is damn hard to get right with a Hash.
|
28
|
-
*/
|
29
|
-
VALUE URIClassifier_register(VALUE self, VALUE uri, VALUE handler)
|
30
|
-
{
|
31
|
-
int rc = 0;
|
32
|
-
void *ptr = NULL;
|
33
|
-
struct tst *tst = NULL;
|
34
|
-
DATA_GET(self, struct tst, tst);
|
35
|
-
|
36
|
-
rc = tst_insert((unsigned char *)StringValueCStr(uri), (void *)handler , tst, 0, &ptr);
|
37
|
-
|
38
|
-
if(rc == TST_DUPLICATE_KEY) {
|
39
|
-
rb_raise(rb_eStandardError, "Handler already registered with that name");
|
40
|
-
} else if(rc == TST_ERROR) {
|
41
|
-
rb_raise(rb_eStandardError, "Memory error registering handler");
|
42
|
-
} else if(rc == TST_NULL_KEY) {
|
43
|
-
rb_raise(rb_eStandardError, "URI was empty");
|
44
|
-
}
|
45
|
-
|
46
|
-
rb_hash_aset(rb_ivar_get(self, id_handler_map), uri, handler);
|
47
|
-
|
48
|
-
return Qnil;
|
49
|
-
}</pre>
|
50
|
-
</body>
|
51
|
-
</html>
|
@@ -1,36 +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>unregister (Mongrel::URIClassifier)</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>/**
|
14
|
-
* call-seq:
|
15
|
-
* uc.unregister("/someuri")
|
16
|
-
*
|
17
|
-
* Yep, just removes this uri and it's handler from the trie.
|
18
|
-
*/
|
19
|
-
VALUE URIClassifier_unregister(VALUE self, VALUE uri)
|
20
|
-
{
|
21
|
-
void *handler = NULL;
|
22
|
-
struct tst *tst = NULL;
|
23
|
-
DATA_GET(self, struct tst, tst);
|
24
|
-
|
25
|
-
handler = tst_delete((unsigned char *)StringValueCStr(uri), tst);
|
26
|
-
|
27
|
-
if(handler) {
|
28
|
-
rb_hash_delete(rb_ivar_get(self, id_handler_map), uri);
|
29
|
-
|
30
|
-
return (VALUE)handler;
|
31
|
-
} else {
|
32
|
-
return Qnil;
|
33
|
-
}
|
34
|
-
}</pre>
|
35
|
-
</body>
|
36
|
-
</html>
|
@@ -1,83 +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>resolve (Mongrel::URIClassifier)</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>/**
|
14
|
-
* call-seq:
|
15
|
-
* uc.resolve("/someuri") -> "/someuri", "", handler
|
16
|
-
* uc.resolve("/someuri/pathinfo") -> "/someuri", "/pathinfo", handler
|
17
|
-
* uc.resolve("/notfound/orhere") -> nil, nil, nil
|
18
|
-
* uc.resolve("/") -> "/", "/", handler # if uc.register("/", handler)
|
19
|
-
* uc.resolve("/path/from/root") -> "/", "/path/from/root", handler # if uc.register("/", handler)
|
20
|
-
*
|
21
|
-
* Attempts to resolve either the whole URI or at the longest prefix, returning
|
22
|
-
* the prefix (as script_info), path (as path_info), and registered handler
|
23
|
-
* (usually an HttpHandler). If it doesn't find a handler registered at the longest
|
24
|
-
* match then it returns nil,nil,nil.
|
25
|
-
*
|
26
|
-
* Because the resolver uses a trie you are able to register a handler at *any* character
|
27
|
-
* in the URI and it will be handled as long as it's the longest prefix. So, if you
|
28
|
-
* registered handler #1 at "/something/lik", and #2 at "/something/like/that", then a
|
29
|
-
* a search for "/something/like" would give you #1. A search for "/something/like/that/too"
|
30
|
-
* would give you #2.
|
31
|
-
*
|
32
|
-
* This is very powerful since it means you can also attach handlers to parts of the ;
|
33
|
-
* (semi-colon) separated path params, any part of the path, use off chars, anything really.
|
34
|
-
* It also means that it's very efficient to do this only taking as long as the URI has
|
35
|
-
* characters.
|
36
|
-
*
|
37
|
-
* A slight modification to the CGI 1.2 standard is given for handlers registered to "/".
|
38
|
-
* CGI expects all CGI scripts to be at some script path, so it doesn't really say anything
|
39
|
-
* about a script that handles the root. To make this work, the resolver will detect that
|
40
|
-
* the requested handler is at "/", and return that for script_name, and then simply return
|
41
|
-
* the full URI back as path_info.
|
42
|
-
*
|
43
|
-
* It expects strings with no embedded '\0' characters. Don't try other string-like stuff yet.
|
44
|
-
*/
|
45
|
-
VALUE URIClassifier_resolve(VALUE self, VALUE uri)
|
46
|
-
{
|
47
|
-
void *handler = NULL;
|
48
|
-
int pref_len = 0;
|
49
|
-
struct tst *tst = NULL;
|
50
|
-
VALUE result;
|
51
|
-
unsigned char *uri_str = NULL;
|
52
|
-
|
53
|
-
DATA_GET(self, struct tst, tst);
|
54
|
-
uri_str = (unsigned char *)StringValueCStr(uri);
|
55
|
-
|
56
|
-
handler = tst_search(uri_str, tst, &pref_len);
|
57
|
-
|
58
|
-
// setup for multiple return values
|
59
|
-
result = rb_ary_new();
|
60
|
-
|
61
|
-
if(handler) {
|
62
|
-
rb_ary_push(result, rb_str_substr (uri, 0, pref_len));
|
63
|
-
// compensate for a script_name="/" where we need to add the "/" to path_info to keep it consistent
|
64
|
-
if(pref_len == 1 && uri_str[0] == '/') {
|
65
|
-
// matches the root URI so we have to use the whole URI as the path_info
|
66
|
-
rb_ary_push(result, uri);
|
67
|
-
} else {
|
68
|
-
// matches a script so process like normal
|
69
|
-
rb_ary_push(result, rb_str_substr(uri, pref_len, RSTRING(uri)->len));
|
70
|
-
}
|
71
|
-
|
72
|
-
rb_ary_push(result, (VALUE)handler);
|
73
|
-
} else {
|
74
|
-
// not found so push back nothing
|
75
|
-
rb_ary_push(result, Qnil);
|
76
|
-
rb_ary_push(result, Qnil);
|
77
|
-
rb_ary_push(result, Qnil);
|
78
|
-
}
|
79
|
-
|
80
|
-
return result;
|
81
|
-
}</pre>
|
82
|
-
</body>
|
83
|
-
</html>
|
@@ -1,245 +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: RailsHandler</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">RailsHandler</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/mongrel/rails_rb.html">
|
59
|
-
lib/mongrel/rails.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="Mongrel/HttpHandler.html">
|
69
|
-
Mongrel::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
|
-
Implements a handler that can run Rails and serve files out of the Rails
|
86
|
-
application’s public directory. This lets you run your Rails
|
87
|
-
application with <a href="Mongrel.html">Mongrel</a> during development and
|
88
|
-
testing, then use it also in production behind a server that’s better
|
89
|
-
at serving the static files.
|
90
|
-
</p>
|
91
|
-
<p>
|
92
|
-
The <a href="RailsHandler.html">RailsHandler</a> takes a mime_map parameter
|
93
|
-
which is a simple suffix=mimetype mapping that it should add to the list of
|
94
|
-
valid mime types.
|
95
|
-
</p>
|
96
|
-
<p>
|
97
|
-
It also supports page caching directly and will try to resolve a request in
|
98
|
-
the following order:
|
99
|
-
</p>
|
100
|
-
<ul>
|
101
|
-
<li>If the requested exact PATH_INFO exists as a file then serve it.
|
102
|
-
|
103
|
-
</li>
|
104
|
-
<li>If it exists at PATH_INFO+".html" exists then serve that.
|
105
|
-
|
106
|
-
</li>
|
107
|
-
<li>Finally, construct a <a
|
108
|
-
href="Mongrel/CGIWrapper.html">Mongrel::CGIWrapper</a> and run
|
109
|
-
Dispatcher.dispath to have Rails go.
|
110
|
-
|
111
|
-
</li>
|
112
|
-
</ul>
|
113
|
-
<p>
|
114
|
-
This means that if you are using page caching it will actually work with <a
|
115
|
-
href="Mongrel.html">Mongrel</a> and you should see a decent speed boost
|
116
|
-
(but not as fast as if you use lighttpd).
|
117
|
-
</p>
|
118
|
-
<p>
|
119
|
-
An additional feature you can use is
|
120
|
-
</p>
|
121
|
-
|
122
|
-
</div>
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div id="method-list">
|
128
|
-
<h3 class="section-bar">Methods</h3>
|
129
|
-
|
130
|
-
<div class="name-list">
|
131
|
-
<a href="#M000003">new</a>
|
132
|
-
<a href="#M000004">process</a>
|
133
|
-
<a href="#M000005">reload!</a>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
</div>
|
138
|
-
|
139
|
-
|
140
|
-
<!-- if includes -->
|
141
|
-
|
142
|
-
<div id="section">
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<div id="attribute-list">
|
149
|
-
<h3 class="section-bar">Attributes</h3>
|
150
|
-
|
151
|
-
<div class="name-list">
|
152
|
-
<table>
|
153
|
-
<tr class="top-aligned-row context-row">
|
154
|
-
<td class="context-item-name">files</td>
|
155
|
-
<td class="context-item-value"> [R] </td>
|
156
|
-
<td class="context-item-desc"></td>
|
157
|
-
</tr>
|
158
|
-
<tr class="top-aligned-row context-row">
|
159
|
-
<td class="context-item-name">guard</td>
|
160
|
-
<td class="context-item-value"> [R] </td>
|
161
|
-
<td class="context-item-desc"></td>
|
162
|
-
</tr>
|
163
|
-
</table>
|
164
|
-
</div>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
<!-- if method_list -->
|
170
|
-
<div id="methods">
|
171
|
-
<h3 class="section-bar">Public Class methods</h3>
|
172
|
-
|
173
|
-
<div id="method-M000003" class="method-detail">
|
174
|
-
<a name="M000003"></a>
|
175
|
-
|
176
|
-
<div class="method-heading">
|
177
|
-
<a href="RailsHandler.src/M000003.html" target="Code" class="method-signature"
|
178
|
-
onclick="popupCode('RailsHandler.src/M000003.html');return false;">
|
179
|
-
<span class="method-name">new</span><span class="method-args">(dir, mime_map = {})</span>
|
180
|
-
</a>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
188
|
-
|
189
|
-
<div id="method-M000004" class="method-detail">
|
190
|
-
<a name="M000004"></a>
|
191
|
-
|
192
|
-
<div class="method-heading">
|
193
|
-
<a href="RailsHandler.src/M000004.html" target="Code" class="method-signature"
|
194
|
-
onclick="popupCode('RailsHandler.src/M000004.html');return false;">
|
195
|
-
<span class="method-name">process</span><span class="method-args">(request, response)</span>
|
196
|
-
</a>
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<div class="method-description">
|
200
|
-
<p>
|
201
|
-
Attempts to resolve the request as follows:
|
202
|
-
</p>
|
203
|
-
<ul>
|
204
|
-
<li>If the requested exact PATH_INFO exists as a file then serve it.
|
205
|
-
|
206
|
-
</li>
|
207
|
-
<li>If it exists at PATH_INFO+".html" exists then serve that.
|
208
|
-
|
209
|
-
</li>
|
210
|
-
<li>Finally, construct a <a
|
211
|
-
href="Mongrel/CGIWrapper.html">Mongrel::CGIWrapper</a> and run
|
212
|
-
Dispatcher.dispath to have Rails go.
|
213
|
-
|
214
|
-
</li>
|
215
|
-
</ul>
|
216
|
-
</div>
|
217
|
-
</div>
|
218
|
-
|
219
|
-
<div id="method-M000005" class="method-detail">
|
220
|
-
<a name="M000005"></a>
|
221
|
-
|
222
|
-
<div class="method-heading">
|
223
|
-
<a href="RailsHandler.src/M000005.html" target="Code" class="method-signature"
|
224
|
-
onclick="popupCode('RailsHandler.src/M000005.html');return false;">
|
225
|
-
<span class="method-name">reload!</span><span class="method-args">()</span>
|
226
|
-
</a>
|
227
|
-
</div>
|
228
|
-
|
229
|
-
<div class="method-description">
|
230
|
-
</div>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
|
234
|
-
</div>
|
235
|
-
|
236
|
-
|
237
|
-
</div>
|
238
|
-
|
239
|
-
|
240
|
-
<div id="validator-badges">
|
241
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
242
|
-
</div>
|
243
|
-
|
244
|
-
</body>
|
245
|
-
</html>
|