serverside 0.1.59
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +97 -0
- data/COPYING +18 -0
- data/README +51 -0
- data/Rakefile +92 -0
- data/bin/serverside +74 -0
- data/doc/rdoc/classes/Daemon.html +253 -0
- data/doc/rdoc/classes/Daemon/Base.html +146 -0
- data/doc/rdoc/classes/Daemon/Cluster.html +308 -0
- data/doc/rdoc/classes/Daemon/Cluster/PidFile.html +228 -0
- data/doc/rdoc/classes/Daemon/PidFile.html +178 -0
- data/doc/rdoc/classes/ServerSide.html +160 -0
- data/doc/rdoc/classes/ServerSide/Application.html +147 -0
- data/doc/rdoc/classes/ServerSide/Application/Base.html +196 -0
- data/doc/rdoc/classes/ServerSide/Application/Static.html +154 -0
- data/doc/rdoc/classes/ServerSide/Connection.html +128 -0
- data/doc/rdoc/classes/ServerSide/Connection/Base.html +343 -0
- data/doc/rdoc/classes/ServerSide/Connection/Const.html +229 -0
- data/doc/rdoc/classes/ServerSide/Connection/Static.html +172 -0
- data/doc/rdoc/classes/ServerSide/Server.html +162 -0
- data/doc/rdoc/classes/ServerSide/StaticFiles.html +208 -0
- data/doc/rdoc/classes/ServerSide/StaticFiles/Const.html +179 -0
- data/doc/rdoc/classes/String.html +210 -0
- data/doc/rdoc/classes/Symbol.html +156 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGELOG.html +260 -0
- data/doc/rdoc/files/COPYING.html +129 -0
- data/doc/rdoc/files/README.html +171 -0
- data/doc/rdoc/files/lib/serverside/application_rb.html +109 -0
- data/doc/rdoc/files/lib/serverside/cluster_rb.html +101 -0
- data/doc/rdoc/files/lib/serverside/connection_rb.html +101 -0
- data/doc/rdoc/files/lib/serverside/core_ext_rb.html +107 -0
- data/doc/rdoc/files/lib/serverside/daemon_rb.html +108 -0
- data/doc/rdoc/files/lib/serverside/server_rb.html +108 -0
- data/doc/rdoc/files/lib/serverside/static_rb.html +101 -0
- data/doc/rdoc/files/lib/serverside_rb.html +131 -0
- data/doc/rdoc/fr_class_index.html +44 -0
- data/doc/rdoc/fr_file_index.html +37 -0
- data/doc/rdoc/fr_method_index.html +60 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/serverside.rb +13 -0
- data/lib/serverside/application.rb +40 -0
- data/lib/serverside/cluster.rb +72 -0
- data/lib/serverside/connection.rb +115 -0
- data/lib/serverside/core_ext.rb +27 -0
- data/lib/serverside/daemon.rb +67 -0
- data/lib/serverside/server.rb +18 -0
- data/lib/serverside/static.rb +96 -0
- data/test/functional/primitive_static_server_test.rb +37 -0
- data/test/functional/static_profile.rb +17 -0
- data/test/functional/static_rfuzz.rb +67 -0
- data/test/functional/static_server_test.rb +25 -0
- data/test/test_helper.rb +2 -0
- data/test/unit/application_test.rb +16 -0
- data/test/unit/cluster_test.rb +129 -0
- data/test/unit/connection_test.rb +193 -0
- data/test/unit/core_ext_test.rb +32 -0
- data/test/unit/daemon_test.rb +75 -0
- data/test/unit/server_test.rb +26 -0
- data/test/unit/static_test.rb +143 -0
- metadata +140 -0
@@ -0,0 +1,229 @@
|
|
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>Module: ServerSide::Connection::Const</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">ServerSide::Connection::Const</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/serverside/connection_rb.html">
|
59
|
+
lib/serverside/connection.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../../files/lib/serverside/static_rb.html">
|
63
|
+
lib/serverside/static.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<!-- banner header -->
|
72
|
+
|
73
|
+
<div id="bodyContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
<div id="description">
|
80
|
+
<p>
|
81
|
+
A bunch of frozen constants to make the parsing of requests and rendering
|
82
|
+
of responses faster than otherwise.
|
83
|
+
</p>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if includes -->
|
95
|
+
|
96
|
+
<div id="section">
|
97
|
+
|
98
|
+
|
99
|
+
<div id="constants-list">
|
100
|
+
<h3 class="section-bar">Constants</h3>
|
101
|
+
|
102
|
+
<div class="name-list">
|
103
|
+
<table summary="Constants">
|
104
|
+
<tr class="top-aligned-row context-row">
|
105
|
+
<td class="context-item-name">LineBreak</td>
|
106
|
+
<td>=</td>
|
107
|
+
<td class="context-item-value">"\r\n".freeze</td>
|
108
|
+
</tr>
|
109
|
+
<tr class="top-aligned-row context-row">
|
110
|
+
<td class="context-item-name">RequestRegexp</td>
|
111
|
+
<td>=</td>
|
112
|
+
<td class="context-item-value">/([A-Za-z0-9]+)\s(\/[^\/\?]*(\/[^\/\?]+)*)\/?(\?(.*))?\sHTTP\/(.+)\r/.freeze</td>
|
113
|
+
<td width="3em"> </td>
|
114
|
+
<td class="context-item-desc">
|
115
|
+
Here’s a nice one - parses the first line of a request.
|
116
|
+
|
117
|
+
</td>
|
118
|
+
</tr>
|
119
|
+
<tr class="top-aligned-row context-row">
|
120
|
+
<td class="context-item-name">HeaderRegexp</td>
|
121
|
+
<td>=</td>
|
122
|
+
<td class="context-item-value">/([^:]+):\s?(.*)\r\n/.freeze</td>
|
123
|
+
<td width="3em"> </td>
|
124
|
+
<td class="context-item-desc">
|
125
|
+
Regexp for parsing headers.
|
126
|
+
|
127
|
+
</td>
|
128
|
+
</tr>
|
129
|
+
<tr class="top-aligned-row context-row">
|
130
|
+
<td class="context-item-name">ContentLength</td>
|
131
|
+
<td>=</td>
|
132
|
+
<td class="context-item-value">'Content-Length'.freeze</td>
|
133
|
+
</tr>
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">Version_1_1</td>
|
136
|
+
<td>=</td>
|
137
|
+
<td class="context-item-value">'1.1'.freeze</td>
|
138
|
+
</tr>
|
139
|
+
<tr class="top-aligned-row context-row">
|
140
|
+
<td class="context-item-name">Connection</td>
|
141
|
+
<td>=</td>
|
142
|
+
<td class="context-item-value">'Connection'.freeze</td>
|
143
|
+
</tr>
|
144
|
+
<tr class="top-aligned-row context-row">
|
145
|
+
<td class="context-item-name">Close</td>
|
146
|
+
<td>=</td>
|
147
|
+
<td class="context-item-value">'close'.freeze</td>
|
148
|
+
</tr>
|
149
|
+
<tr class="top-aligned-row context-row">
|
150
|
+
<td class="context-item-name">Ampersand</td>
|
151
|
+
<td>=</td>
|
152
|
+
<td class="context-item-value">'&'.freeze</td>
|
153
|
+
</tr>
|
154
|
+
<tr class="top-aligned-row context-row">
|
155
|
+
<td class="context-item-name">ParameterRegexp</td>
|
156
|
+
<td>=</td>
|
157
|
+
<td class="context-item-value">/(.+)=(.*)/.freeze</td>
|
158
|
+
<td width="3em"> </td>
|
159
|
+
<td class="context-item-desc">
|
160
|
+
Regexp for parsing URI parameters.
|
161
|
+
|
162
|
+
</td>
|
163
|
+
</tr>
|
164
|
+
<tr class="top-aligned-row context-row">
|
165
|
+
<td class="context-item-name">EqualSign</td>
|
166
|
+
<td>=</td>
|
167
|
+
<td class="context-item-value">'='.freeze</td>
|
168
|
+
</tr>
|
169
|
+
<tr class="top-aligned-row context-row">
|
170
|
+
<td class="context-item-name">StatusClose</td>
|
171
|
+
<td>=</td>
|
172
|
+
<td class="context-item-value">"HTTP/1.1 %d\r\nConnection: close\r\nContent-Type: %s\r\n%sContent-Length: %d\r\n\r\n".freeze</td>
|
173
|
+
</tr>
|
174
|
+
<tr class="top-aligned-row context-row">
|
175
|
+
<td class="context-item-name">StatusStream</td>
|
176
|
+
<td>=</td>
|
177
|
+
<td class="context-item-value">"HTTP/1.1 %d\r\nConnection: close\r\nContent-Type: %s\r\n%s\r\n".freeze</td>
|
178
|
+
</tr>
|
179
|
+
<tr class="top-aligned-row context-row">
|
180
|
+
<td class="context-item-name">StatusPersist</td>
|
181
|
+
<td>=</td>
|
182
|
+
<td class="context-item-value">"HTTP/1.1 %d\r\nContent-Type: %s\r\n%sContent-Length: %d\r\n\r\n".freeze</td>
|
183
|
+
</tr>
|
184
|
+
<tr class="top-aligned-row context-row">
|
185
|
+
<td class="context-item-name">Header</td>
|
186
|
+
<td>=</td>
|
187
|
+
<td class="context-item-value">"%s: %s\r\n".freeze</td>
|
188
|
+
</tr>
|
189
|
+
<tr class="top-aligned-row context-row">
|
190
|
+
<td class="context-item-name">Empty</td>
|
191
|
+
<td>=</td>
|
192
|
+
<td class="context-item-value">''.freeze</td>
|
193
|
+
</tr>
|
194
|
+
<tr class="top-aligned-row context-row">
|
195
|
+
<td class="context-item-name">Slash</td>
|
196
|
+
<td>=</td>
|
197
|
+
<td class="context-item-value">'/'.freeze</td>
|
198
|
+
</tr>
|
199
|
+
<tr class="top-aligned-row context-row">
|
200
|
+
<td class="context-item-name">WD</td>
|
201
|
+
<td>=</td>
|
202
|
+
<td class="context-item-value">'.'.freeze</td>
|
203
|
+
</tr>
|
204
|
+
<tr class="top-aligned-row context-row">
|
205
|
+
<td class="context-item-name">FileNotFound</td>
|
206
|
+
<td>=</td>
|
207
|
+
<td class="context-item-value">"Couldn't open file %s.".freeze</td>
|
208
|
+
</tr>
|
209
|
+
</table>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<!-- if method_list -->
|
219
|
+
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
<div id="validator-badges">
|
225
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
</body>
|
229
|
+
</html>
|
@@ -0,0 +1,172 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ServerSide::Connection::Static</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ServerSide::Connection::Static</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/serverside/static_rb.html">
|
59
|
+
lib/serverside/static.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Base.html">
|
69
|
+
Base
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
A connection type for serving static files.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000033">respond</a>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if includes -->
|
105
|
+
<div id="includes">
|
106
|
+
<h3 class="section-bar">Included Modules</h3>
|
107
|
+
|
108
|
+
<div id="includes-list">
|
109
|
+
<span class="include-name"><a href="../StaticFiles.html">StaticFiles</a></span>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="section">
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if method_list -->
|
123
|
+
<div id="methods">
|
124
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
125
|
+
|
126
|
+
<div id="method-M000033" class="method-detail">
|
127
|
+
<a name="M000033"></a>
|
128
|
+
|
129
|
+
<div class="method-heading">
|
130
|
+
<a href="#M000033" class="method-signature">
|
131
|
+
<span class="method-name">respond</span><span class="method-args">()</span>
|
132
|
+
</a>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div class="method-description">
|
136
|
+
<p>
|
137
|
+
Responds with a file’s content or a directory listing. If the path
|
138
|
+
does not exist, a 404 response is rendered.
|
139
|
+
</p>
|
140
|
+
<p><a class="source-toggle" href="#"
|
141
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
142
|
+
<div class="method-source-code" id="M000033-source">
|
143
|
+
<pre>
|
144
|
+
<span class="ruby-comment cmt"># File lib/serverside/static.rb, line 83</span>
|
145
|
+
83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond</span>
|
146
|
+
84: <span class="ruby-identifier">fn</span> = <span class="ruby-value str">'./%s'</span> <span class="ruby-operator">%</span> <span class="ruby-ivar">@path</span>
|
147
|
+
85: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">fn</span>)
|
148
|
+
86: <span class="ruby-identifier">serve_file</span>(<span class="ruby-identifier">fn</span>)
|
149
|
+
87: <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">fn</span>)
|
150
|
+
88: <span class="ruby-identifier">serve_dir</span>(<span class="ruby-identifier">fn</span>)
|
151
|
+
89: <span class="ruby-keyword kw">else</span>
|
152
|
+
90: <span class="ruby-identifier">send_response</span>(<span class="ruby-value">404</span>, <span class="ruby-value str">'text'</span>, <span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">FileNotFound</span> <span class="ruby-operator">%</span> <span class="ruby-ivar">@path</span>)
|
153
|
+
91: <span class="ruby-keyword kw">end</span>
|
154
|
+
92: <span class="ruby-keyword kw">end</span>
|
155
|
+
</pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
<div id="validator-badges">
|
168
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</body>
|
172
|
+
</html>
|
@@ -0,0 +1,162 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ServerSide::Server</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ServerSide::Server</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/serverside/server_rb.html">
|
59
|
+
lib/serverside/server.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
The <a href="../ServerSide.html">ServerSide</a> HTTP server is designed to
|
84
|
+
be fast and simple. It is also designed to support both HTTP 1.1 persistent
|
85
|
+
connections, and HTTP streaming for applications which use Comet
|
86
|
+
techniques.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000034">new</a>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if includes -->
|
106
|
+
|
107
|
+
<div id="section">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<!-- if method_list -->
|
117
|
+
<div id="methods">
|
118
|
+
<h3 class="section-bar">Public Class methods</h3>
|
119
|
+
|
120
|
+
<div id="method-M000034" class="method-detail">
|
121
|
+
<a name="M000034"></a>
|
122
|
+
|
123
|
+
<div class="method-heading">
|
124
|
+
<a href="#M000034" class="method-signature">
|
125
|
+
<span class="method-name">new</span><span class="method-args">(host, port, connection_class)</span>
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="method-description">
|
130
|
+
<p>
|
131
|
+
Creates a new server by opening a listening socket and starting an accept
|
132
|
+
loop. When a new connection is accepted, a new instance of the the supplied
|
133
|
+
connection class is instantiated and passed the connection for processing.
|
134
|
+
</p>
|
135
|
+
<p><a class="source-toggle" href="#"
|
136
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
137
|
+
<div class="method-source-code" id="M000034-source">
|
138
|
+
<pre>
|
139
|
+
<span class="ruby-comment cmt"># File lib/serverside/server.rb, line 12</span>
|
140
|
+
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">connection_class</span>)
|
141
|
+
13: <span class="ruby-ivar">@connection_class</span> = <span class="ruby-identifier">connection_class</span>
|
142
|
+
14: <span class="ruby-ivar">@server</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>)
|
143
|
+
15: <span class="ruby-identifier">loop</span> {<span class="ruby-ivar">@connection_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@server</span>.<span class="ruby-identifier">accept</span>)}
|
144
|
+
16: <span class="ruby-keyword kw">end</span>
|
145
|
+
</pre>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
<div id="validator-badges">
|
158
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
</body>
|
162
|
+
</html>
|