mongrel 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -1
- data/Rakefile +1 -1
- data/bin/mongrel_rails +77 -24
- data/doc/rdoc/classes/Mongrel.html +0 -30
- data/doc/rdoc/classes/Mongrel/DirHandler.html +45 -26
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000022.html +20 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000023.html +29 -7
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000024.html +27 -29
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000025.html +18 -27
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000026.html +25 -18
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000027.html +5 -25
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000047.html +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000048.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpParser.html +35 -35
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000022.html → M000015.html} +6 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000016.html +6 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000017.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000018.html +20 -8
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000019.html +6 -20
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000020.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000021.html +6 -5
- data/doc/rdoc/classes/Mongrel/HttpServer.html +1 -1
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000028.html +16 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000029.html +49 -49
- 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 +7 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
- data/doc/rdoc/fr_method_index.html +15 -15
- data/lib/mongrel.rb +17 -8
- metadata +4 -5
- data/doc/rdoc/classes/Mongrel.src/M000015.html +0 -18
@@ -5,36 +5,27 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>send_file (Mongrel::DirHandler)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
-
519: <span class="ruby-keyword kw">end</span>
|
31
|
-
520: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"</body></html>"</span>
|
32
|
-
521: <span class="ruby-keyword kw">end</span>
|
33
|
-
522: <span class="ruby-keyword kw">else</span>
|
34
|
-
523: <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
|
-
524: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">"Directory listings not allowed"</span>)
|
36
|
-
525: <span class="ruby-keyword kw">end</span>
|
37
|
-
526: <span class="ruby-keyword kw">end</span>
|
38
|
-
527: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 539</span>
|
14
|
+
539: <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
|
+
540: <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
|
+
541: <span class="ruby-comment cmt"># set the mime type from our map based on the ending</span>
|
17
|
+
542: <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
|
+
543: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dot_at</span>
|
19
|
+
544: <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
|
+
545: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">ext</span>]
|
21
|
+
546: <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
|
+
547: <span class="ruby-keyword kw">end</span>
|
23
|
+
548: <span class="ruby-keyword kw">end</span>
|
24
|
+
549:
|
25
|
+
550: <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
|
+
551: <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
|
+
552: <span class="ruby-keyword kw">end</span>
|
28
|
+
553: <span class="ruby-keyword kw">end</span>
|
29
|
+
554: <span class="ruby-keyword kw">end</span></pre>
|
39
30
|
</body>
|
40
31
|
</html>
|
@@ -5,27 +5,34 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>process (Mongrel::DirHandler)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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 559</span>
|
14
|
+
559: <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
|
+
560: <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
|
+
561: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">req</span>
|
17
|
+
562: <span class="ruby-comment cmt"># not found, return a 404</span>
|
18
|
+
563: <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
|
+
564: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"File not found"</span>
|
20
|
+
565: <span class="ruby-keyword kw">end</span>
|
21
|
+
566: <span class="ruby-keyword kw">else</span>
|
22
|
+
567: <span class="ruby-keyword kw">begin</span>
|
23
|
+
568: <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
|
+
569: <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
|
+
570: <span class="ruby-keyword kw">else</span>
|
26
|
+
571: <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
|
27
|
+
572: <span class="ruby-keyword kw">end</span>
|
28
|
+
573: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
29
|
+
574: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">reset</span>
|
30
|
+
575: <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
|
+
576: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Error accessing file: #{details}"</span>
|
32
|
+
577: <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
|
+
578: <span class="ruby-keyword kw">end</span>
|
34
|
+
579: <span class="ruby-keyword kw">end</span>
|
35
|
+
580: <span class="ruby-keyword kw">end</span>
|
36
|
+
581: <span class="ruby-keyword kw">end</span></pre>
|
30
37
|
</body>
|
31
38
|
</html>
|
@@ -5,34 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>add_mime_type (Mongrel::DirHandler)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
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
|
-
555: <span class="ruby-comment cmt"># not found, return a 404</span>
|
18
|
-
556: <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
|
-
557: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"File not found"</span>
|
20
|
-
558: <span class="ruby-keyword kw">end</span>
|
21
|
-
559: <span class="ruby-keyword kw">else</span>
|
22
|
-
560: <span class="ruby-keyword kw">begin</span>
|
23
|
-
561: <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
|
-
562: <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
|
-
563: <span class="ruby-keyword kw">else</span>
|
26
|
-
564: <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">response</span>)
|
27
|
-
565: <span class="ruby-keyword kw">end</span>
|
28
|
-
566: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">details</span>
|
29
|
-
567: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">reset</span>
|
30
|
-
568: <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
|
-
569: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Error accessing file: #{details}"</span>
|
32
|
-
570: <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
|
-
571: <span class="ruby-keyword kw">end</span>
|
34
|
-
572: <span class="ruby-keyword kw">end</span>
|
35
|
-
573: <span class="ruby-keyword kw">end</span>
|
36
|
-
574: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 585</span>
|
14
|
+
585: <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
|
+
586: <span class="ruby-constant">MIME_TYPES</span>[<span class="ruby-identifier">extension</span>] = <span class="ruby-identifier">type</span>
|
16
|
+
587: <span class="ruby-keyword kw">end</span></pre>
|
37
17
|
</body>
|
38
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 431</span>
|
14
|
+
431: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>)
|
15
|
+
432: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR_404_RESPONSE</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
|
16
|
+
433: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 436</span>
|
14
|
+
436: <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
|
+
437: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@response</span>)
|
16
|
+
438: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -86,13 +86,13 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
89
|
+
<a href="#M000019">error?</a>
|
90
|
+
<a href="#M000018">execute</a>
|
91
|
+
<a href="#M000017">finish</a>
|
92
|
+
<a href="#M000020">finished?</a>
|
93
|
+
<a href="#M000015">new</a>
|
94
|
+
<a href="#M000021">nread</a>
|
95
|
+
<a href="#M000016">reset</a>
|
96
96
|
</div>
|
97
97
|
</div>
|
98
98
|
|
@@ -114,12 +114,12 @@
|
|
114
114
|
<div id="methods">
|
115
115
|
<h3 class="section-bar">Public Class methods</h3>
|
116
116
|
|
117
|
-
<div id="method-
|
118
|
-
<a name="
|
117
|
+
<div id="method-M000015" class="method-detail">
|
118
|
+
<a name="M000015"></a>
|
119
119
|
|
120
120
|
<div class="method-heading">
|
121
|
-
<a href="HttpParser.src/
|
122
|
-
onclick="popupCode('HttpParser.src/
|
121
|
+
<a href="HttpParser.src/M000015.html" target="Code" class="method-signature"
|
122
|
+
onclick="popupCode('HttpParser.src/M000015.html');return false;">
|
123
123
|
<span class="method-name">parser.new → parser<br />
|
124
124
|
</span>
|
125
125
|
</a>
|
@@ -134,12 +134,12 @@ Creates a new parser.
|
|
134
134
|
|
135
135
|
<h3 class="section-bar">Public Instance methods</h3>
|
136
136
|
|
137
|
-
<div id="method-
|
138
|
-
<a name="
|
137
|
+
<div id="method-M000019" class="method-detail">
|
138
|
+
<a name="M000019"></a>
|
139
139
|
|
140
140
|
<div class="method-heading">
|
141
|
-
<a href="HttpParser.src/
|
142
|
-
onclick="popupCode('HttpParser.src/
|
141
|
+
<a href="HttpParser.src/M000019.html" target="Code" class="method-signature"
|
142
|
+
onclick="popupCode('HttpParser.src/M000019.html');return false;">
|
143
143
|
<span class="method-name">parser.error? → true/false<br />
|
144
144
|
</span>
|
145
145
|
</a>
|
@@ -152,12 +152,12 @@ Tells you whether the parser is in an error state.
|
|
152
152
|
</div>
|
153
153
|
</div>
|
154
154
|
|
155
|
-
<div id="method-
|
156
|
-
<a name="
|
155
|
+
<div id="method-M000018" class="method-detail">
|
156
|
+
<a name="M000018"></a>
|
157
157
|
|
158
158
|
<div class="method-heading">
|
159
|
-
<a href="HttpParser.src/
|
160
|
-
onclick="popupCode('HttpParser.src/
|
159
|
+
<a href="HttpParser.src/M000018.html" target="Code" class="method-signature"
|
160
|
+
onclick="popupCode('HttpParser.src/M000018.html');return false;">
|
161
161
|
<span class="method-name">parser.execute(req_hash, data) → Integer<br />
|
162
162
|
</span>
|
163
163
|
</a>
|
@@ -180,12 +180,12 @@ handling block.
|
|
180
180
|
</div>
|
181
181
|
</div>
|
182
182
|
|
183
|
-
<div id="method-
|
184
|
-
<a name="
|
183
|
+
<div id="method-M000017" class="method-detail">
|
184
|
+
<a name="M000017"></a>
|
185
185
|
|
186
186
|
<div class="method-heading">
|
187
|
-
<a href="HttpParser.src/
|
188
|
-
onclick="popupCode('HttpParser.src/
|
187
|
+
<a href="HttpParser.src/M000017.html" target="Code" class="method-signature"
|
188
|
+
onclick="popupCode('HttpParser.src/M000017.html');return false;">
|
189
189
|
<span class="method-name">parser.finish → true/false<br />
|
190
190
|
</span>
|
191
191
|
</a>
|
@@ -199,12 +199,12 @@ You should call reset after finish it or bad things will happen.
|
|
199
199
|
</div>
|
200
200
|
</div>
|
201
201
|
|
202
|
-
<div id="method-
|
203
|
-
<a name="
|
202
|
+
<div id="method-M000020" class="method-detail">
|
203
|
+
<a name="M000020"></a>
|
204
204
|
|
205
205
|
<div class="method-heading">
|
206
|
-
<a href="HttpParser.src/
|
207
|
-
onclick="popupCode('HttpParser.src/
|
206
|
+
<a href="HttpParser.src/M000020.html" target="Code" class="method-signature"
|
207
|
+
onclick="popupCode('HttpParser.src/M000020.html');return false;">
|
208
208
|
<span class="method-name">parser.finished? → true/false<br />
|
209
209
|
</span>
|
210
210
|
</a>
|
@@ -217,12 +217,12 @@ Tells you whether the parser is finished or not and in a good state.
|
|
217
217
|
</div>
|
218
218
|
</div>
|
219
219
|
|
220
|
-
<div id="method-
|
221
|
-
<a name="
|
220
|
+
<div id="method-M000021" class="method-detail">
|
221
|
+
<a name="M000021"></a>
|
222
222
|
|
223
223
|
<div class="method-heading">
|
224
|
-
<a href="HttpParser.src/
|
225
|
-
onclick="popupCode('HttpParser.src/
|
224
|
+
<a href="HttpParser.src/M000021.html" target="Code" class="method-signature"
|
225
|
+
onclick="popupCode('HttpParser.src/M000021.html');return false;">
|
226
226
|
<span class="method-name">parser.nread → Integer<br />
|
227
227
|
</span>
|
228
228
|
</a>
|
@@ -237,12 +237,12 @@ execute is called.
|
|
237
237
|
</div>
|
238
238
|
</div>
|
239
239
|
|
240
|
-
<div id="method-
|
241
|
-
<a name="
|
240
|
+
<div id="method-M000016" class="method-detail">
|
241
|
+
<a name="M000016"></a>
|
242
242
|
|
243
243
|
<div class="method-heading">
|
244
|
-
<a href="HttpParser.src/
|
245
|
-
onclick="popupCode('HttpParser.src/
|
244
|
+
<a href="HttpParser.src/M000016.html" target="Code" class="method-signature"
|
245
|
+
onclick="popupCode('HttpParser.src/M000016.html');return false;">
|
246
246
|
<span class="method-name">parser.reset → nil<br />
|
247
247
|
</span>
|
248
248
|
</a>
|
@@ -5,24 +5,24 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>new (Mongrel::HttpParser)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
13
|
<pre>/**
|
14
14
|
* call-seq:
|
15
|
-
* parser.
|
15
|
+
* parser.new -> parser
|
16
16
|
*
|
17
|
-
*
|
18
|
-
* set to 0 on initialize or reset calls and is incremented each time execute is called.
|
17
|
+
* Creates a new parser.
|
19
18
|
*/
|
20
|
-
VALUE
|
19
|
+
VALUE HttpParser_init(VALUE self)
|
21
20
|
{
|
22
21
|
http_parser *http = NULL;
|
23
22
|
DATA_GET(self, http_parser, http);
|
23
|
+
http_parser_init(http);
|
24
24
|
|
25
|
-
return
|
25
|
+
return self;
|
26
26
|
}</pre>
|
27
27
|
</body>
|
28
28
|
</html>
|
@@ -5,24 +5,25 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>reset (Mongrel::HttpParser)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
13
|
<pre>/**
|
14
14
|
* call-seq:
|
15
|
-
* parser.
|
15
|
+
* parser.reset -> nil
|
16
16
|
*
|
17
|
-
*
|
17
|
+
* Resets the parser to it's initial state so that you can reuse it
|
18
|
+
* rather than making new ones.
|
18
19
|
*/
|
19
|
-
VALUE
|
20
|
+
VALUE HttpParser_reset(VALUE self)
|
20
21
|
{
|
21
22
|
http_parser *http = NULL;
|
22
23
|
DATA_GET(self, http_parser, http);
|
23
24
|
http_parser_init(http);
|
24
25
|
|
25
|
-
return
|
26
|
+
return Qnil;
|
26
27
|
}</pre>
|
27
28
|
</body>
|
28
29
|
</html>
|
@@ -5,25 +5,25 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>finish (Mongrel::HttpParser)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
13
|
<pre>/**
|
14
14
|
* call-seq:
|
15
|
-
* parser.
|
15
|
+
* parser.finish -> true/false
|
16
16
|
*
|
17
|
-
*
|
18
|
-
*
|
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
19
|
*/
|
20
|
-
VALUE
|
20
|
+
VALUE HttpParser_finish(VALUE self)
|
21
21
|
{
|
22
22
|
http_parser *http = NULL;
|
23
23
|
DATA_GET(self, http_parser, http);
|
24
|
-
|
24
|
+
http_parser_finish(http);
|
25
25
|
|
26
|
-
return
|
26
|
+
return http_parser_is_finished(http) ? Qtrue : Qfalse;
|
27
27
|
}</pre>
|
28
28
|
</body>
|
29
29
|
</html>
|
@@ -5,25 +5,37 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>execute (Mongrel::HttpParser)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
13
|
<pre>/**
|
14
14
|
* call-seq:
|
15
|
-
* parser.
|
15
|
+
* parser.execute(req_hash, data) -> Integer
|
16
16
|
*
|
17
|
-
*
|
18
|
-
*
|
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.
|
19
25
|
*/
|
20
|
-
VALUE
|
26
|
+
VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data)
|
21
27
|
{
|
22
28
|
http_parser *http = NULL;
|
23
29
|
DATA_GET(self, http_parser, http);
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
+
}
|
27
39
|
}</pre>
|
28
40
|
</body>
|
29
41
|
</html>
|