serverside 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG +10 -0
  2. data/README +3 -3
  3. data/Rakefile +4 -4
  4. data/bin/serverside +4 -4
  5. data/doc/rdoc/classes/Daemon.html +4 -4
  6. data/doc/rdoc/classes/ServerSide.html +14 -74
  7. data/doc/rdoc/classes/ServerSide/Application.html +13 -13
  8. data/doc/rdoc/classes/ServerSide/{Connection.html → HTTP.html} +12 -18
  9. data/doc/rdoc/classes/ServerSide/HTTP/Connection.html +200 -0
  10. data/doc/rdoc/classes/ServerSide/{Connection → HTTP}/Const.html +6 -6
  11. data/doc/rdoc/classes/ServerSide/{Connection/Base.html → HTTP/Request.html} +213 -164
  12. data/doc/rdoc/classes/ServerSide/{Server.html → HTTP/Server.html} +22 -22
  13. data/doc/rdoc/classes/ServerSide/Router.html +496 -0
  14. data/doc/rdoc/classes/ServerSide/StaticFiles.html +31 -30
  15. data/doc/rdoc/classes/ServerSide/Template.html +12 -12
  16. data/doc/rdoc/created.rid +1 -1
  17. data/doc/rdoc/files/CHANGELOG.html +22 -4
  18. data/doc/rdoc/files/COPYING.html +1 -1
  19. data/doc/rdoc/files/README.html +4 -4
  20. data/doc/rdoc/files/lib/serverside/application_rb.html +1 -1
  21. data/doc/rdoc/files/lib/serverside/cluster_rb.html +1 -1
  22. data/doc/rdoc/files/lib/serverside/connection_rb.html +1 -1
  23. data/doc/rdoc/files/lib/serverside/core_ext_rb.html +1 -1
  24. data/doc/rdoc/files/lib/serverside/daemon_rb.html +1 -1
  25. data/doc/rdoc/files/lib/serverside/request_rb.html +101 -0
  26. data/doc/rdoc/files/lib/serverside/routing_rb.html +1 -1
  27. data/doc/rdoc/files/lib/serverside/server_rb.html +1 -1
  28. data/doc/rdoc/files/lib/serverside/static_rb.html +1 -1
  29. data/doc/rdoc/files/lib/serverside/template_rb.html +1 -1
  30. data/doc/rdoc/files/lib/serverside_rb.html +1 -1
  31. data/doc/rdoc/fr_class_index.html +6 -5
  32. data/doc/rdoc/fr_file_index.html +1 -0
  33. data/doc/rdoc/fr_method_index.html +31 -31
  34. data/lib/serverside/application.rb +1 -1
  35. data/lib/serverside/connection.rb +12 -141
  36. data/lib/serverside/request.rb +150 -0
  37. data/lib/serverside/routing.rb +117 -126
  38. data/lib/serverside/server.rb +13 -12
  39. data/lib/serverside/static.rb +1 -1
  40. data/test/functional/primitive_static_server_test.rb +3 -3
  41. data/test/functional/routing_server.rb +1 -1
  42. data/test/functional/routing_server_test.rb +1 -1
  43. data/test/functional/static_profile.rb +1 -1
  44. data/test/functional/static_server_test.rb +2 -2
  45. data/test/unit/connection_test.rb +30 -224
  46. data/test/unit/request_test.rb +248 -0
  47. data/test/unit/routing_test.rb +4 -4
  48. data/test/unit/server_test.rb +10 -8
  49. data/test/unit/static_test.rb +1 -1
  50. metadata +61 -56
  51. data/doc/rdoc/classes/ServerSide/Connection/Router.html +0 -493
@@ -5,7 +5,7 @@
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
- <title>Module: ServerSide::Connection::Const</title>
8
+ <title>Module: ServerSide::HTTP::Const</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
11
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
@@ -50,13 +50,13 @@
50
50
  <table class="header-table">
51
51
  <tr class="top-aligned-row">
52
52
  <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">ServerSide::Connection::Const</td>
53
+ <td class="class-name-in-header">ServerSide::HTTP::Const</td>
54
54
  </tr>
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../../files/lib/serverside/connection_rb.html">
59
- lib/serverside/connection.rb
58
+ <a href="../../../files/lib/serverside/request_rb.html">
59
+ lib/serverside/request.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -109,8 +109,8 @@ of responses faster than otherwise.
109
109
  <td width="3em">&nbsp;</td>
