mongrel 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/LICENSE +504 -0
- data/README +117 -0
- data/Rakefile +30 -0
- data/doc/rdoc/classes/Mongrel.html +144 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000023.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000024.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +167 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000013.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000014.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +159 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000019.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +271 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000001.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000002.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000003.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html +41 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000005.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000006.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000007.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +177 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000025.html +30 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +202 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000020.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000021.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000022.html +25 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +336 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +26 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000009.html +58 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000010.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000011.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +257 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000015.html +54 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000016.html +50 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000017.html +36 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000018.html +73 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +756 -0
- data/doc/rdoc/files/LICENSE.html +756 -0
- data/doc/rdoc/files/README.html +273 -0
- data/doc/rdoc/files/ext/http11/http11_c.html +101 -0
- data/doc/rdoc/files/lib/mongrel_rb.html +111 -0
- data/doc/rdoc/fr_class_index.html +35 -0
- data/doc/rdoc/fr_file_index.html +31 -0
- data/doc/rdoc/fr_method_index.html +51 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/camping/blog.rb +300 -0
- data/examples/camping/tepee.rb +168 -0
- data/examples/simpletest.rb +16 -0
- data/examples/webrick_compare.rb +20 -0
- data/ext/http11/MANIFEST +0 -0
- data/ext/http11/ext_help.h +14 -0
- data/ext/http11/extconf.rb +6 -0
- data/ext/http11/http11.c +436 -0
- data/ext/http11/http11_parser.c +918 -0
- data/ext/http11/http11_parser.h +37 -0
- data/ext/http11/tst.h +40 -0
- data/ext/http11/tst_cleanup.c +24 -0
- data/ext/http11/tst_delete.c +146 -0
- data/ext/http11/tst_grow_node_free_list.c +38 -0
- data/ext/http11/tst_init.c +41 -0
- data/ext/http11/tst_insert.c +192 -0
- data/ext/http11/tst_search.c +54 -0
- data/lib/mongrel.rb +298 -0
- data/setup.rb +1360 -0
- data/test/test_http11.rb +38 -0
- data/test/test_response.rb +44 -0
- data/test/test_uriclassifier.rb +104 -0
- data/test/test_ws.rb +33 -0
- data/tools/rakehelp.rb +99 -0
- metadata +132 -0
@@ -0,0 +1,28 @@
|
|
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::HttpParser)</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
|
+
* parser.new -> parser
|
16
|
+
*
|
17
|
+
* Creates a new parser.
|
18
|
+
*/
|
19
|
+
VALUE HttpParser_init(VALUE self)
|
20
|
+
{
|
21
|
+
http_parser *http = NULL;
|
22
|
+
DATA_GET(self, http_parser, http);
|
23
|
+
http_parser_init(http);
|
24
|
+
|
25
|
+
return self;
|
26
|
+
}</pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
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>reset (Mongrel::HttpParser)</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
|
+
* parser.reset -> nil
|
16
|
+
*
|
17
|
+
* Resets the parser to it's initial state so that you can reuse it
|
18
|
+
* rather than making new ones.
|
19
|
+
*/
|
20
|
+
VALUE HttpParser_reset(VALUE self)
|
21
|
+
{
|
22
|
+
http_parser *http = NULL;
|
23
|
+
DATA_GET(self, http_parser, http);
|
24
|
+
http_parser_init(http);
|
25
|
+
|
26
|
+
return Qnil;
|
27
|
+
}</pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
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>finish (Mongrel::HttpParser)</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
|
+
* parser.finish -> true/false
|
16
|
+
*
|
17
|
+
* Finishes a parser early which could put in a "good" or bad state.
|
18
|
+
* You should call reset after finish it or bad things will happen.
|
19
|
+
*/
|
20
|
+
VALUE HttpParser_finish(VALUE self)
|
21
|
+
{
|
22
|
+
http_parser *http = NULL;
|
23
|
+
DATA_GET(self, http_parser, http);
|
24
|
+
http_parser_finish(http);
|
25
|
+
|
26
|
+
return http_parser_is_finished(http) ? Qtrue : Qfalse;
|
27
|
+
}</pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
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>execute (Mongrel::HttpParser)</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
|
+
* parser.execute(req_hash, data) -> Integer
|
16
|
+
*
|
17
|
+
* Takes a Hash and a String of data, parses the String of data filling in the Hash
|
18
|
+
* returning an Integer to indicate how much of the data has been read. No matter
|
19
|
+
* what the return value, you should call HttpParser#finished? and HttpParser#error?
|
20
|
+
* to figure out if it's done parsing or there was an error.
|
21
|
+
*
|
22
|
+
* This function now throws an exception when there is a parsing error. This makes
|
23
|
+
* the logic for working with the parser much easier. You can still test for an
|
24
|
+
* error, but now you need to wrap the parser with an exception handling block.
|
25
|
+
*/
|
26
|
+
VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data)
|
27
|
+
{
|
28
|
+
http_parser *http = NULL;
|
29
|
+
DATA_GET(self, http_parser, http);
|
30
|
+
|
31
|
+
http->data = (void *)req_hash;
|
32
|
+
http_parser_execute(http, RSTRING(data)->ptr, RSTRING(data)->len);
|
33
|
+
|
34
|
+
if(http_parser_has_error(http)) {
|
35
|
+
rb_raise(rb_eStandardError, "HTTP Parsing failure");
|
36
|
+
} else {
|
37
|
+
return INT2FIX(http_parser_nread(http));
|
38
|
+
}
|
39
|
+
}</pre>
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -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>error? (Mongrel::HttpParser)</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
|
+
* parser.error? -> true/false
|
16
|
+
*
|
17
|
+
* Tells you whether the parser is in an error state.
|
18
|
+
*/
|
19
|
+
VALUE HttpParser_has_error(VALUE self)
|
20
|
+
{
|
21
|
+
http_parser *http = NULL;
|
22
|
+
DATA_GET(self, http_parser, http);
|
23
|
+
|
24
|
+
return http_parser_has_error(http) ? Qtrue : Qfalse;
|
25
|
+
}</pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -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>finished? (Mongrel::HttpParser)</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
|
+
* parser.finished? -> true/false
|
16
|
+
*
|
17
|
+
* Tells you whether the parser is finished or not and in a good state.
|
18
|
+
*/
|
19
|
+
VALUE HttpParser_is_finished(VALUE self)
|
20
|
+
{
|
21
|
+
http_parser *http = NULL;
|
22
|
+
DATA_GET(self, http_parser, http);
|
23
|
+
|
24
|
+
return http_parser_is_finished(http) ? Qtrue : Qfalse;
|
25
|
+
}</pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
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>nread (Mongrel::HttpParser)</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
|
+
* parser.nread -> Integer
|
16
|
+
*
|
17
|
+
* Returns the amount of data processed so far during this processing cycle. It is
|
18
|
+
* set to 0 on initialize or reset calls and is incremented each time execute is called.
|
19
|
+
*/
|
20
|
+
VALUE HttpParser_nread(VALUE self)
|
21
|
+
{
|
22
|
+
http_parser *http = NULL;
|
23
|
+
DATA_GET(self, http_parser, http);
|
24
|
+
|
25
|
+
return INT2FIX(http->nread);
|
26
|
+
}</pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,177 @@
|
|
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::HttpRequest</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::HttpRequest</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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
When a handler is found for a registered URI then this class is constructed
|
84
|
+
and passed to your HttpHandler::process method. You should assume that
|
85
|
+
<b>one</b> handler processes all requests. Included in the HttpReqeust is a
|
86
|
+
HttpRequest.params Hash that matches common CGI params, and a
|
87
|
+
HttpRequest.body which is a string containing the request body (raw for
|
88
|
+
now).
|
89
|
+
</p>
|
90
|
+
<p>
|
91
|
+
<a href="../Mongrel.html">Mongrel</a> really only support small-ish request
|
92
|
+
bodies right now since really huge ones have to be completely read off the
|
93
|
+
wire and put into a string. Later there will be several options for
|
94
|
+
efficiently handling large file uploads.
|
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="#M000025">new</a>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if includes -->
|
114
|
+
|
115
|
+
<div id="section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div id="attribute-list">
|
122
|
+
<h3 class="section-bar">Attributes</h3>
|
123
|
+
|
124
|
+
<div class="name-list">
|
125
|
+
<table>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">body</td>
|
128
|
+
<td class="context-item-value"> [R] </td>
|
129
|
+
<td class="context-item-desc"></td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">params</td>
|
133
|
+
<td class="context-item-value"> [R] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
</table>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<!-- if method_list -->
|
143
|
+
<div id="methods">
|
144
|
+
<h3 class="section-bar">Public Class methods</h3>
|
145
|
+
|
146
|
+
<div id="method-M000025" class="method-detail">
|
147
|
+
<a name="M000025"></a>
|
148
|
+
|
149
|
+
<div class="method-heading">
|
150
|
+
<a href="HttpRequest.src/M000025.html" target="Code" class="method-signature"
|
151
|
+
onclick="popupCode('HttpRequest.src/M000025.html');return false;">
|
152
|
+
<span class="method-name">new</span><span class="method-args">(params, initial_body, socket)</span>
|
153
|
+
</a>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div class="method-description">
|
157
|
+
<p>
|
158
|
+
You don’t really call this. It’s made for you. Main thing it
|
159
|
+
does is hook up the params, and store any remaining body data into the
|
160
|
+
HttpRequest.body attribute.
|
161
|
+
</p>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<div id="validator-badges">
|
173
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</body>
|
177
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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::HttpRequest)</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 67</span>
|
14
|
+
67: <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
|
+
68: <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
|
+
69: <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
17
|
+
70: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">socket</span>
|
18
|
+
71:
|
19
|
+
72: <span class="ruby-comment cmt"># fix up the CGI requirements</span>
|
20
|
+
73: <span class="ruby-identifier">params</span>[<span class="ruby-value str">'CONTENT_LENGTH'</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value str">'HTTP_CONTENT_LENGTH'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
21
|
+
74:
|
22
|
+
75: <span class="ruby-comment cmt"># now, if the initial_body isn't long enough for the content length we have to fill it</span>
|
23
|
+
76: <span class="ruby-comment cmt"># TODO: adapt for big ass stuff by writing to a temp file</span>
|
24
|
+
77: <span class="ruby-identifier">clen</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value str">'HTTP_CONTENT_LENGTH'</span>].<span class="ruby-identifier">to_i</span>
|
25
|
+
78: <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>
|
26
|
+
79: <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>)
|
27
|
+
80: <span class="ruby-keyword kw">end</span>
|
28
|
+
81: <span class="ruby-keyword kw">end</span></pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,202 @@
|
|
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::HttpResponse</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::HttpResponse</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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000022">finished</a>
|
90
|
+
<a href="#M000020">new</a>
|
91
|
+
<a href="#M000021">start</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<div id="attribute-list">
|
107
|
+
<h3 class="section-bar">Attributes</h3>
|
108
|
+
|
109
|
+
<div class="name-list">
|
110
|
+
<table>
|
111
|
+
<tr class="top-aligned-row context-row">
|
112
|
+
<td class="context-item-name">body</td>
|
113
|
+
<td class="context-item-value"> [R] </td>
|
114
|
+
<td class="context-item-desc"></td>
|
115
|
+
</tr>
|
116
|
+
<tr class="top-aligned-row context-row">
|
117
|
+
<td class="context-item-name">header</td>
|
118
|
+
<td class="context-item-value"> [R] </td>
|
119
|
+
<td class="context-item-desc"></td>
|
120
|
+
</tr>
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">socket</td>
|
123
|
+
<td class="context-item-value"> [R] </td>
|
124
|
+
<td class="context-item-desc"></td>
|
125
|
+
</tr>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">status</td>
|
128
|
+
<td class="context-item-value"> [R] </td>
|
129
|
+
<td class="context-item-desc"></td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">status</td>
|
133
|
+
<td class="context-item-value"> [W] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
</table>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<!-- if method_list -->
|
143
|
+
<div id="methods">
|
144
|
+
<h3 class="section-bar">Public Class methods</h3>
|
145
|
+
|
146
|
+
<div id="method-M000020" class="method-detail">
|
147
|
+
<a name="M000020"></a>
|
148
|
+
|
149
|
+
<div class="method-heading">
|
150
|
+
<a href="HttpResponse.src/M000020.html" target="Code" class="method-signature"
|
151
|
+
onclick="popupCode('HttpResponse.src/M000020.html');return false;">
|
152
|
+
<span class="method-name">new</span><span class="method-args">(socket)</span>
|
153
|
+
</a>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div class="method-description">
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
161
|
+
|
162
|
+
<div id="method-M000022" class="method-detail">
|
163
|
+
<a name="M000022"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="HttpResponse.src/M000022.html" target="Code" class="method-signature"
|
167
|
+
onclick="popupCode('HttpResponse.src/M000022.html');return false;">
|
168
|
+
<span class="method-name">finished</span><span class="method-args">()</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="method-M000021" class="method-detail">
|
177
|
+
<a name="M000021"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
<a href="HttpResponse.src/M000021.html" target="Code" class="method-signature"
|
181
|
+
onclick="popupCode('HttpResponse.src/M000021.html');return false;">
|
182
|
+
<span class="method-name">start</span><span class="method-args">(status=200) {|@header, @body| ...}</span>
|
183
|
+
</a>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div class="method-description">
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
<div id="validator-badges">
|
198
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</body>
|
202
|
+
</html>
|