mongrel 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/COPYING +504 -0
  2. data/LICENSE +504 -0
  3. data/README +117 -0
  4. data/Rakefile +30 -0
  5. data/doc/rdoc/classes/Mongrel.html +144 -0
  6. data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
  7. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000023.html +18 -0
  8. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000024.html +18 -0
  9. data/doc/rdoc/classes/Mongrel/HeaderOut.html +167 -0
  10. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000013.html +18 -0
  11. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000014.html +21 -0
  12. data/doc/rdoc/classes/Mongrel/HttpHandler.html +159 -0
  13. data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000019.html +17 -0
  14. data/doc/rdoc/classes/Mongrel/HttpParser.html +271 -0
  15. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000001.html +28 -0
  16. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000002.html +29 -0
  17. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000003.html +29 -0
  18. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000004.html +41 -0
  19. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000005.html +27 -0
  20. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000006.html +27 -0
  21. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000007.html +28 -0
  22. data/doc/rdoc/classes/Mongrel/HttpRequest.html +177 -0
  23. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000025.html +30 -0
  24. data/doc/rdoc/classes/Mongrel/HttpResponse.html +202 -0
  25. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000020.html +21 -0
  26. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000021.html +20 -0
  27. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000022.html +25 -0
  28. data/doc/rdoc/classes/Mongrel/HttpServer.html +336 -0
  29. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000008.html +26 -0
  30. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000009.html +58 -0
  31. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000010.html +22 -0
  32. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000011.html +18 -0
  33. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000012.html +18 -0
  34. data/doc/rdoc/classes/Mongrel/URIClassifier.html +257 -0
  35. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000015.html +54 -0
  36. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000016.html +50 -0
  37. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000017.html +36 -0
  38. data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000018.html +73 -0
  39. data/doc/rdoc/created.rid +1 -0
  40. data/doc/rdoc/files/COPYING.html +756 -0
  41. data/doc/rdoc/files/LICENSE.html +756 -0
  42. data/doc/rdoc/files/README.html +273 -0
  43. data/doc/rdoc/files/ext/http11/http11_c.html +101 -0
  44. data/doc/rdoc/files/lib/mongrel_rb.html +111 -0
  45. data/doc/rdoc/fr_class_index.html +35 -0
  46. data/doc/rdoc/fr_file_index.html +31 -0
  47. data/doc/rdoc/fr_method_index.html +51 -0
  48. data/doc/rdoc/index.html +24 -0
  49. data/doc/rdoc/rdoc-style.css +208 -0
  50. data/examples/camping/blog.rb +300 -0
  51. data/examples/camping/tepee.rb +168 -0
  52. data/examples/simpletest.rb +16 -0
  53. data/examples/webrick_compare.rb +20 -0
  54. data/ext/http11/MANIFEST +0 -0
  55. data/ext/http11/ext_help.h +14 -0
  56. data/ext/http11/extconf.rb +6 -0
  57. data/ext/http11/http11.c +436 -0
  58. data/ext/http11/http11_parser.c +918 -0
  59. data/ext/http11/http11_parser.h +37 -0
  60. data/ext/http11/tst.h +40 -0
  61. data/ext/http11/tst_cleanup.c +24 -0
  62. data/ext/http11/tst_delete.c +146 -0
  63. data/ext/http11/tst_grow_node_free_list.c +38 -0
  64. data/ext/http11/tst_init.c +41 -0
  65. data/ext/http11/tst_insert.c +192 -0
  66. data/ext/http11/tst_search.c +54 -0
  67. data/lib/mongrel.rb +298 -0
  68. data/setup.rb +1360 -0
  69. data/test/test_http11.rb +38 -0
  70. data/test/test_response.rb +44 -0
  71. data/test/test_uriclassifier.rb +104 -0
  72. data/test/test_ws.rb +33 -0
  73. data/tools/rakehelp.rb +99 -0
  74. metadata +132 -0