110
110
  <td class="context-item-desc">
111
111
  Here&#8217;s a nice one - parses the first line of a request. The expected
112
- format is as follows: &lt;method&gt; &lt;/path&gt;[/][?&lt;query&gt;]
113
- HTTP/&lt;version&gt;
112
+ format is as follows: &lt;method&gt; &lt;/path&gt;[/][?&lt;query&gt;] <a
113
+ href="../HTTP.html">HTTP</a>/&lt;version&gt;
114
114
 
115
115
  </td>
116
116
  </tr>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
- <title>Class: ServerSide::Connection::Base</title>
8
+ <title>Class: ServerSide::HTTP::Request</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
11
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
@@ -50,13 +50,13 @@
50
50
  <table class="header-table">
51
51
  <tr class="top-aligned-row">
52
52
  <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">ServerSide::Connection::Base</td>
53
+ <td class="class-name-in-header">ServerSide::HTTP::Request</td>
54
54
  </tr>
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../../files/lib/serverside/connection_rb.html">
59
- lib/serverside/connection.rb
58
+ <a href="../../../files/lib/serverside/request_rb.html">
59
+ lib/serverside/request.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -82,12 +82,12 @@
82
82
 
83
83
  <div id="description">
84
84
  <p>
85
- This is the base request class. When a new request is created, it starts a
86
- thread in which it is parsed and processed.
87
- </p>
88
- <p>
89
- <a href="Base.html">Connection::Base</a> is overriden by applications to
90
- create application-specific behavior.
85
+ The HTTPRequest class encapsulates <a href="../HTTP.html">HTTP</a>
86
+ requests. The request class contains methods for parsing the request and
87
+ rendering a response. <a href="../HTTP.html">HTTP</a> requests are created
88
+ by the connection. Descendants of HTTPRequest can be created When a
89
+ connection is created, it creates new requests in a loop until the
90
+ connection is closed.
91
91
  </p>
92
92
 
93
93
  </div>
@@ -99,16 +99,16 @@ create application-specific behavior.
99
99
  <h3 class="section-bar">Methods</h3>
100
100
 
101
101
  <div class="name-list">
102
- <a href="#M000039">delete_cookie</a>&nbsp;&nbsp;
103
- <a href="#M000030">new</a>&nbsp;&nbsp;
104
- <a href="#M000034">parse_cookies</a>&nbsp;&nbsp;
105
- <a href="#M000033">parse_parameters</a>&nbsp;&nbsp;
106
- <a href="#M000032">parse_request</a>&nbsp;&nbsp;
107
- <a href="#M000031">process</a>&nbsp;&nbsp;
108
- <a href="#M000036">redirect</a>&nbsp;&nbsp;
109
- <a href="#M000035">send_response</a>&nbsp;&nbsp;
110
- <a href="#M000038">set_cookie</a>&nbsp;&nbsp;
111
- <a href="#M000037">stream</a>&nbsp;&nbsp;
102
+ <a href="#M000038">delete_cookie</a>&nbsp;&nbsp;
103
+ <a href="#M000029">new</a>&nbsp;&nbsp;
104
+ <a href="#M000031">parse</a>&nbsp;&nbsp;
105
+ <a href="#M000033">parse_cookies</a>&nbsp;&nbsp;
106
+ <a href="#M000032">parse_parameters</a>&nbsp;&nbsp;
107
+ <a href="#M000030">process</a>&nbsp;&nbsp;
108
+ <a href="#M000035">redirect</a>&nbsp;&nbsp;
109
+ <a href="#M000034">send_response</a>&nbsp;&nbsp;
110
+ <a href="#M000037">set_cookie</a>&nbsp;&nbsp;
111
+ <a href="#M000036">stream</a>&nbsp;&nbsp;
112
112
  </div>
113
113
  </div>
114
114
 
@@ -130,6 +130,64 @@ create application-specific behavior.
130
130
 
131
131
 
132
132
 
