steamcannon-thin 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +288 -0
- data/COPYING +18 -0
- data/README +69 -0
- data/Rakefile +44 -0
- data/benchmark/abc +51 -0
- data/benchmark/benchmarker.rb +80 -0
- data/benchmark/runner +82 -0
- data/bin/thin +6 -0
- data/example/adapter.rb +32 -0
- data/example/async_app.ru +126 -0
- data/example/async_chat.ru +247 -0
- data/example/async_tailer.ru +100 -0
- data/example/config.ru +22 -0
- data/example/monit_sockets +20 -0
- data/example/monit_unixsock +20 -0
- data/example/myapp.rb +1 -0
- data/example/ramaze.ru +12 -0
- data/example/thin.god +80 -0
- data/example/thin_solaris_smf.erb +36 -0
- data/example/thin_solaris_smf.readme.txt +150 -0
- data/example/vlad.rake +64 -0
- data/ext/thin_parser/common.rl +55 -0
- data/ext/thin_parser/ext_help.h +14 -0
- data/ext/thin_parser/extconf.rb +6 -0
- data/ext/thin_parser/parser.c +1249 -0
- data/ext/thin_parser/parser.h +49 -0
- data/ext/thin_parser/parser.rl +157 -0
- data/ext/thin_parser/thin.c +436 -0
- data/lib/rack/adapter/loader.rb +91 -0
- data/lib/rack/adapter/rails.rb +183 -0
- data/lib/thin.rb +56 -0
- data/lib/thin/backends/base.rb +149 -0
- data/lib/thin/backends/swiftiply_client.rb +56 -0
- data/lib/thin/backends/tcp_server.rb +29 -0
- data/lib/thin/backends/unix_server.rb +51 -0
- data/lib/thin/command.rb +53 -0
- data/lib/thin/connection.rb +224 -0
- data/lib/thin/controllers/cluster.rb +178 -0
- data/lib/thin/controllers/controller.rb +188 -0
- data/lib/thin/controllers/service.rb +75 -0
- data/lib/thin/controllers/service.sh.erb +39 -0
- data/lib/thin/daemonizing.rb +180 -0
- data/lib/thin/headers.rb +39 -0
- data/lib/thin/logging.rb +54 -0
- data/lib/thin/request.rb +156 -0
- data/lib/thin/response.rb +101 -0
- data/lib/thin/runner.rb +220 -0
- data/lib/thin/server.rb +253 -0
- data/lib/thin/stats.html.erb +216 -0
- data/lib/thin/stats.rb +52 -0
- data/lib/thin/statuses.rb +43 -0
- data/lib/thin/version.rb +32 -0
- data/lib/thin_parser.so +0 -0
- data/spec/backends/swiftiply_client_spec.rb +66 -0
- data/spec/backends/tcp_server_spec.rb +33 -0
- data/spec/backends/unix_server_spec.rb +37 -0
- data/spec/command_spec.rb +25 -0
- data/spec/configs/cluster.yml +9 -0
- data/spec/configs/single.yml +9 -0
- data/spec/connection_spec.rb +106 -0
- data/spec/controllers/cluster_spec.rb +267 -0
- data/spec/controllers/controller_spec.rb +129 -0
- data/spec/controllers/service_spec.rb +50 -0
- data/spec/daemonizing_spec.rb +196 -0
- data/spec/headers_spec.rb +40 -0
- data/spec/logging_spec.rb +46 -0
- data/spec/perf/request_perf_spec.rb +50 -0
- data/spec/perf/response_perf_spec.rb +19 -0
- data/spec/perf/server_perf_spec.rb +39 -0
- data/spec/rack/loader_spec.rb +42 -0
- data/spec/rack/rails_adapter_spec.rb +173 -0
- data/spec/rails_app/app/controllers/application.rb +10 -0
- data/spec/rails_app/app/controllers/simple_controller.rb +19 -0
- data/spec/rails_app/app/helpers/application_helper.rb +3 -0
- data/spec/rails_app/app/views/simple/index.html.erb +15 -0
- data/spec/rails_app/config/boot.rb +109 -0
- data/spec/rails_app/config/environment.rb +64 -0
- data/spec/rails_app/config/environments/development.rb +18 -0
- data/spec/rails_app/config/environments/production.rb +19 -0
- data/spec/rails_app/config/environments/test.rb +22 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/routes.rb +35 -0
- data/spec/rails_app/public/404.html +30 -0
- data/spec/rails_app/public/422.html +30 -0
- data/spec/rails_app/public/500.html +30 -0
- data/spec/rails_app/public/dispatch.cgi +10 -0
- data/spec/rails_app/public/dispatch.fcgi +24 -0
- data/spec/rails_app/public/dispatch.rb +10 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +277 -0
- data/spec/rails_app/public/javascripts/application.js +2 -0
- data/spec/rails_app/public/javascripts/controls.js +963 -0
- data/spec/rails_app/public/javascripts/dragdrop.js +972 -0
- data/spec/rails_app/public/javascripts/effects.js +1120 -0
- data/spec/rails_app/public/javascripts/prototype.js +4225 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/script/about +3 -0
- data/spec/rails_app/script/console +3 -0
- data/spec/rails_app/script/destroy +3 -0
- data/spec/rails_app/script/generate +3 -0
- data/spec/rails_app/script/performance/benchmarker +3 -0
- data/spec/rails_app/script/performance/profiler +3 -0
- data/spec/rails_app/script/performance/request +3 -0
- data/spec/rails_app/script/plugin +3 -0
- data/spec/rails_app/script/process/inspector +3 -0
- data/spec/rails_app/script/process/reaper +3 -0
- data/spec/rails_app/script/process/spawner +3 -0
- data/spec/rails_app/script/runner +3 -0
- data/spec/rails_app/script/server +3 -0
- data/spec/request/mongrel_spec.rb +39 -0
- data/spec/request/parser_spec.rb +254 -0
- data/spec/request/persistent_spec.rb +35 -0
- data/spec/request/processing_spec.rb +50 -0
- data/spec/response_spec.rb +91 -0
- data/spec/runner_spec.rb +168 -0
- data/spec/server/builder_spec.rb +44 -0
- data/spec/server/pipelining_spec.rb +110 -0
- data/spec/server/robustness_spec.rb +34 -0
- data/spec/server/stopping_spec.rb +55 -0
- data/spec/server/swiftiply.yml +6 -0
- data/spec/server/swiftiply_spec.rb +32 -0
- data/spec/server/tcp_spec.rb +57 -0
- data/spec/server/threaded_spec.rb +27 -0
- data/spec/server/unix_socket_spec.rb +26 -0
- data/spec/server_spec.rb +100 -0
- data/spec/spec_helper.rb +220 -0
- data/tasks/announce.rake +22 -0
- data/tasks/deploy.rake +13 -0
- data/tasks/email.erb +30 -0
- data/tasks/gem.rake +66 -0
- data/tasks/rdoc.rake +25 -0
- data/tasks/site.rake +15 -0
- data/tasks/spec.rake +43 -0
- data/tasks/stats.rake +28 -0
- metadata +251 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,288 @@
|
|
1
|
+
== 1.2.8 Does It Offend You, Yeah?
|
2
|
+
* Accept IE7 badly encoded URL (eg.: %uEEEE)
|
3
|
+
* Fix gemspec to work w/ Bundler [smparkes]
|
4
|
+
* Add SSL support [tmm1]
|
5
|
+
* Catch Errno::EPERM in Process.running? [Tony Kemp]
|
6
|
+
On some systems (e.g. OpenBSD) you receive an EPERM exception if
|
7
|
+
you try to Process.getpgid on a process you do not own (even if you
|
8
|
+
are root). But it does mean that the process exists, so return true.
|
9
|
+
* Fix Rails version check that select which Rack adapter to use. Was using CGI adapter in Rails 3.
|
10
|
+
* Ignore SIGHUP when no restart block is given
|
11
|
+
|
12
|
+
== 1.2.7 No Hup
|
13
|
+
* Support multiple Ruby version (fat binaries under windows)
|
14
|
+
* Do not trap unsupported HUP signal on Windows
|
15
|
+
|
16
|
+
== 1.2.6 Crazy Delicious
|
17
|
+
* Make work with Rails 3 out-of-the-box.
|
18
|
+
* Auto-detect and load config.ru files on start. Makes Rails 3 work.
|
19
|
+
* Fix signals being ignored under 1.9 when daemonized.
|
20
|
+
|
21
|
+
== 1.2.5 This Is Not A Web Server
|
22
|
+
* Add rolling restart support (--onebyone option) [sikachu]
|
23
|
+
* Force external_encoding of request's body to ASCII_8BIT [jeremyz]
|
24
|
+
* Ensure Rack base API is used in Rails adapter only if version >= 2.3.2 [#111 state:resolved]
|
25
|
+
|
26
|
+
== 1.2.4 Flaming Astroboy
|
27
|
+
* Fix a few issues in thin to make it a better "gem citizen" [josh]
|
28
|
+
* Fix test for rack based Rails in adapter under Ruby >= 1.8.7 [#109 state:resolved]
|
29
|
+
* Fix Remote address spoofing vulnerability in Connection#remote_address [Alexey Borzenkov]
|
30
|
+
* Fix uninitialized constant ActionController::Dispatcher error with Rails 1.2.3 [Chris Anderton] [#103 state:resolved]
|
31
|
+
|
32
|
+
== 1.2.2 I Find Your Lack of Sauce Disturbing release
|
33
|
+
* Fix force kill under 1.9 [Alexey Chebotar]
|
34
|
+
* Fix regression when --only option is used w/ --socket.
|
35
|
+
* Add process name 'tag' functionality. Easier to distinguish thin daemons
|
36
|
+
from eachother in process listing [ctcherry]
|
37
|
+
|
38
|
+
== 1.2.1 Asynctilicious Ultra Supreme release
|
39
|
+
* Require Rack 1.0.0
|
40
|
+
* Require EventMachine 0.12.6
|
41
|
+
* Use Rails Rack based dispatcher when available
|
42
|
+
* Allow String for response body
|
43
|
+
* Require openssl before eventmachine to prevent crash in 1.9
|
44
|
+
|
45
|
+
== 1.2.0 Asynctilicious Supreme release
|
46
|
+
* Add support for Windows mingw Ruby distro [Juan C. Rodriguez]
|
47
|
+
* Add async response support, see example/async_*.ru [raggi]
|
48
|
+
|
49
|
+
== 1.1.1 Super Disco Power Plus release
|
50
|
+
* Fix bug when running with only options [hasimo]
|
51
|
+
|
52
|
+
== 1.1.0 Super Disco Power release
|
53
|
+
* Require EventMachine 0.12.4
|
54
|
+
* Remove Thin handler, now part of Rack 0.9.1
|
55
|
+
* Fix Rack protocol version to 0.1 in environment hash.
|
56
|
+
* Fix error when passing no_epoll option to a cluster.
|
57
|
+
* Omit parsing #defined strings [Jérémy Zurcher]
|
58
|
+
* Defaults SERVER_NAME to localhost like webrick does [#87 state:resolved]
|
59
|
+
* Namespace parser to prevent error when mongrel is required [cliffmoon]
|
60
|
+
* Set RACK_ENV based on environment option when loading rackup file [Curtis Summers] [#83 state:resolved]
|
61
|
+
* Fixes a warning RE relative_url_root when using a prefix with Rails 2.1.1 [seriph] [#85 state:resolved]
|
62
|
+
* --only can work as a sequence number (if < 80) or a port number (if >= 80) [jmay] [#81 state:resolved]
|
63
|
+
|
64
|
+
== 1.0.0 That's What She Said release
|
65
|
+
* Fixed vlad.rake to allow TCP or socket [hellekin]
|
66
|
+
* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
|
67
|
+
* rails rack adapter uses File.readable_real? so it recognizes ACL permissions [Ricardo Chimal]
|
68
|
+
* Log a warning if Rack application returns nil body [Michael S. Klishin]
|
69
|
+
* Handle nil and Time header values correctly [#76 state:resolved] [tmm1]
|
70
|
+
* Add Content-Length header to response automatically when possible [#74 state:resolved] [dkubb]
|
71
|
+
* Runner now remembers -r, -D and -V parameters so that clustered servers inherit those and
|
72
|
+
`restart` keep your parameters.
|
73
|
+
* Make Set-Cookie header, in Rails adapter, compatible with current Rack spec [Pedro Belo]
|
74
|
+
[#73, state:resolved]
|
75
|
+
* Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
|
76
|
+
* Add --force (-f) option to force stopping of a daemonized server [#72 state:resolved]
|
77
|
+
* Update halycon adapter loader [mtodd]
|
78
|
+
|
79
|
+
== 0.8.2 Double Margarita release
|
80
|
+
* Require EventMachine 0.12.0
|
81
|
+
* [bug] Fix timeout handling when running command
|
82
|
+
* [bug] Fix hanging when restarting and no process is running in single server move, fixes #67
|
83
|
+
* Added Mack adapter [markbates]
|
84
|
+
* Allow rackup .rb files by getting a conventionally named constant as the app [bmizerany]
|
85
|
+
|
86
|
+
== 0.8.1 Rebel Porpoise release
|
87
|
+
* [bug] Rescue all types of errors when processing request, fixes #62
|
88
|
+
* [bug] Use Swiftiply backend when -y option is specified, fixes #63 and #64
|
89
|
+
* Allow passing port as a string in Server.new
|
90
|
+
* Define deferred?(env) in your Rack application to set if a request is handled in a
|
91
|
+
thread (return true) or not (return false).
|
92
|
+
|
93
|
+
== 0.8.0 Dodgy Dentist release
|
94
|
+
* [bug] Fix server crash when header too large.
|
95
|
+
* Add --require (-r) option to require a library, before executing your script.
|
96
|
+
* Rename --rackup short option to -R, warn and load as rackup when file ends with .ru.
|
97
|
+
* List supported adapters in command usage.
|
98
|
+
* Add file adapter to built-in adapter, serve static files in current directory.
|
99
|
+
* Allow disabling signal handling in Server with :signals => false
|
100
|
+
* Make Server.new arguments more flexible, can now specify any of host, port, app or hash options.
|
101
|
+
* Add --backend option to specified which backend to use, closes #55
|
102
|
+
* [bug] Serve static file only on GET and HEAD requests in Rails adapter, fixes #58
|
103
|
+
* Add threaded option to run server in threaded mode, calling the application in a
|
104
|
+
thread allowing for concurrency in the Rack adapter, closes #46
|
105
|
+
* Guess which adapter to use from directory (chdir option)
|
106
|
+
or use specified one in 'adapter' option, re #47.
|
107
|
+
|
108
|
+
== 0.7.1 Fancy Pants release
|
109
|
+
* Clean stale PID files when starting as daemon, fixes #53 [Chu Yeow]
|
110
|
+
* Require EventMachine 0.11.0 for UNIX domain sockets. Until it's released, install from:
|
111
|
+
gem install eventmachine --source http://code.macournoyer.com
|
112
|
+
* Ruby 1.8.5 compatibility, closes #49 [Wincent Colaiuta]
|
113
|
+
* Move all EventMachine stuff out of Server, you can now create a Thin Backend that
|
114
|
+
does not depend on EventMachine.
|
115
|
+
* Rename Connector to Backend. Extend Thin::Backends::Base to implement your own.
|
116
|
+
* Fix high memory usage with big POST body, fixes #48
|
117
|
+
|
118
|
+
== 0.7.0 Spherical Cow release
|
119
|
+
* Add --max-persistent-conns option to sets the maximum number of persistent connections.
|
120
|
+
Set to 0 to disable Keep-Alive.
|
121
|
+
* INT signal now force stop and QUIT signal gracefully stops.
|
122
|
+
* Warn when descriptors table size can't be set as high as expected.
|
123
|
+
* Eval Rackup config file using top level bindings.
|
124
|
+
* Remove daemons gem dependency on Windows plateform, fixes #45.
|
125
|
+
* Change default timeout from 60 to 30 seconds.
|
126
|
+
* Add --max-conns option to sets the maximum number of file or socket descriptors that
|
127
|
+
your process may open, defaults to 1024.
|
128
|
+
* Tail logfile when stopping and restarting a demonized server, fixes #26.
|
129
|
+
* Wrap application in a Rack::CommonLogger adapter in debug mode.
|
130
|
+
* --debug (-D) option no longer set $DEBUG so logging will be less verbose
|
131
|
+
and Ruby won't be too strict, fixes #36.
|
132
|
+
* Deprecate Server#silent in favour of Logging.silent.
|
133
|
+
* Persistent connection (keep-alive) support.
|
134
|
+
* Fix -s option not being included in generated config file, fixes #37.
|
135
|
+
* Add Swiftiply support. Use w/ the --swiftiply (-y) option in the thin script,
|
136
|
+
closes #28 [Alex MacCaw]
|
137
|
+
|
138
|
+
== 0.6.4 Sexy Lobster release
|
139
|
+
* Fix error when stopping server on UNIX domain socket, fixes #42
|
140
|
+
* Rescue errors in Connection#get_peername more gracefully, setting REMOTE_ADDR to nil, fixes #43
|
141
|
+
|
142
|
+
== 0.6.3 Ninja Cookie release
|
143
|
+
* Add tasks for Vlad the Deployer in example/vlad.rake [cnantais]
|
144
|
+
* Add Ramaze Rackup config file in example dir [tmm1]
|
145
|
+
Use like this from you Ramaze app dir:
|
146
|
+
|
147
|
+
thin start -r /path/to/thin/example/ramaze.ru
|
148
|
+
|
149
|
+
* Add the --rackup option to load a Rack config file instead of the Rails adapter.
|
150
|
+
So you can use any framework with the thin script and start cluster and stuff like that.
|
151
|
+
A Rack config file is one that is usable through the rackup command and looks like this:
|
152
|
+
|
153
|
+
use Rack::CommonLogger
|
154
|
+
run MyCrazyRackAdapter.new(:uterly, 'cool')
|
155
|
+
|
156
|
+
Then use it with thin like this:
|
157
|
+
|
158
|
+
thin start --rackup config.ru
|
159
|
+
|
160
|
+
* thin config --chrdir ... -C thin/yml do not change current directory anymore, fixes #33.
|
161
|
+
* Add a better sample god config file in example/thin.god that loads all info from config
|
162
|
+
files in /etc/thin. Drop-in replacement for the thin runlevel service [Gump].
|
163
|
+
* Add support for specifying a custom Connector to the server and add more doc about Server
|
164
|
+
configuration.
|
165
|
+
* Add a script to run thin as a runlevel service that can start at startup, closes #31 [Gump]
|
166
|
+
Setup the service like this:
|
167
|
+
|
168
|
+
sudo thin install /etc/thin
|
169
|
+
|
170
|
+
This will install the boot script under /etc/init.d/thin. Then copy your config files to
|
171
|
+
/etc/thin. Works only under Linux.
|
172
|
+
* Set process name to 'thin server (0.0.0.0:3000)' when running as a daemon, closes #32.
|
173
|
+
* Make sure chdir option from config file is used when present.
|
174
|
+
* Raise an error when starting a server as a daemon and pid file already exist, fixes #27.
|
175
|
+
|
176
|
+
== 0.6.2 Rambo release
|
177
|
+
* Server now let current connections finish before stopping, fixes #18
|
178
|
+
* Fix uploading hanging bug when body is moved to a tempfile,
|
179
|
+
also delete the tempfile properly upon completion, fixes #25
|
180
|
+
* 'thin restart' now sends HUP signals rather then stopping & starting, closes #17
|
181
|
+
* HUP signal now launches a new process with the same options.
|
182
|
+
* Add PID and more info from the last request to the Stats adapter
|
183
|
+
mostly taken from Rack::ShowException.
|
184
|
+
* pid and log files in cluster are no longer required to be relative to the
|
185
|
+
app directory (chdir option), fixes #24
|
186
|
+
* Revert to using #each when building response headers under Ruby 1.8,
|
187
|
+
solves an issue w/ Camping adapter, fixes #22
|
188
|
+
* Restructure thin script options in 3 sections: server, daemon and cluster
|
189
|
+
* Add --only (-o) option to control only one server of a cluster.
|
190
|
+
* Stylize stats page and make the url configurable from the thin script.
|
191
|
+
* Raise error if attempting to use unix sockets on windows.
|
192
|
+
* Add example config files for http://www.tildeslash.com/monit usage.
|
193
|
+
Include the example file using "include /path/to/thin/monit/file" in your monitrc file.
|
194
|
+
The group settings let you do this to manage your clusters:
|
195
|
+
|
196
|
+
sudo monit -g blog restart all
|
197
|
+
|
198
|
+
There are examples of thin listening on sockets and thin listening on unix sockets.
|
199
|
+
|
200
|
+
== 0.6.1 Cheesecake release
|
201
|
+
* Remove socket file when server stops.
|
202
|
+
* Set back cluster to use 'thin' command to launch servers.
|
203
|
+
|
204
|
+
== 0.6.0 Big Pony release
|
205
|
+
* Add support for connection through UNIX domain socket.
|
206
|
+
Use the --socket (-S) option w/ the thin script to configure the socket filename.
|
207
|
+
Nginx support binding to a UNIX socket like this:
|
208
|
+
|
209
|
+
upstream backend {
|
210
|
+
server unix:/tmp/thin.0.sock;
|
211
|
+
server unix:/tmp/thin.1.sock;
|
212
|
+
server unix:/tmp/thin.2.sock;
|
213
|
+
}
|
214
|
+
|
215
|
+
Start your servers like this:
|
216
|
+
|
217
|
+
thin start -s3 -S/tmp/thin.sock
|
218
|
+
|
219
|
+
* Remove Server#listen! method. Use Server#start instead.
|
220
|
+
* Server can now yield a Rack::Builder to allow building an app in one call:
|
221
|
+
|
222
|
+
Server.start '0.0.0.0', 3000 do
|
223
|
+
use Rack::CommonLogger
|
224
|
+
use Rack::ShowExceptions
|
225
|
+
map "/lobster" do
|
226
|
+
use Rack::Lint
|
227
|
+
run Rack::Lobster.new
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
* Add a very basic stats page through Stats adapter, load w/ --stats and browse to /stats.
|
232
|
+
* Add --trace (-V) option to trace request/response and get backtrace w/out all Ruby debug stuff.
|
233
|
+
* Add --config (-C) option to load options from a config file in thin script [Matt Todd].
|
234
|
+
* Alter response headers to output directly to a string.
|
235
|
+
* Improve specs stability.
|
236
|
+
* Move request body to a Tempfile if too big (> 112 MB)
|
237
|
+
* Remove useless check for max header size in Request (already done in the parser)
|
238
|
+
|
239
|
+
== 0.5.4 Flying Mustard release
|
240
|
+
* Don't read the full body, use direct streaming when sending response.
|
241
|
+
See: Response#each
|
242
|
+
As a result, the Content-Length can not be calculated anymore.
|
243
|
+
You have to do set this in your adapter. All frameworks do it anyway.
|
244
|
+
It improve memory usage and boost speed for low concurrency.
|
245
|
+
Thanks to Kent Sibilev and Ezra for their help on that one.
|
246
|
+
* Add 'Server' response header
|
247
|
+
* Fix --user and --group option not changing daemon process privileges
|
248
|
+
|
249
|
+
== 0.5.3 Purple Yogurt release
|
250
|
+
* win32 pre-compiled gem now available
|
251
|
+
* change rake task configuration to allow win32 gem build
|
252
|
+
* Add prefix option to thin script to mount app under a given path.
|
253
|
+
|
254
|
+
== 0.5.2 Cheezburger release
|
255
|
+
* Add cluster support through the -s option in the thin script, start 3 thins like this:
|
256
|
+
thin start -s3 -p3000
|
257
|
+
3 thin servers will be started on port 3000, 3001, 3002, also the port number will be
|
258
|
+
injected in the pid and log filenames.
|
259
|
+
* Fix IOError when writing to logger when starting server as a daemon.
|
260
|
+
* Really change directory when the -c option is specified.
|
261
|
+
* Add restart command to thin script.
|
262
|
+
* Fix typos in thin script usage message and expand chdir path.
|
263
|
+
* Rename thin script options to be the same as mongrel_rails script [thronedrk]:
|
264
|
+
-o --host => -a --address
|
265
|
+
--log-file => --log
|
266
|
+
--pid-file => --pid
|
267
|
+
--env => --environment
|
268
|
+
|
269
|
+
== 0.5.1 LOLCAT release
|
270
|
+
* Add URL rewriting to Rails adapter so that page caching works and / fetches index.html if present.
|
271
|
+
* Fix bug in multiline response header parsing.
|
272
|
+
* Add specs for the Rails adapter.
|
273
|
+
* Fix Set-Cookie headers in Rails adapter to handle multiple values correctly.
|
274
|
+
* Fix Ruby 1.9 incompatibility in Response#headers= and Rakefile.
|
275
|
+
* Fix parser to be Ruby 1.9 compatible [Aman Gupta]
|
276
|
+
* Set gemspec to use EventMachine version 0.8.1 as it's the latest one having precompiled windows binaries.
|
277
|
+
[Francis Cianfrocca].
|
278
|
+
* Add -D option to thin script to set debugging on.
|
279
|
+
* Output incoming data and response when debugging is on.
|
280
|
+
|
281
|
+
== 0.5.0
|
282
|
+
* Full rewrite to use EventMachine, Rack and Mongrel parser
|
283
|
+
|
284
|
+
== 0.4.1
|
285
|
+
* Fix Rails environment option not being used in thin script.
|
286
|
+
|
287
|
+
== 0.4.0
|
288
|
+
* First alphaish release as a gem.
|
data/COPYING
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2008 Marc-Andre Cournoyer
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
5
|
+
deal in the Software without restriction, including without limitation the
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
== Thin
|
2
|
+
Tiny, fast & funny HTTP server
|
3
|
+
|
4
|
+
Thin is a Ruby web server that glues together 3 of the best Ruby libraries in web history:
|
5
|
+
* the Mongrel parser: the root of Mongrel speed and security
|
6
|
+
* Event Machine: a network I/O library with extremely high scalability, performance and stability
|
7
|
+
* Rack: a minimal interface between webservers and Ruby frameworks
|
8
|
+
|
9
|
+
Which makes it, with all humility, the most secure, stable, fast and extensible Ruby web server
|
10
|
+
bundled in an easy to use gem for your own pleasure.
|
11
|
+
|
12
|
+
Site: http://code.macournoyer.com/thin/
|
13
|
+
Group: http://groups.google.com/group/thin-ruby/topics
|
14
|
+
Bugs: http://thin.lighthouseapp.com/projects/7212-thin
|
15
|
+
Code: http://github.com/macournoyer/thin
|
16
|
+
IRC: #thin on freenode
|
17
|
+
|
18
|
+
=== Installation
|
19
|
+
For the latest stable version:
|
20
|
+
|
21
|
+
sudo gem install thin
|
22
|
+
|
23
|
+
Or from source:
|
24
|
+
|
25
|
+
git clone git://github.com/macournoyer/thin.git
|
26
|
+
cd thin
|
27
|
+
rake install
|
28
|
+
|
29
|
+
=== Usage
|
30
|
+
A +thin+ script offers an easy way to start your Rails application:
|
31
|
+
|
32
|
+
cd to/your/rails/app
|
33
|
+
thin start
|
34
|
+
|
35
|
+
But Thin is also usable with a Rack config file.
|
36
|
+
You need to setup a config.ru file and pass it to the thin script:
|
37
|
+
|
38
|
+
cat config.ru
|
39
|
+
app = proc do |env|
|
40
|
+
[
|
41
|
+
200,
|
42
|
+
{
|
43
|
+
'Content-Type' => 'text/html',
|
44
|
+
'Content-Length' => '2'
|
45
|
+
},
|
46
|
+
['hi']
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
run app
|
51
|
+
|
52
|
+
thin start -R config.ru
|
53
|
+
|
54
|
+
See example directory for more samples and run 'thin -h' for usage.
|
55
|
+
|
56
|
+
=== License
|
57
|
+
Ruby License, http://www.ruby-lang.org/en/LICENSE.txt.
|
58
|
+
|
59
|
+
=== Credits
|
60
|
+
The parser was stolen from Mongrel http://mongrel.rubyforge.org by Zed Shaw.
|
61
|
+
Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw
|
62
|
+
<zedshaw at zedshaw dot com> You can redistribute it and/or modify it under
|
63
|
+
either the terms of the GPL.
|
64
|
+
|
65
|
+
Thin is copyright Marc-Andre Cournoyer <macournoyer@gmail.com>
|
66
|
+
|
67
|
+
Get help at http://groups.google.com/group/thin-ruby/
|
68
|
+
Report bugs at http://thin.lighthouseapp.com/projects/7212-thin
|
69
|
+
and major security issues directly to a team member (see COMMITTERS)
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
|
2
|
+
WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
|
3
|
+
SUDO = (WIN ? "" : "sudo")
|
4
|
+
|
5
|
+
require 'rake'
|
6
|
+
require 'rake/clean'
|
7
|
+
require 'rake/extensiontask' # from rake-compiler gem
|
8
|
+
|
9
|
+
$: << File.join(File.dirname(__FILE__), 'lib')
|
10
|
+
require 'thin'
|
11
|
+
|
12
|
+
# Load tasks in tasks/
|
13
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
14
|
+
|
15
|
+
task :default => :spec
|
16
|
+
|
17
|
+
Rake::ExtensionTask.new('thin_parser', Thin::GemSpec) do |ext|
|
18
|
+
# enable cross compilation (requires cross compile toolchain)
|
19
|
+
ext.cross_compile = true
|
20
|
+
|
21
|
+
# forces the Windows platform instead of the default one
|
22
|
+
# configure options only for cross compile
|
23
|
+
ext.cross_platform = %w( i386-mswin32 x86-mingw32 )
|
24
|
+
end
|
25
|
+
|
26
|
+
CLEAN.include %w(**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log} ext/*/Makefile ext/*/conftest.dSYM lib/1.{8,9}})
|
27
|
+
|
28
|
+
desc "Compile the Ragel state machines"
|
29
|
+
task :ragel do
|
30
|
+
Dir.chdir 'ext/thin_parser' do
|
31
|
+
target = "parser.c"
|
32
|
+
File.unlink target if File.exist? target
|
33
|
+
sh "ragel parser.rl -G2 -o #{target}"
|
34
|
+
raise "Failed to compile Ragel state machine" unless File.exist? target
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Build gem packages"
|
39
|
+
task :gems do
|
40
|
+
sh "rake clean gem && rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1"
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Release version #{Thin::VERSION::STRING} gems to rubyforge"
|
44
|
+
task :release => [:tag, "gem:push"]
|
data/benchmark/abc
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Automate benchmarking with ab with various concurrency levels.
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = {
|
6
|
+
:address => '0.0.0.0',
|
7
|
+
:port => 3000,
|
8
|
+
:requests => 1000,
|
9
|
+
:start => 1,
|
10
|
+
:end => 100,
|
11
|
+
:step => 10
|
12
|
+
}
|
13
|
+
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
16
|
+
|
17
|
+
opts.on("-n", "--requests NUM", "Number of requests") { |num| options[:requests] = num }
|
18
|
+
opts.on("-a", "--address HOST", "Address (default: 0.0.0.0)") { |host| options[:address] = host }
|
19
|
+
opts.on("-p", "--port PORT", "use PORT (default: 3000)") { |port| options[:port] = port.to_i }
|
20
|
+
opts.on("-s", "--start N", "First concurrency level") { |n| options[:start] = n.to_i }
|
21
|
+
opts.on("-e", "--end N", "Last concurrency level") { |n| options[:end] = n.to_i }
|
22
|
+
opts.on("-S", "--step N", "Concurrency level step") { |n| options[:step] = n.to_i }
|
23
|
+
opts.on("-u", "--uri PATH", "Path to send to") { |u| options[:uri] = u }
|
24
|
+
opts.on("-k", "--keep-alive", "Use Keep-Alive") { options[:keep_alive] = true }
|
25
|
+
|
26
|
+
opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
|
27
|
+
end.parse!(ARGV)
|
28
|
+
|
29
|
+
puts 'request concurrency req/s failures'
|
30
|
+
puts '=' * 42
|
31
|
+
|
32
|
+
c = options[:start]
|
33
|
+
until c >= options[:end]
|
34
|
+
sleep 0.5
|
35
|
+
out = `nice -n20 ab #{'-k' if options[:keep_alive]} -c #{c} -n #{options[:requests]} #{options[:address]}:#{options[:port]}/#{options[:uri]} 2> /dev/null`
|
36
|
+
|
37
|
+
r = if requests = out.match(/^Requests.+?(\d+\.\d+)/)
|
38
|
+
requests[1].to_i
|
39
|
+
else
|
40
|
+
0
|
41
|
+
end
|
42
|
+
f = if requests = out.match(/^Failed requests.+?(\d+)/)
|
43
|
+
requests[1].to_i
|
44
|
+
else
|
45
|
+
0
|
46
|
+
end
|
47
|
+
|
48
|
+
puts "#{options[:requests].to_s.ljust(9)} #{c.to_s.ljust(13)} #{r.to_s.ljust(8)} #{f}"
|
49
|
+
|
50
|
+
c += options[:step]
|
51
|
+
end
|