serverside 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/README +3 -3
- data/Rakefile +4 -4
- data/bin/serverside +4 -4
- data/doc/rdoc/classes/Daemon.html +4 -4
- data/doc/rdoc/classes/ServerSide.html +14 -74
- data/doc/rdoc/classes/ServerSide/Application.html +13 -13
- data/doc/rdoc/classes/ServerSide/{Connection.html → HTTP.html} +12 -18
- data/doc/rdoc/classes/ServerSide/HTTP/Connection.html +200 -0
- data/doc/rdoc/classes/ServerSide/{Connection → HTTP}/Const.html +6 -6
- data/doc/rdoc/classes/ServerSide/{Connection/Base.html → HTTP/Request.html} +213 -164
- data/doc/rdoc/classes/ServerSide/{Server.html → HTTP/Server.html} +22 -22
- data/doc/rdoc/classes/ServerSide/Router.html +496 -0
- data/doc/rdoc/classes/ServerSide/StaticFiles.html +31 -30
- data/doc/rdoc/classes/ServerSide/Template.html +12 -12
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGELOG.html +22 -4
- data/doc/rdoc/files/COPYING.html +1 -1
- data/doc/rdoc/files/README.html +4 -4
- data/doc/rdoc/files/lib/serverside/application_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/cluster_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/connection_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/core_ext_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/daemon_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/request_rb.html +101 -0
- data/doc/rdoc/files/lib/serverside/routing_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/server_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/static_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside/template_rb.html +1 -1
- data/doc/rdoc/files/lib/serverside_rb.html +1 -1
- data/doc/rdoc/fr_class_index.html +6 -5
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +31 -31
- data/lib/serverside/application.rb +1 -1
- data/lib/serverside/connection.rb +12 -141
- data/lib/serverside/request.rb +150 -0
- data/lib/serverside/routing.rb +117 -126
- data/lib/serverside/server.rb +13 -12
- data/lib/serverside/static.rb +1 -1
- data/test/functional/primitive_static_server_test.rb +3 -3
- data/test/functional/routing_server.rb +1 -1
- data/test/functional/routing_server_test.rb +1 -1
- data/test/functional/static_profile.rb +1 -1
- data/test/functional/static_server_test.rb +2 -2
- data/test/unit/connection_test.rb +30 -224
- data/test/unit/request_test.rb +248 -0
- data/test/unit/routing_test.rb +4 -4
- data/test/unit/server_test.rb +10 -8
- data/test/unit/static_test.rb +1 -1
- metadata +61 -56
- data/doc/rdoc/classes/ServerSide/Connection/Router.html +0 -493
@@ -75,7 +75,7 @@
|
|
75
75
|
<div id="description">
|
76
76
|
<p>
|
77
77
|
This module provides functionality for serving files and directory listings
|
78
|
-
over HTTP.
|
78
|
+
over <a href="HTTP.html">HTTP</a>.
|
79
79
|
</p>
|
80
80
|
|
81
81
|
</div>
|
@@ -87,10 +87,10 @@ over HTTP. It is mainly used by ServerSide::Connection::Static.
|
|
87
87
|
<h3 class="section-bar">Methods</h3>
|
88
88
|
|
89
89
|
<div class="name-list">
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
90
|
+
<a href="#M000023">serve_dir</a>
|
91
|
+
<a href="#M000022">serve_file</a>
|
92
|
+
<a href="#M000025">serve_static</a>
|
93
|
+
<a href="#M000024">serve_template</a>
|
94
94
|
</div>
|
95
95
|
</div>
|
96
96
|
|
@@ -118,22 +118,23 @@ over HTTP. It is mainly used by ServerSide::Connection::Static.
|
|
118
118
|
<div id="methods">
|
119
119
|
<h3 class="section-bar">Public Instance methods</h3>
|
120
120
|
|
121
|
-
<div id="method-
|
122
|
-
<a name="
|
121
|
+
<div id="method-M000023" class="method-detail">
|
122
|
+
<a name="M000023"></a>
|
123
123
|
|
124
124
|
<div class="method-heading">
|
125
|
-
<a href="#
|
125
|
+
<a href="#M000023" class="method-signature">
|
126
126
|
<span class="method-name">serve_dir</span><span class="method-args">(dir)</span>
|
127
127
|
</a>
|
128
128
|
</div>
|
129
129
|
|
130
130
|
<div class="method-description">
|
131
131
|
<p>
|
132
|
-
Serves a directory listing over HTTP in the form of
|
132
|
+
Serves a directory listing over <a href="HTTP.html">HTTP</a> in the form of
|
133
|
+
an HTML page.
|
133
134
|
</p>
|
134
135
|
<p><a class="source-toggle" href="#"
|
135
|
-
onclick="toggleCode('
|
136
|
-
<div class="method-source-code" id="
|
136
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
137
|
+
<div class="method-source-code" id="M000023-source">
|
137
138
|
<pre>
|
138
139
|
<span class="ruby-comment cmt"># File lib/serverside/static.rb, line 65</span>
|
139
140
|
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">serve_dir</span>(<span class="ruby-identifier">dir</span>)
|
@@ -148,25 +149,25 @@ Serves a directory listing over HTTP in the form of an HTML page.
|
|
148
149
|
</div>
|
149
150
|
</div>
|
150
151
|
|
151
|
-
<div id="method-
|
152
|
-
<a name="
|
152
|
+
<div id="method-M000022" class="method-detail">
|
153
|
+
<a name="M000022"></a>
|
153
154
|
|
154
155
|
<div class="method-heading">
|
155
|
-
<a href="#
|
156
|
+
<a href="#M000022" class="method-signature">
|
156
157
|
<span class="method-name">serve_file</span><span class="method-args">(fn)</span>
|
157
158
|
</a>
|
158
159
|
</div>
|
159
160
|
|
160
161
|
<div class="method-description">
|
161
162
|
<p>
|
162
|
-
Serves a file over HTTP. The file is cached in
|
163
|
-
If the If-None-Match header is included with an
|
164
|
-
the file’s current ETag. If there’s
|
165
|
-
rendered.
|
163
|
+
Serves a file over <a href="HTTP.html">HTTP</a>. The file is cached in
|
164
|
+
memory for later retrieval. If the If-None-Match header is included with an
|
165
|
+
ETag, it is checked against the file’s current ETag. If there’s
|
166
|
+
a match, a 304 response is rendered.
|
166
167
|
</p>
|
167
168
|
<p><a class="source-toggle" href="#"
|
168
|
-
onclick="toggleCode('
|
169
|
-
<div class="method-source-code" id="
|
169
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
170
|
+
<div class="method-source-code" id="M000022-source">
|
170
171
|
<pre>
|
171
172
|
<span class="ruby-comment cmt"># File lib/serverside/static.rb, line 43</span>
|
172
173
|
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">serve_file</span>(<span class="ruby-identifier">fn</span>)
|
@@ -194,11 +195,11 @@ rendered.
|
|
194
195
|
</div>
|
195
196
|
</div>
|
196
197
|
|
197
|
-
<div id="method-
|
198
|
-
<a name="
|
198
|
+
<div id="method-M000025" class="method-detail">
|
199
|
+
<a name="M000025"></a>
|
199
200
|
|
200
201
|
<div class="method-heading">
|
201
|
-
<a href="#
|
202
|
+
<a href="#M000025" class="method-signature">
|
202
203
|
<span class="method-name">serve_static</span><span class="method-args">(path)</span>
|
203
204
|
</a>
|
204
205
|
</div>
|
@@ -208,8 +209,8 @@ rendered.
|
|
208
209
|
Serves static files and directory listings.
|
209
210
|
</p>
|
210
211
|
<p><a class="source-toggle" href="#"
|
211
|
-
onclick="toggleCode('
|
212
|
-
<div class="method-source-code" id="
|
212
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
213
|
+
<div class="method-source-code" id="M000025-source">
|
213
214
|
<pre>
|
214
215
|
<span class="ruby-comment cmt"># File lib/serverside/static.rb, line 80</span>
|
215
216
|
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">serve_static</span>(<span class="ruby-identifier">path</span>)
|
@@ -230,19 +231,19 @@ Serves static files and directory listings.
|
|
230
231
|
</div>
|
231
232
|
</div>
|
232
233
|
|
233
|
-
<div id="method-
|
234
|
-
<a name="
|
234
|
+
<div id="method-M000024" class="method-detail">
|
235
|
+
<a name="M000024"></a>
|
235
236
|
|
236
237
|
<div class="method-heading">
|
237
|
-
<a href="#
|
238
|
+
<a href="#M000024" class="method-signature">
|
238
239
|
<span class="method-name">serve_template</span><span class="method-args">(fn, b = nil)</span>
|
239
240
|
</a>
|
240
241
|
</div>
|
241
242
|
|
242
243
|
<div class="method-description">
|
243
244
|
<p><a class="source-toggle" href="#"
|
244
|
-
onclick="toggleCode('
|
245
|
-
<div class="method-source-code" id="
|
245
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
246
|
+
<div class="method-source-code" id="M000024-source">
|
246
247
|
<pre>
|
247
248
|
<span class="ruby-comment cmt"># File lib/serverside/static.rb, line 73</span>
|
248
249
|
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">serve_template</span>(<span class="ruby-identifier">fn</span>, <span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">nil</span>)
|
@@ -96,8 +96,8 @@ file changes.
|
|
96
96
|
<h3 class="section-bar">Methods</h3>
|
97
97
|
|
98
98
|
<div class="name-list">
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
99
|
+
<a href="#M000042">render</a>
|
100
|
+
<a href="#M000041">set</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
103
|
|
@@ -119,11 +119,11 @@ file changes.
|
|
119
119
|
<div id="methods">
|
120
120
|
<h3 class="section-bar">Public Class methods</h3>
|
121
121
|
|
122
|
-
<div id="method-
|
123
|
-
<a name="
|
122
|
+
<div id="method-M000042" class="method-detail">
|
123
|
+
<a name="M000042"></a>
|
124
124
|
|
125
125
|
<div class="method-heading">
|
126
|
-
<a href="#
|
126
|
+
<a href="#M000042" class="method-signature">
|
127
127
|
<span class="method-name">render</span><span class="method-args">(name, binding)</span>
|
128
128
|
</a>
|
129
129
|
</div>
|
@@ -136,8 +136,8 @@ compares it to the file stamp, and reloads the template content if
|
|
136
136
|
necessary.
|
137
137
|
</p>
|
138
138
|
<p><a class="source-toggle" href="#"
|
139
|
-
onclick="toggleCode('
|
140
|
-
<div class="method-source-code" id="
|
139
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
140
|
+
<div class="method-source-code" id="M000042-source">
|
141
141
|
<pre>
|
142
142
|
<span class="ruby-comment cmt"># File lib/serverside/template.rb, line 22</span>
|
143
143
|
22: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">render</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">binding</span>)
|
@@ -158,11 +158,11 @@ necessary.
|
|
158
158
|
</div>
|
159
159
|
</div>
|
160
160
|
|
161
|
-
<div id="method-
|
162
|
-
<a name="
|
161
|
+
<div id="method-M000041" class="method-detail">
|
162
|
+
<a name="M000041"></a>
|
163
163
|
|
164
164
|
<div class="method-heading">
|
165
|
-
<a href="#
|
165
|
+
<a href="#M000041" class="method-signature">
|
166
166
|
<span class="method-name">set</span><span class="method-args">(name, body, stamp = nil)</span>
|
167
167
|
</a>
|
168
168
|
</div>
|
@@ -173,8 +173,8 @@ Stores a template for later use. The stamp parameter is used only when the
|
|
173
173
|
content of a template file is stored.
|
174
174
|
</p>
|
175
175
|
<p><a class="source-toggle" href="#"
|
176
|
-
onclick="toggleCode('
|
177
|
-
<div class="method-source-code" id="
|
176
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
177
|
+
<div class="method-source-code" id="M000041-source">
|
178
178
|
<pre>
|
179
179
|
<span class="ruby-comment cmt"># File lib/serverside/template.rb, line 14</span>
|
180
180
|
14: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">stamp</span> = <span class="ruby-keyword kw">nil</span>)
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat Sep 30 23:13:26 IDT 2006
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Sat Sep 30 23:07:59 IDT 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -70,6 +70,25 @@
|
|
70
70
|
|
71
71
|
<div id="description">
|
72
72
|
<p>
|
73
|
+
<b>SVN</b>
|
74
|
+
</p>
|
75
|
+
<ul>
|
76
|
+
<li>Refactored HTTP-related code into a new HTTP::Request class and a
|
77
|
+
simplified HTTP::Connection.
|
78
|
+
|
79
|
+
</li>
|
80
|
+
<li>Another small change to docs.
|
81
|
+
|
82
|
+
</li>
|
83
|
+
<li>Fixed small error in Rakefile that prevented doc_rforge task from updating
|
84
|
+
the docs.
|
85
|
+
|
86
|
+
</li>
|
87
|
+
<li>Fixed minor documentation error.
|
88
|
+
|
89
|
+
</li>
|
90
|
+
</ul>
|
91
|
+
<p>
|
73
92
|
*0.2.5*
|
74
93
|
</p>
|
75
94
|
<ul>
|
@@ -190,9 +209,8 @@ file server mode.
|
|
190
209
|
<li>Added static file serving code.
|
191
210
|
|
192
211
|
</li>
|
193
|
-
<li>Renamed ServerSide::Request to
|
194
|
-
|
195
|
-
This is more appropriate.
|
212
|
+
<li>Renamed ServerSide::Request to ServerSide::Connection. This is more
|
213
|
+
appropriate.
|
196
214
|
|
197
215
|
</li>
|
198
216
|
<li>Added functional static server test.
|
data/doc/rdoc/files/COPYING.html
CHANGED
data/doc/rdoc/files/README.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Sat Sep 30 23:10:14 IDT 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -93,10 +93,10 @@ tools to easily create servers and clusters of servers.
|
|
93
93
|
</li>
|
94
94
|
</ul>
|
95
95
|
<p>
|
96
|
-
To check out the
|
96
|
+
To check out the source code:
|
97
97
|
</p>
|
98
98
|
<pre>
|
99
|
-
svn co
|
99
|
+
svn co http://serverside.googlecode.com/svn/trunk
|
100
100
|
</pre>
|
101
101
|
<h2>Installation</h2>
|
102
102
|
<pre>
|
@@ -139,7 +139,7 @@ href="http://classes/ServerSide/Connection/Router.html">routing rules</a>.
|
|
139
139
|
Here’s a simple routing rule:
|
140
140
|
</p>
|
141
141
|
<pre>
|
142
|
-
ServerSide.route(:path => '/hello/:name') {
|
142
|
+
ServerSide::Router.route(:path => '/hello/:name') {
|
143
143
|
send_response(200, 'text', "Hello #{@parameters[:name]}!")
|
144
144
|
}
|
145
145
|
</pre>
|
@@ -0,0 +1,101 @@
|
|
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>File: request.rb</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="fileHeader">
|
50
|
+
<h1>request.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/serverside/request.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Sat Sep 30 22:55:32 IDT 2006</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if method_list -->
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div id="validator-badges">
|
97
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</body>
|
101
|
+
</html>
|