133
+ <div id="attribute-list">
134
+ <h3 class="section-bar">Attributes</h3>
135
+
136
+ <div class="name-list">
137
+ <table>
138
+ <tr class="top-aligned-row context-row">
139
+ <td class="context-item-name">conn</td>
140
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
141
+ <td class="context-item-desc"></td>
142
+ </tr>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">cookies</td>
145
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
146
+ <td class="context-item-desc"></td>
147
+ </tr>
148
+ <tr class="top-aligned-row context-row">
149
+ <td class="context-item-name">headers</td>
150
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
151
+ <td class="context-item-desc"></td>
152
+ </tr>
153
+ <tr class="top-aligned-row context-row">
154
+ <td class="context-item-name">method</td>
155
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
156
+ <td class="context-item-desc"></td>
157
+ </tr>
158
+ <tr class="top-aligned-row context-row">
159
+ <td class="context-item-name">parameters</td>
160
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
161
+ <td class="context-item-desc"></td>
162
+ </tr>
163
+ <tr class="top-aligned-row context-row">
164
+ <td class="context-item-name">path</td>
165
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
166
+ <td class="context-item-desc"></td>
167
+ </tr>
168
+ <tr class="top-aligned-row context-row">
169
+ <td class="context-item-name">persistent</td>
170
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
171
+ <td class="context-item-desc"></td>
172
+ </tr>
173
+ <tr class="top-aligned-row context-row">
174
+ <td class="context-item-name">query</td>
175
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
176
+ <td class="context-item-desc"></td>
177
+ </tr>
178
+ <tr class="top-aligned-row context-row">
179
+ <td class="context-item-name">response_cookies</td>
180
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
181
+ <td class="context-item-desc"></td>
182
+ </tr>
183
+ <tr class="top-aligned-row context-row">
184
+ <td class="context-item-name">version</td>
185
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
186
+ <td class="context-item-desc"></td>
187
+ </tr>
188
+ </table>
189
+ </div>
190
+ </div>
133
191
 
134
192
 
135
193
 
@@ -137,29 +195,29 @@ create application-specific behavior.
137
195
  <div id="methods">
138
196
  <h3 class="section-bar">Public Class methods</h3>
139
197
 
140
- <div id="method-M000030" class="method-detail">
141
- <a name="M000030"></a>
198
+ <div id="method-M000029" class="method-detail">
199
+ <a name="M000029"></a>
142
200
 
143
201
  <div class="method-heading">
144
- <a href="#M000030" class="method-signature">
202
+ <a href="#M000029" class="method-signature">
145
203
  <span class="method-name">new</span><span class="method-args">(conn)</span>
146
204
  </a>
147
205
  </div>
148
206
 
149
207
  <div class="method-description">
150
208
  <p>
151
- Initializes the request instance. A new thread is created for processing
152
- requests.
209
+ Initializes the request instance. Any descendants of <a
210
+ href="Request.html">HTTP::Request</a> which override the initialize method
211
+ must receive conn as the single argument, and copy it to @conn.
153
212
  </p>
154
213
  <p><a class="source-toggle" href="#"
155
- onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
156
- <div class="method-source-code" id="M000030-source">
214
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
215
+ <div class="method-source-code" id="M000029-source">
157
216
  <pre>
158
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 54</span>
217
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 54</span>
159
218
  54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">conn</span>)
160
219
  55: <span class="ruby-ivar">@conn</span> = <span class="ruby-identifier">conn</span>
161
- 56: <span class="ruby-ivar">@thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {<span class="ruby-identifier">process</span>}
162
- 57: <span class="ruby-keyword kw">end</span>
220
+ 56: <span class="ruby-keyword kw">end</span>
163
221
  </pre>
164
222
  </div>
165
223
  </div>
@@ -167,11 +225,11 @@ requests.
167
225
 
168
226
  <h3 class="section-bar">Public Instance methods</h3>
169
227
 
170
- <div id="method-M000039" class="method-detail">
171
- <a name="M000039"></a>
228
+ <div id="method-M000038" class="method-detail">
229
+ <a name="M000038"></a>
172
230
 
173
231
  <div class="method-heading">
174
- <a href="#M000039" class="method-signature">
232
+ <a href="#M000038" class="method-signature">
175
233
  <span class="method-name">delete_cookie</span><span class="method-args">(name)</span>
176
234
  </a>
177
235
  </div>
@@ -182,44 +240,58 @@ Marks a cookie as deleted. The cookie is given an expires stamp in the
182
240
  past.
183
241
  </p>
184
242
  <p><a class="source-toggle" href="#"