@@ -0,0 +1,273 @@
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: README</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>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Jan 31 00:44:18 EST 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
+ <div id="description">
72
+ <h1><a href="../classes/Mongrel.html">Mongrel</a>: Simple Fast Mostly Ruby Web Server</h1>
73
+ <p>
74
+ <a href="../classes/Mongrel.html">Mongrel</a> is a small library that
75
+ provides a very fast HTTP 1.1 server for Ruby web applications. It is not
76
+ particular to any framework, and is intended to be just enough to get a web
77
+ application running behind a more complete and robust web server.
78
+ </p>
79
+ <p>
80
+ What makes <a href="../classes/Mongrel.html">Mongrel</a> so fast is the
81
+ careful use of a C extension to provide fast HTTP 1.1 protocol parsing and
82
+ fast URI lookup. This combination makes the server scream without too many
83
+ portability issues.
84
+ </p>
85
+ <h2>Status</h2>
86
+ <p>
87
+ The 0.2.0 release of <a href="../classes/Mongrel.html">Mongrel</a> features
88
+ an HTTP core server that is the fastest possible thing I could get without
89
+ using something other than Ruby. It features a few bug fixes, but mostly
90
+ just a change to the <a
91
+ href="../classes/Mongrel/HttpResponse.html">Mongrel::HttpResponse</a> class
92
+ to make it more feature complete. The remaining development will be spent
93
+ getting <a href="../classes/Mongrel.html">Mongrel</a> to work with other
94
+ frameworks, adding additional needed features, and improving the
95
+ concurrency and speed.
96
+ </p>
97
+ <p>
98
+ The current release has samples from &quot;why the lucky stiff&quot; for
99
+ his Camping framework in the examples directory. Camping is a small micro
100
+ framework (<a
101
+ href="http://rubyforge.org/projects/camping">rubyforge.org/projects/camping</a>)
102
+ which should work with <a href="../classes/Mongrel.html">Mongrel</a> if you
103
+ use the subversion source for Camping.
104
+ </p>
105
+ <p>
106
+ This is also the first release onto the new <a
107
+ href="../classes/Mongrel.html">Mongrel</a> RubyForge project page found at
108
+ <a
109
+ href="http://rubyforge.org/projects/mongrel">rubyforge.org/projects/mongrel</a>/
110
+ thanks to Tom Copland. I&#8217;ll be looking to automate management of
111
+ this, but feel free to use rubyforge to post feature requests, bugs, and
112
+ join the mailing list.
113
+ </p>
114
+ <h2>Install</h2>
115
+ <p>
116
+ It doesn&#8217;t explicitly require Camping, but if you want to run the
117
+ examples/camping/ examples then you&#8217;ll need to install Camping 1.2 at
118
+ least (and redcloth I think). These are all available from RubyGems.
119
+ </p>
120
+ <p>
121
+ The library consists of a C extension so you&#8217;ll need a C compiler or
122
+ at least a friend who can build it for you.
123
+ </p>
124
+ <p>
125
+ Finally, the source includes a setup.rb for those who hate RubyGems.
126
+ </p>
127
+ <h2>Usage</h2>
128
+ <p>
129
+ The examples/simpletest.rb file has the following code as the simplest
130
+ example:
131
+ </p>
132
+ <pre>
133
+ require 'mongrel'
134
+
135
+ class SimpleHandler &lt; Mongrel::HttpHandler
136
+ def process(request, response)
137
+ response.start(200) do |head,out|
138
+ head[&quot;Content-Type&quot;] = &quot;text/plain&quot;
139
+ out.write(&quot;hello!\n&quot;)
140
+ end
141
+ end
142
+ end
143
+
144
+ h = Mongrel::HttpServer.new(&quot;0.0.0.0&quot;, &quot;3000&quot;)
145
+ h.register(&quot;/test&quot;, SimpleHandler.new)
146
+ h.run.join
147
+ </pre>
148
+ <p>
149
+ If you run this and access port 3000 with a browser it will say
150
+ &quot;hello!&quot;. If you access it with any url other than
151
+ &quot;/test&quot; it will give a simple 404. Check out the <a
152
+ href="../classes/Mongrel/Error404Handler.html">Mongrel::Error404Handler</a>
153
+ for a basic way to give a more complex 404 message.
154
+ </p>
155
+ <h2>Speed</h2>
156
+ <p>
157
+ The 0.2.0 release probably consists of the most effort I&#8217;ve ever put
158
+ into tuning a Ruby library for speed. It consists of nearly everything I
159
+ could think of to make <a href="../classes/Mongrel.html">Mongrel</a> the
160
+ fastest Ruby HTTP library possible. I&#8217;ve tried about seven different
161
+ architectures and IO processing methods and none of them make it any
162
+ faster. In short: <a href="../classes/Mongrel.html">Mongrel</a> is
163
+ amazingly fast considering Ruby&#8217;s speed limitations.
164
+ </p>
165
+ <p>
166
+ This release also brings in controllable threads that you can scale to meet
167
+ your needs to do your processing. Simple pass in the HttpServer.new third
168
+ optional parameter:
169
+ </p>
170
+ <pre>
171
+ h = Mongrel::HttpServer.new(&quot;0.0.0.0&quot;, &quot;3000&quot;, 40)
172
+ </pre>
173
+ <p>
174
+ Which will make 40 thread processors. Right now the optimal setting is up
175
+ in the air, but 20 seemed to be about the sweet spot on my systems. The
176
+ limited processors also means that you can use ActiveRecord as-is and it
177
+ will create a matching database connection for each processor thread. More
178
+ on this in future releases.
179
+ </p>
180
+ <p>
181
+ With this release I&#8217;m hoping that I&#8217;ve created a nice solid
182
+ fast as hell core upon which I can build the remaining features I want in
183
+ <a href="../classes/Mongrel.html">Mongrel</a>.
184
+ </p>
185
+ <h2>The Future</h2>
186
+ <p>
187
+ With the core of <a href="../classes/Mongrel.html">Mongrel</a> completed
188
+ I&#8217;m now turning to the next set of features to make <a
189
+ href="../classes/Mongrel.html">Mongrel</a> useful for hosting web
190
+ applications in a heavily utilized production environment. Right now
191
+ I&#8217;m looking at:
192
+ </p>
193
+ <ul>
194
+ <li>Fast static file handling with directory listings.
195
+
196
+ </li>
197
+ <li>More testing on more platforms.
198
+
199
+ </li>
200
+ <li>An idea I&#8217;ve had for an insane caching handler which could speed up
201
+ quite a
202
+
203
+ </li>
204
+ </ul>
205
+ <p>
206
+ few deployments.
207
+ </p>
208
+ <ul>
209
+ <li>General little things most web servers need.
210
+
211
+ </li>
212
+ <li>A nice management system or interface for controlling mongrel servers.
213
+
214
+ </li>
215
+ </ul>
216
+ <p>
217
+ Overall though the goal of <a href="../classes/Mongrel.html">Mongrel</a> is
218
+ to be just enough HTTP to serve a Ruby web application that sits behind a
219
+ more complete web server. Everything in the next will focus on actually
220
+ hosting the major web frameworks for Ruby:
221
+ </p>
222
+ <ul>
223
+ <li>Camping &#8212; because it&#8217;s already done (thanks Why).
224
+
225
+ </li>
226
+ <li>Ruby on Rails &#8212; that&#8217;s where my bread is buttered right now.
227
+
228
+ </li>
229
+ <li>Nitro &#8212; George is a nice guy, and Nitro is thread safe. Might be fun.
230
+
231
+ </li>
232
+ <li>????? &#8212; Others people might be interested in.
233
+
234
+ </li>
235
+ </ul>
236
+ <h2>Contact</h2>
237
+ <p>
238
+ E-mail zedshaw at zedshaw.com and I&#8217;ll help. Comments about the API
239
+ are welcome.
240
+ </p>
241
+
242
+ </div>
243
+
244
+
245
+ </div>
246
+
247
+
248
+ </div>
249
+
250
+
251
+ <!-- if includes -->
252
+
253
+ <div id="section">
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ <!-- if method_list -->
263
+
264
+
265
+ </div>
266
+
267
+
268
+ <div id="validator-badges">
269
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
270
+ </div>
271
+
272
+ </body>
273
+ </html>
@@ -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: http11.c</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>http11.c</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>ext/http11/http11.c
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 30 23:59:49 EST 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>
@@ -0,0 +1,111 @@
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: mongrel.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>mongrel.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/mongrel.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 30 23:59:49 EST 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
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ socket&nbsp;&nbsp;
77
+ http11&nbsp;&nbsp;
78
+ thread&nbsp;&nbsp;
79
+ stringio&nbsp;&nbsp;
80
+ </div>
81
+ </div>
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+
91
+ <div id="section">
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <!-- if method_list -->
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <div id="validator-badges">
107
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
+ </div>
109
+
110
+ </body>
111
+ </html>