185
- onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
186
- <div class="method-source-code" id="M000039-source">
243
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
244
+ <div class="method-source-code" id="M000038-source">
187
245
  <pre>
188
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 156</span>
189
- 156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_cookie</span>(<span class="ruby-identifier">name</span>)
190
- 157: <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieExpiredTime</span>)
191
- 158: <span class="ruby-keyword kw">end</span>
246
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 145</span>
247
+ 145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_cookie</span>(<span class="ruby-identifier">name</span>)
248
+ 146: <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieExpiredTime</span>)
249
+ 147: <span class="ruby-keyword kw">end</span>
192
250
  </pre>
193
251
  </div>
194
252
  </div>
195
253
  </div>
196
254
 
197
- <div id="method-M000034" class="method-detail">
198
- <a name="M000034"></a>
255
+ <div id="method-M000031" class="method-detail">
256
+ <a name="M000031"></a>
199
257
 
200
258
  <div class="method-heading">
201
- <a href="#M000034" class="method-signature">
202
- <span class="method-name">parse_cookies</span><span class="method-args">()</span>
259
+ <a href="#M000031" class="method-signature">
260
+ <span class="method-name">parse</span><span class="method-args">()</span>
203
261
  </a>
204
262
  </div>
205
263
 
206
264
  <div class="method-description">
207
265
  <p>
208
- Parses cookie values passed in the request
266
+ Parses an <a href="../HTTP.html">HTTP</a> request. If the request is not
267
+ valid, nil is returned. Otherwise, the <a href="../HTTP.html">HTTP</a>
268
+ headers are returned. Also determines whether the connection is persistent
269
+ (by checking the <a href="../HTTP.html">HTTP</a> version and the &#8216;<a
270
+ href="Connection.html">Connection</a>&#8217; header).
209
271
  </p>
210
272
  <p><a class="source-toggle" href="#"
211
- onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
212
- <div class="method-source-code" id="M000034-source">
273
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
274
+ <div class="method-source-code" id="M000031-source">
213
275
  <pre>
214
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 109</span>
215
- 109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cookies</span>
216
- 110: <span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>].<span class="ruby-identifier">split</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieSplit</span>).<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
217
- 111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieRegexp</span>
218
- 112: <span class="ruby-identifier">m</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">uri_unescape</span>
219
- 113: <span class="ruby-keyword kw">end</span>
220
- 114: <span class="ruby-identifier">m</span>
221
- 115: <span class="ruby-keyword kw">end</span>
222
- 116: <span class="ruby-keyword kw">end</span>
276
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 67</span>
277
+ 67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>
278
+ 68: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">gets</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestRegexp</span>
279
+ 69: <span class="ruby-ivar">@method</span>, <span class="ruby-ivar">@path</span>, <span class="ruby-ivar">@query</span>, <span class="ruby-ivar">@version</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">$2</span>, <span class="ruby-identifier">$3</span>, <span class="ruby-identifier">$4</span>
280
+ 70: <span class="ruby-ivar">@parameters</span> = <span class="ruby-ivar">@query</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">parse_parameters</span>(<span class="ruby-ivar">@query</span>) <span class="ruby-operator">:</span> {}
281
+ 71: <span class="ruby-ivar">@headers</span> = {}
282
+ 72: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">line</span> = <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">gets</span>)
283
+ 73: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">line</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">LineBreak</span>)
284
+ 74: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderRegexp</span>
285
+ 75: <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">freeze</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">freeze</span>
286
+ 76: <span class="ruby-keyword kw">end</span>
287
+ 77: <span class="ruby-keyword kw">end</span>
288
+ 78: <span class="ruby-ivar">@persistent</span> = (<span class="ruby-ivar">@version</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Version_1_1</span>) <span class="ruby-operator">&amp;&amp;</span>
289
+ 79: (<span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Connection</span>] <span class="ruby-operator">!=</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Close</span>)
290
+ 80: <span class="ruby-ivar">@cookies</span> = <span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">parse_cookies</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">EmptyHash</span>
291
+ 81: <span class="ruby-ivar">@response_cookies</span> = <span class="ruby-keyword kw">nil</span>
292
+ 82:
293
+ 83: <span class="ruby-ivar">@headers</span>
294
+ 84: <span class="ruby-keyword kw">end</span>
223
295
  </pre>
224
296
  </div>
225
297
  </div>
@@ -230,28 +302,27 @@ Parses cookie values passed in the request
230
302
 
231
303
  <div class="method-heading">
232
304
  <a href="#M000033" class="method-signature">
233
- <span class="method-name">parse_parameters</span><span class="method-args">(query)</span>
305
+ <span class="method-name">parse_cookies</span><span class="method-args">()</span>
234
306
  </a>
235
307
  </div>
236
308
 
237
309
  <div class="method-description">
238
310
  <p>
239
- Parses query parameters by splitting the query string and unescaping
240
- parameter values.
311
+ Parses cookie values passed in the request
241
312
  </p>
242
313
  <p><a class="source-toggle" href="#"
243
314
  onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
244
315
  <div class="method-source-code" id="M000033-source">
245
316
  <pre>
246
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 99</span>
247
- 99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_parameters</span>(<span class="ruby-identifier">query</span>)
248
- 100: <span class="ruby-identifier">query</span>.<span class="ruby-identifier">split</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Ampersand</span>).<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
249
- 101: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ParameterRegexp</span>
250
- 102: <span class="ruby-identifier">m</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">uri_unescape</span>
251
- 103: <span class="ruby-keyword kw">end</span>
252
- 104: <span class="ruby-identifier">m</span>
253
- 105: <span class="ruby-keyword kw">end</span>
254
- 106: <span class="ruby-keyword kw">end</span>
317
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 98</span>
318
+ 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cookies</span>
319
+ 99: <span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>].<span class="ruby-identifier">split</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieSplit</span>).<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
320
+ 100: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">CookieRegexp</span>
321
+ 101: <span class="ruby-identifier">m</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">uri_unescape</span>
322
+ 102: <span class="ruby-keyword kw">end</span>
323
+ 103: <span class="ruby-identifier">m</span>
324
+ 104: <span class="ruby-keyword kw">end</span>
325
+ 105: <span class="ruby-keyword kw">end</span>
255
326
  </pre>
256
327
  </div>
257
328
  </div>
@@ -262,86 +333,64 @@ parameter values.
262
333
 
263
334
  <div class="method-heading">
264
335
  <a href="#M000032" class="method-signature">
265
- <span class="method-name">parse_request</span><span class="method-args">()</span>
336
+ <span class="method-name">parse_parameters</span><span class="method-args">(query)</span>
266
337
  </a>
267
338
  </div>
268
339
 
269
340
  <div class="method-description">
270
341
  <p>
271
- Parses an HTTP request. If the request is not valid, nil is returned.
272
- Otherwise, the HTTP headers are returned. Also determines whether the
273
- connection is persistent (by checking the HTTP version and the &#8216;<a
274
- href="../Connection.html">Connection</a>&#8217; header).
342
+ Parses query parameters by splitting the query string and unescaping
343
+ parameter values.
275
344
  </p>
276
345
  <p><a class="source-toggle" href="#"
277
346
  onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
278
347
  <div class="method-source-code" id="M000032-source">
279
348
  <pre>
280
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 78</span>
281
- 78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_request</span>
282
- 79: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">gets</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestRegexp</span>
283
- 80: <span class="ruby-ivar">@method</span>, <span class="ruby-ivar">@path</span>, <span class="ruby-ivar">@query</span>, <span class="ruby-ivar">@version</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">$2</span>, <span class="ruby-identifier">$3</span>, <span class="ruby-identifier">$4</span>
284
- 81: <span class="ruby-ivar">@parameters</span> = <span class="ruby-ivar">@query</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">parse_parameters</span>(<span class="ruby-ivar">@query</span>) <span class="ruby-operator">:</span> {}
285
- 82: <span class="ruby-ivar">@headers</span> = {}
286
- 83: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">line</span> = <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">gets</span>)
287
- 84: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">line</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">LineBreak</span>)
288
- 85: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderRegexp</span>
289
- 86: <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">freeze</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">freeze</span>
290
- 87: <span class="ruby-keyword kw">end</span>
291
- 88: <span class="ruby-keyword kw">end</span>
292
- 89: <span class="ruby-ivar">@persistent</span> = (<span class="ruby-ivar">@version</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Version_1_1</span>) <span class="ruby-operator">&amp;&amp;</span>
293
- 90: (<span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Connection</span>] <span class="ruby-operator">!=</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Close</span>)
294
- 91: <span class="ruby-ivar">@cookies</span> = <span class="ruby-ivar">@headers</span>[<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">parse_cookies</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">EmptyHash</span>
295
- 92: <span class="ruby-ivar">@response_cookies</span> = <span class="ruby-keyword kw">nil</span>
296
- 93:
297
- 94: <span class="ruby-ivar">@headers</span>
349
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 88</span>
350
+ 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_parameters</span>(<span class="ruby-identifier">query</span>)
351
+ 89: <span class="ruby-identifier">query</span>.<span class="ruby-identifier">split</span>(<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Ampersand</span>).<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
352
+ 90: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">ParameterRegexp</span>
353
+ 91: <span class="ruby-identifier">m</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">uri_unescape</span>
354
+ 92: <span class="ruby-keyword kw">end</span>
355
+ 93: <span class="ruby-identifier">m</span>
356
+ 94: <span class="ruby-keyword kw">end</span>
298
357
  95: <span class="ruby-keyword kw">end</span>
299
358
  </pre>
300
359
  </div>
301
360
  </div>
302
361
  </div>
303
362
 
304
- <div id="method-M000031" class="method-detail">
305
- <a name="M000031"></a>
363
+ <div id="method-M000030" class="method-detail">
364
+ <a name="M000030"></a>
306
365
 
307
366
  <div class="method-heading">
308
- <a href="#M000031" class="method-signature">
367
+ <a href="#M000030" class="method-signature">
309
368
  <span class="method-name">process</span><span class="method-args">()</span>
310
369
  </a>
311
370
  </div>
312
371
 
313
372
  <div class="method-description">
314
373
  <p>
315
- Processes incoming requests by parsing them and then responding. If any
316
- error occurs, or the connection is not persistent, the connection is
317
- closed.
374
+ Processes the request by parsing it and then responding.
318
375
  </p>
319
376
  <p><a class="source-toggle" href="#"
320
- onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
321
- <div class="method-source-code" id="M000031-source">
377
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
378
+ <div class="method-source-code" id="M000030-source">
322
379
  <pre>
323
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 62</span>
324
- 62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>
325
- 63: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
326
- 64: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">parse_request</span>
327
- 65: <span class="ruby-identifier">respond</span>
328
- 66: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@persistent</span>
329
- 67: <span class="ruby-keyword kw">end</span>
330
- 68: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
331
- 69: <span class="ruby-comment cmt"># We don't care. Just close the connection.</span>
332
- 70: <span class="ruby-keyword kw">ensure</span>
333
- 71: <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">close</span>
334
- 72: <span class="ruby-keyword kw">end</span>
380
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 59</span>
381
+ 59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>
382
+ 60: <span class="ruby-identifier">parse</span> <span class="ruby-operator">&amp;&amp;</span> ((<span class="ruby-identifier">respond</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">true</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@persistent</span>)
383
+ 61: <span class="ruby-keyword kw">end</span>
335
384
  </pre>
336
385
  </div>
337
386
  </div>
338
387
  </div>
339
388
 
340
- <div id="method-M000036" class="method-detail">
341
- <a name="M000036"></a>
389
+ <div id="method-M000035" class="method-detail">
390
+ <a name="M000035"></a>
342
391
 
343
392
  <div class="method-heading">
344
- <a href="#M000036" class="method-signature">
393
+ <a href="#M000035" class="method-signature">
345
394
  <span class="method-name">redirect</span><span class="method-args">(location, permanent = false)</span>
346
395
  </a>
347
396
  </div>
@@ -351,65 +400,65 @@ closed.
351
400
  Send a redirect response.
352
401
  </p>
353
402
  <p><a class="source-toggle" href="#"
354
- onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
355
- <div class="method-source-code" id="M000036-source">
403
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
404
+ <div class="method-source-code" id="M000035-source">
356
405
  <pre>
357
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 137</span>
358
- 137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">location</span>, <span class="ruby-identifier">permanent</span> = <span class="ruby-keyword kw">false</span>)
359
- 138: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusRedirect</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">permanent</span> <span class="ruby-value">? </span><span class="ruby-value">301</span> <span class="ruby-operator">:</span> <span class="ruby-value">302</span>, <span class="ruby-identifier">location</span>])
360
- 139: <span class="ruby-keyword kw">rescue</span>
361
- 140: <span class="ruby-keyword kw">ensure</span>
362
- 141: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>
363
- 142: <span class="ruby-keyword kw">end</span>
406
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 126</span>
407
+ 126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">location</span>, <span class="ruby-identifier">permanent</span> = <span class="ruby-keyword kw">false</span>)
408
+ 127: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusRedirect</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">permanent</span> <span class="ruby-value">? </span><span class="ruby-value">301</span> <span class="ruby-operator">:</span> <span class="ruby-value">302</span>, <span class="ruby-identifier">location</span>])
409
+ 128: <span class="ruby-keyword kw">rescue</span>
410
+ 129: <span class="ruby-keyword kw">ensure</span>
411
+ 130: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>
412
+ 131: <span class="ruby-keyword kw">end</span>
364
413
  </pre>
365
414
  </div>
366
415
  </div>
367
416
  </div>
368
417
 
369
- <div id="method-M000035" class="method-detail">
370
- <a name="M000035"></a>
418
+ <div id="method-M000034" class="method-detail">
419
+ <a name="M000034"></a>
371
420
 
372
421
  <div class="method-heading">
373
- <a href="#M000035" class="method-signature">
422
+ <a href="#M000034" class="method-signature">
374
423
  <span class="method-name">send_response</span><span class="method-args">(status, content_type, body = nil, content_length = nil, headers = nil)</span>
375
424
  </a>
376
425
  </div>
377
426
 
378
427
  <div class="method-description">
379
428
  <p>
380
- Sends an HTTP response.
429
+ Sends an <a href="../HTTP.html">HTTP</a> response.
381
430
  </p>
382
431
  <p><a class="source-toggle" href="#"
383
- onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
384
- <div class="method-source-code" id="M000035-source">
432
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
433
+ <div class="method-source-code" id="M000034-source">
385
434
  <pre>
386
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 119</span>
387
- 119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_response</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">content_type</span>, <span class="ruby-identifier">body</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">content_length</span> = <span class="ruby-keyword kw">nil</span>,
388
- 120: <span class="ruby-identifier">headers</span> = <span class="ruby-keyword kw">nil</span>)
389
- 121: <span class="ruby-identifier">h</span> = <span class="ruby-identifier">headers</span> <span class="ruby-value">? </span>
390
- 122: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value str">''</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">kv</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Header</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">kv</span>)} <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>
391
- 123:
392
- 124: <span class="ruby-identifier">content_length</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">length</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_length</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">body</span>
393
- 125: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_length</span>.<span class="ruby-identifier">nil?</span>
394
- 126:
395
- 127: <span class="ruby-comment cmt"># Select the right format to use according to circumstances.</span>
396
- 128: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> ((<span class="ruby-ivar">@persistent</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusPersist</span> <span class="ruby-operator">:</span>
397
- 129: (<span class="ruby-identifier">body</span> <span class="ruby-value">? </span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusClose</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusStream</span>)) <span class="ruby-operator">%</span>
398
- 130: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">content_type</span>, <span class="ruby-identifier">h</span>, <span class="ruby-ivar">@response_cookies</span>, <span class="ruby-identifier">content_length</span>])
399
- 131: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">body</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>
400
- 132: <span class="ruby-keyword kw">rescue</span>
401
- 133: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>
402
- 134: <span class="ruby-keyword kw">end</span>
435
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 108</span>
436
+ 108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_response</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">content_type</span>, <span class="ruby-identifier">body</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">content_length</span> = <span class="ruby-keyword kw">nil</span>,
437
+ 109: <span class="ruby-identifier">headers</span> = <span class="ruby-keyword kw">nil</span>)
438
+ 110: <span class="ruby-identifier">h</span> = <span class="ruby-identifier">headers</span> <span class="ruby-value">? </span>
439
+ 111: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value str">''</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">kv</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">Header</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">kv</span>)} <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>
440
+ 112:
441
+ 113: <span class="ruby-identifier">content_length</span> = <span class="ruby-identifier">body</span>.<span class="ruby-identifier">length</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_length</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">body</span>
442
+ 114: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_length</span>.<span class="ruby-identifier">nil?</span>
443
+ 115:
444
+ 116: <span class="ruby-comment cmt"># Select the right format to use according to circumstances.</span>
445
+ 117: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> ((<span class="ruby-ivar">@persistent</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusPersist</span> <span class="ruby-operator">:</span>
446
+ 118: (<span class="ruby-identifier">body</span> <span class="ruby-value">? </span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusClose</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">StatusStream</span>)) <span class="ruby-operator">%</span>
447
+ 119: [<span class="ruby-identifier">status</span>, <span class="ruby-identifier">content_type</span>, <span class="ruby-identifier">h</span>, <span class="ruby-ivar">@response_cookies</span>, <span class="ruby-identifier">content_length</span>])
448
+ 120: <span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">body</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>
449
+ 121: <span class="ruby-keyword kw">rescue</span>
450
+ 122: <span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>
451
+ 123: <span class="ruby-keyword kw">end</span>
403
452
  </pre>
404
453
  </div>
405
454
  </div>
406
455
  </div>
407
456
 
408
- <div id="method-M000038" class="method-detail">
409
- <a name="M000038"></a>
457
+ <div id="method-M000037" class="method-detail">
458
+ <a name="M000037"></a>
410
459
 
411
460
  <div class="method-heading">
412
- <a href="#M000038" class="method-signature">
461
+ <a href="#M000037" class="method-signature">
413
462
  <span class="method-name">set_cookie</span><span class="method-args">(name, value, expires)</span>
414
463
  </a>
415
464
  </div>
@@ -419,24 +468,24 @@ Sends an HTTP response.
419
468
  Sets a cookie to be included in the response.
420
469
  </p>
421
470
  <p><a class="source-toggle" href="#"
422
- onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
423
- <div class="method-source-code" id="M000038-source">
471
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
472
+ <div class="method-source-code" id="M000037-source">
424
473
  <pre>
425
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 150</span>
426
- 150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expires</span>)
427
- 151: <span class="ruby-ivar">@response_cookies</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
428
- 152: <span class="ruby-ivar">@response_cookies</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SetCookie</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span>, <span class="ruby-identifier">expires</span>.<span class="ruby-identifier">rfc2822</span>])
429
- 153: <span class="ruby-keyword kw">end</span>
474
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 139</span>
475
+ 139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cookie</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expires</span>)
476
+ 140: <span class="ruby-ivar">@response_cookies</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;&quot;</span>
477
+ 141: <span class="ruby-ivar">@response_cookies</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">SetCookie</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span>, <span class="ruby-identifier">expires</span>.<span class="ruby-identifier">rfc2822</span>])
478
+ 142: <span class="ruby-keyword kw">end</span>
430
479
  </pre>
431
480
  </div>
432
481
  </div>
433
482
  </div>
434
483
 
435
- <div id="method-M000037" class="method-detail">
436
- <a name="M000037"></a>
484
+ <div id="method-M000036" class="method-detail">
485
+ <a name="M000036"></a>
437
486
 
438
487
  <div class="method-heading">
439
- <a href="#M000037" class="method-signature">
488
+ <a href="#M000036" class="method-signature">
440
489
  <span class="method-name">stream</span><span class="method-args">(body)</span>
441
490
  </a>
442
491
  </div>
@@ -446,13 +495,13 @@ Sets a cookie to be included in the response.
446
495
  Streams additional data to the client.
447
496
  </p>
448
497
  <p><a class="source-toggle" href="#"
449
- onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
450
- <div class="method-source-code" id="M000037-source">
498
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
499
+ <div class="method-source-code" id="M000036-source">
451
500
  <pre>
452
- <span class="ruby-comment cmt"># File lib/serverside/connection.rb, line 145</span>
453
- 145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stream</span>(<span class="ruby-identifier">body</span>)
454
- 146: (<span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">body</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>) <span class="ruby-keyword kw">rescue</span> (<span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>)
455
- 147: <span class="ruby-keyword kw">end</span>
501
+ <span class="ruby-comment cmt"># File lib/serverside/request.rb, line 134</span>
502
+ 134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stream</span>(<span class="ruby-identifier">body</span>)
503
+ 135: (<span class="ruby-ivar">@conn</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">body</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>) <span class="ruby-keyword kw">rescue</span> (<span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword kw">false</span>)
504
+ 136: <span class="ruby-keyword kw">end</span>
456
505
  </pre>
457
506
  </div>
458
507
  </div>