friendlyfashion-thin 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +346 -0
- data/README.md +64 -0
- data/Rakefile +24 -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 +75 -0
- data/lib/rack/adapter/rails.rb +183 -0
- data/lib/thin.rb +45 -0
- data/lib/thin/backends/base.rb +151 -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 +56 -0
- data/lib/thin/command.rb +53 -0
- data/lib/thin/connection.rb +201 -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 +185 -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 +104 -0
- data/lib/thin/runner.rb +222 -0
- data/lib/thin/server.rb +270 -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
- metadata +151 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
== 1.4.1 Chromeo Fix
|
2
|
+
* Fix error when sending USR1 signal and no log file is supplied.
|
3
|
+
|
4
|
+
== 1.4.0 Chromeo
|
5
|
+
* kill -USR1 $PID for log rotation [catwell].
|
6
|
+
* Fix HUP signal being reseted after deamonization [atotic].
|
7
|
+
* Fix error with nil addresses in Connection#socket_address.
|
8
|
+
|
9
|
+
== 1.3.2 Low-bar Squat
|
10
|
+
* Remove mack and halcyon Rack adapters from automatic detection.
|
11
|
+
|
12
|
+
== 1.3.1 Triple Espresso
|
13
|
+
* Fix service not working pre 1.9.
|
14
|
+
|
15
|
+
== 1.3.0 Double Espresso
|
16
|
+
* BREAKING CHANGE: Thin no longer ships with fat Windows binaries.
|
17
|
+
From now on, to install on Windows, install https://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
|
18
|
+
* BREAKING CHANGE: Remove automatic Content-Length setting.
|
19
|
+
It is now the responsibility of the app (or a middleware) to set the Content-Length.
|
20
|
+
* Log errors to STDERR [textgoeshere]
|
21
|
+
* Shut down gracefully when receiving SIGTERM [ddollar]
|
22
|
+
|
23
|
+
Processes are allowed a chance to shut down gracefully when receiving
|
24
|
+
SIGTERM (http://en.wikipedia.org/wiki/SIGTERM).
|
25
|
+
|
26
|
+
On Heroku, when shutting down a process, we send a SIGTERM followed 10
|
27
|
+
seconds later with a SIGKILL, similar to the behavior of the init daemon
|
28
|
+
on most Unix systems. This patch will allow Heroku apps to shut down
|
29
|
+
gracefully when they need to be terminated / moved.
|
30
|
+
|
31
|
+
== 1.2.11 Bat-Shit Crazy
|
32
|
+
* Fix pure Ruby gem to not include binary.
|
33
|
+
|
34
|
+
== 1.2.10 I'm dumb (BAD RELEASE, DON'T USE)
|
35
|
+
* I really am (bad release fix)
|
36
|
+
|
37
|
+
== 1.2.9 Black Keys Extra Plus Wow (BAD RELEASE, DON'T USE)
|
38
|
+
* Improve fat binary loading.
|
39
|
+
|
40
|
+
== 1.2.8 Black Keys
|
41
|
+
* Allow the connection to remain open for 1xx statuses [timshadel]
|
42
|
+
|
43
|
+
Both the 100 and 101 status codes require that the connection to the
|
44
|
+
server remain open. The 100 status code is used to tell the client that
|
45
|
+
the server is still receiving its request, and will continue to read
|
46
|
+
request input on the connection. The 101 status code is used to upgrade
|
47
|
+
the existing connection to another protocol, and specifically is NOT
|
48
|
+
used to upgrade a separate connection. Therefore, the connection must
|
49
|
+
remain open after this response in order to facilitate that.
|
50
|
+
|
51
|
+
* Accept IE7 badly encoded URL (eg.: %uEEEE)
|
52
|
+
* Fix gemspec to work w/ Bundler [smparkes]
|
53
|
+
* Add SSL support [tmm1]
|
54
|
+
* Catch Errno::EPERM in Process.running? [Tony Kemp]
|
55
|
+
On some systems (e.g. OpenBSD) you receive an EPERM exception if
|
56
|
+
you try to Process.getpgid on a process you do not own (even if you
|
57
|
+
are root). But it does mean that the process exists, so return true.
|
58
|
+
* Fix Rails version check that select which Rack adapter to use. Was using CGI adapter in Rails 3.
|
59
|
+
* Ignore SIGHUP when no restart block is given
|
60
|
+
* Add SSL options to thin command line tool [goldmann]
|
61
|
+
|
62
|
+
--ssl Enables SSL
|
63
|
+
--ssl-key-file PATH Path to private key
|
64
|
+
--ssl-cert-file PATH Path to certificate
|
65
|
+
--ssl-verify Enables SSL certificate verification
|
66
|
+
|
67
|
+
* Expose peer SSL certificate in env (rack.peer_cert) [fd]
|
68
|
+
* Adjusting unix socket permissions to be more open [mbj]
|
69
|
+
|
70
|
+
== 1.2.7 No Hup
|
71
|
+
* Support multiple Ruby version (fat binaries under windows)
|
72
|
+
* Do not trap unsupported HUP signal on Windows
|
73
|
+
|
74
|
+
== 1.2.6 Crazy Delicious
|
75
|
+
* Make work with Rails 3 out-of-the-box.
|
76
|
+
* Auto-detect and load config.ru files on start. Makes Rails 3 work.
|
77
|
+
* Fix signals being ignored under 1.9 when daemonized.
|
78
|
+
|
79
|
+
== 1.2.5 This Is Not A Web Server
|
80
|
+
* Add rolling restart support (--onebyone option) [sikachu]
|
81
|
+
* Force external_encoding of request's body to ASCII_8BIT [jeremyz]
|
82
|
+
* Ensure Rack base API is used in Rails adapter only if version >= 2.3.2 [#111 state:resolved]
|
83
|
+
|
84
|
+
== 1.2.4 Flaming Astroboy
|
85
|
+
* Fix a few issues in thin to make it a better "gem citizen" [josh]
|
86
|
+
* Fix test for rack based Rails in adapter under Ruby >= 1.8.7 [#109 state:resolved]
|
87
|
+
* Fix Remote address spoofing vulnerability in Connection#remote_address [Alexey Borzenkov]
|
88
|
+
* Fix uninitialized constant ActionController::Dispatcher error with Rails 1.2.3 [Chris Anderton] [#103 state:resolved]
|
89
|
+
|
90
|
+
== 1.2.2 I Find Your Lack of Sauce Disturbing release
|
91
|
+
* Fix force kill under 1.9 [Alexey Chebotar]
|
92
|
+
* Fix regression when --only option is used w/ --socket.
|
93
|
+
* Add process name 'tag' functionality. Easier to distinguish thin daemons
|
94
|
+
from eachother in process listing [ctcherry]
|
95
|
+
|
96
|
+
== 1.2.1 Asynctilicious Ultra Supreme release
|
97
|
+
* Require Rack 1.0.0
|
98
|
+
* Require EventMachine 0.12.6
|
99
|
+
* Use Rails Rack based dispatcher when available
|
100
|
+
* Allow String for response body
|
101
|
+
* Require openssl before eventmachine to prevent crash in 1.9
|
102
|
+
|
103
|
+
== 1.2.0 Asynctilicious Supreme release
|
104
|
+
* Add support for Windows mingw Ruby distro [Juan C. Rodriguez]
|
105
|
+
* Add async response support, see example/async_*.ru [raggi]
|
106
|
+
|
107
|
+
== 1.1.1 Super Disco Power Plus release
|
108
|
+
* Fix bug when running with only options [hasimo]
|
109
|
+
|
110
|
+
== 1.1.0 Super Disco Power release
|
111
|
+
* Require EventMachine 0.12.4
|
112
|
+
* Remove Thin handler, now part of Rack 0.9.1
|
113
|
+
* Fix Rack protocol version to 0.1 in environment hash.
|
114
|
+
* Fix error when passing no_epoll option to a cluster.
|
115
|
+
* Omit parsing #defined strings [Jérémy Zurcher]
|
116
|
+
* Defaults SERVER_NAME to localhost like webrick does [#87 state:resolved]
|
117
|
+
* Namespace parser to prevent error when mongrel is required [cliffmoon]
|
118
|
+
* Set RACK_ENV based on environment option when loading rackup file [Curtis Summers] [#83 state:resolved]
|
119
|
+
* Fixes a warning RE relative_url_root when using a prefix with Rails 2.1.1 [seriph] [#85 state:resolved]
|
120
|
+
* --only can work as a sequence number (if < 80) or a port number (if >= 80) [jmay] [#81 state:resolved]
|
121
|
+
|
122
|
+
== 1.0.0 That's What She Said release
|
123
|
+
* Fixed vlad.rake to allow TCP or socket [hellekin]
|
124
|
+
* Updated Mack adapter to handle both <0.8.0 and >0.8.0 [Mark Bates]
|
125
|
+
* rails rack adapter uses File.readable_real? so it recognizes ACL permissions [Ricardo Chimal]
|
126
|
+
* Log a warning if Rack application returns nil body [Michael S. Klishin]
|
127
|
+
* Handle nil and Time header values correctly [#76 state:resolved] [tmm1]
|
128
|
+
* Add Content-Length header to response automatically when possible [#74 state:resolved] [dkubb]
|
129
|
+
* Runner now remembers -r, -D and -V parameters so that clustered servers inherit those and
|
130
|
+
`restart` keep your parameters.
|
131
|
+
* Make Set-Cookie header, in Rails adapter, compatible with current Rack spec [Pedro Belo]
|
132
|
+
[#73, state:resolved]
|
133
|
+
* Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
|
134
|
+
* Add --force (-f) option to force stopping of a daemonized server [#72 state:resolved]
|
135
|
+
* Update halycon adapter loader [mtodd]
|
136
|
+
|
137
|
+
== 0.8.2 Double Margarita release
|
138
|
+
* Require EventMachine 0.12.0
|
139
|
+
* [bug] Fix timeout handling when running command
|
140
|
+
* [bug] Fix hanging when restarting and no process is running in single server move, fixes #67
|
141
|
+
* Added Mack adapter [markbates]
|
142
|
+
* Allow rackup .rb files by getting a conventionally named constant as the app [bmizerany]
|
143
|
+
|
144
|
+
== 0.8.1 Rebel Porpoise release
|
145
|
+
* [bug] Rescue all types of errors when processing request, fixes #62
|
146
|
+
* [bug] Use Swiftiply backend when -y option is specified, fixes #63 and #64
|
147
|
+
* Allow passing port as a string in Server.new
|
148
|
+
* Define deferred?(env) in your Rack application to set if a request is handled in a
|
149
|
+
thread (return true) or not (return false).
|
150
|
+
|
151
|
+
== 0.8.0 Dodgy Dentist release
|
152
|
+
* [bug] Fix server crash when header too large.
|
153
|
+
* Add --require (-r) option to require a library, before executing your script.
|
154
|
+
* Rename --rackup short option to -R, warn and load as rackup when file ends with .ru.
|
155
|
+
* List supported adapters in command usage.
|
156
|
+
* Add file adapter to built-in adapter, serve static files in current directory.
|
157
|
+
* Allow disabling signal handling in Server with :signals => false
|
158
|
+
* Make Server.new arguments more flexible, can now specify any of host, port, app or hash options.
|
159
|
+
* Add --backend option to specified which backend to use, closes #55
|
160
|
+
* [bug] Serve static file only on GET and HEAD requests in Rails adapter, fixes #58
|
161
|
+
* Add threaded option to run server in threaded mode, calling the application in a
|
162
|
+
thread allowing for concurrency in the Rack adapter, closes #46
|
163
|
+
* Guess which adapter to use from directory (chdir option)
|
164
|
+
or use specified one in 'adapter' option, re #47.
|
165
|
+
|
166
|
+
== 0.7.1 Fancy Pants release
|
167
|
+
* Clean stale PID files when starting as daemon, fixes #53 [Chu Yeow]
|
168
|
+
* Require EventMachine 0.11.0 for UNIX domain sockets. Until it's released, install from:
|
169
|
+
gem install eventmachine --source http://code.macournoyer.com
|
170
|
+
* Ruby 1.8.5 compatibility, closes #49 [Wincent Colaiuta]
|
171
|
+
* Move all EventMachine stuff out of Server, you can now create a Thin Backend that
|
172
|
+
does not depend on EventMachine.
|
173
|
+
* Rename Connector to Backend. Extend Thin::Backends::Base to implement your own.
|
174
|
+
* Fix high memory usage with big POST body, fixes #48
|
175
|
+
|
176
|
+
== 0.7.0 Spherical Cow release
|
177
|
+
* Add --max-persistent-conns option to sets the maximum number of persistent connections.
|
178
|
+
Set to 0 to disable Keep-Alive.
|
179
|
+
* INT signal now force stop and QUIT signal gracefully stops.
|
180
|
+
* Warn when descriptors table size can't be set as high as expected.
|
181
|
+
* Eval Rackup config file using top level bindings.
|
182
|
+
* Remove daemons gem dependency on Windows plateform, fixes #45.
|
183
|
+
* Change default timeout from 60 to 30 seconds.
|
184
|
+
* Add --max-conns option to sets the maximum number of file or socket descriptors that
|
185
|
+
your process may open, defaults to 1024.
|
186
|
+
* Tail logfile when stopping and restarting a demonized server, fixes #26.
|
187
|
+
* Wrap application in a Rack::CommonLogger adapter in debug mode.
|
188
|
+
* --debug (-D) option no longer set $DEBUG so logging will be less verbose
|
189
|
+
and Ruby won't be too strict, fixes #36.
|
190
|
+
* Deprecate Server#silent in favour of Logging.silent.
|
191
|
+
* Persistent connection (keep-alive) support.
|
192
|
+
* Fix -s option not being included in generated config file, fixes #37.
|
193
|
+
* Add Swiftiply support. Use w/ the --swiftiply (-y) option in the thin script,
|
194
|
+
closes #28 [Alex MacCaw]
|
195
|
+
|
196
|
+
== 0.6.4 Sexy Lobster release
|
197
|
+
* Fix error when stopping server on UNIX domain socket, fixes #42
|
198
|
+
* Rescue errors in Connection#get_peername more gracefully, setting REMOTE_ADDR to nil, fixes #43
|
199
|
+
|
200
|
+
== 0.6.3 Ninja Cookie release
|
201
|
+
* Add tasks for Vlad the Deployer in example/vlad.rake [cnantais]
|
202
|
+
* Add Ramaze Rackup config file in example dir [tmm1]
|
203
|
+
Use like this from you Ramaze app dir:
|
204
|
+
|
205
|
+
thin start -r /path/to/thin/example/ramaze.ru
|
206
|
+
|
207
|
+
* Add the --rackup option to load a Rack config file instead of the Rails adapter.
|
208
|
+
So you can use any framework with the thin script and start cluster and stuff like that.
|
209
|
+
A Rack config file is one that is usable through the rackup command and looks like this:
|
210
|
+
|
211
|
+
use Rack::CommonLogger
|
212
|
+
run MyCrazyRackAdapter.new(:uterly, 'cool')
|
213
|
+
|
214
|
+
Then use it with thin like this:
|
215
|
+
|
216
|
+
thin start --rackup config.ru
|
217
|
+
|
218
|
+
* thin config --chrdir ... -C thin/yml do not change current directory anymore, fixes #33.
|
219
|
+
* Add a better sample god config file in example/thin.god that loads all info from config
|
220
|
+
files in /etc/thin. Drop-in replacement for the thin runlevel service [Gump].
|
221
|
+
* Add support for specifying a custom Connector to the server and add more doc about Server
|
222
|
+
configuration.
|
223
|
+
* Add a script to run thin as a runlevel service that can start at startup, closes #31 [Gump]
|
224
|
+
Setup the service like this:
|
225
|
+
|
226
|
+
sudo thin install /etc/thin
|
227
|
+
|
228
|
+
This will install the boot script under /etc/init.d/thin. Then copy your config files to
|
229
|
+
/etc/thin. Works only under Linux.
|
230
|
+
* Set process name to 'thin server (0.0.0.0:3000)' when running as a daemon, closes #32.
|
231
|
+
* Make sure chdir option from config file is used when present.
|
232
|
+
* Raise an error when starting a server as a daemon and pid file already exist, fixes #27.
|
233
|
+
|
234
|
+
== 0.6.2 Rambo release
|
235
|
+
* Server now let current connections finish before stopping, fixes #18
|
236
|
+
* Fix uploading hanging bug when body is moved to a tempfile,
|
237
|
+
also delete the tempfile properly upon completion, fixes #25
|
238
|
+
* 'thin restart' now sends HUP signals rather then stopping & starting, closes #17
|
239
|
+
* HUP signal now launches a new process with the same options.
|
240
|
+
* Add PID and more info from the last request to the Stats adapter
|
241
|
+
mostly taken from Rack::ShowException.
|
242
|
+
* pid and log files in cluster are no longer required to be relative to the
|
243
|
+
app directory (chdir option), fixes #24
|
244
|
+
* Revert to using #each when building response headers under Ruby 1.8,
|
245
|
+
solves an issue w/ Camping adapter, fixes #22
|
246
|
+
* Restructure thin script options in 3 sections: server, daemon and cluster
|
247
|
+
* Add --only (-o) option to control only one server of a cluster.
|
248
|
+
* Stylize stats page and make the url configurable from the thin script.
|
249
|
+
* Raise error if attempting to use unix sockets on windows.
|
250
|
+
* Add example config files for http://www.tildeslash.com/monit usage.
|
251
|
+
Include the example file using "include /path/to/thin/monit/file" in your monitrc file.
|
252
|
+
The group settings let you do this to manage your clusters:
|
253
|
+
|
254
|
+
sudo monit -g blog restart all
|
255
|
+
|
256
|
+
There are examples of thin listening on sockets and thin listening on unix sockets.
|
257
|
+
|
258
|
+
== 0.6.1 Cheesecake release
|
259
|
+
* Remove socket file when server stops.
|
260
|
+
* Set back cluster to use 'thin' command to launch servers.
|
261
|
+
|
262
|
+
== 0.6.0 Big Pony release
|
263
|
+
* Add support for connection through UNIX domain socket.
|
264
|
+
Use the --socket (-S) option w/ the thin script to configure the socket filename.
|
265
|
+
Nginx support binding to a UNIX socket like this:
|
266
|
+
|
267
|
+
upstream backend {
|
268
|
+
server unix:/tmp/thin.0.sock;
|
269
|
+
server unix:/tmp/thin.1.sock;
|
270
|
+
server unix:/tmp/thin.2.sock;
|
271
|
+
}
|
272
|
+
|
273
|
+
Start your servers like this:
|
274
|
+
|
275
|
+
thin start -s3 -S/tmp/thin.sock
|
276
|
+
|
277
|
+
* Remove Server#listen! method. Use Server#start instead.
|
278
|
+
* Server can now yield a Rack::Builder to allow building an app in one call:
|
279
|
+
|
280
|
+
Server.start '0.0.0.0', 3000 do
|
281
|
+
use Rack::CommonLogger
|
282
|
+
use Rack::ShowExceptions
|
283
|
+
map "/lobster" do
|
284
|
+
use Rack::Lint
|
285
|
+
run Rack::Lobster.new
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
* Add a very basic stats page through Stats adapter, load w/ --stats and browse to /stats.
|
290
|
+
* Add --trace (-V) option to trace request/response and get backtrace w/out all Ruby debug stuff.
|
291
|
+
* Add --config (-C) option to load options from a config file in thin script [Matt Todd].
|
292
|
+
* Alter response headers to output directly to a string.
|
293
|
+
* Improve specs stability.
|
294
|
+
* Move request body to a Tempfile if too big (> 112 MB)
|
295
|
+
* Remove useless check for max header size in Request (already done in the parser)
|
296
|
+
|
297
|
+
== 0.5.4 Flying Mustard release
|
298
|
+
* Don't read the full body, use direct streaming when sending response.
|
299
|
+
See: Response#each
|
300
|
+
As a result, the Content-Length can not be calculated anymore.
|
301
|
+
You have to do set this in your adapter. All frameworks do it anyway.
|
302
|
+
It improve memory usage and boost speed for low concurrency.
|
303
|
+
Thanks to Kent Sibilev and Ezra for their help on that one.
|
304
|
+
* Add 'Server' response header
|
305
|
+
* Fix --user and --group option not changing daemon process privileges
|
306
|
+
|
307
|
+
== 0.5.3 Purple Yogurt release
|
308
|
+
* win32 pre-compiled gem now available
|
309
|
+
* change rake task configuration to allow win32 gem build
|
310
|
+
* Add prefix option to thin script to mount app under a given path.
|
311
|
+
|
312
|
+
== 0.5.2 Cheezburger release
|
313
|
+
* Add cluster support through the -s option in the thin script, start 3 thins like this:
|
314
|
+
thin start -s3 -p3000
|
315
|
+
3 thin servers will be started on port 3000, 3001, 3002, also the port number will be
|
316
|
+
injected in the pid and log filenames.
|
317
|
+
* Fix IOError when writing to logger when starting server as a daemon.
|
318
|
+
* Really change directory when the -c option is specified.
|
319
|
+
* Add restart command to thin script.
|
320
|
+
* Fix typos in thin script usage message and expand chdir path.
|
321
|
+
* Rename thin script options to be the same as mongrel_rails script [thronedrk]:
|
322
|
+
-o --host => -a --address
|
323
|
+
--log-file => --log
|
324
|
+
--pid-file => --pid
|
325
|
+
--env => --environment
|
326
|
+
|
327
|
+
== 0.5.1 LOLCAT release
|
328
|
+
* Add URL rewriting to Rails adapter so that page caching works and / fetches index.html if present.
|
329
|
+
* Fix bug in multiline response header parsing.
|
330
|
+
* Add specs for the Rails adapter.
|
331
|
+
* Fix Set-Cookie headers in Rails adapter to handle multiple values correctly.
|
332
|
+
* Fix Ruby 1.9 incompatibility in Response#headers= and Rakefile.
|
333
|
+
* Fix parser to be Ruby 1.9 compatible [Aman Gupta]
|
334
|
+
* Set gemspec to use EventMachine version 0.8.1 as it's the latest one having precompiled windows binaries.
|
335
|
+
[Francis Cianfrocca].
|
336
|
+
* Add -D option to thin script to set debugging on.
|
337
|
+
* Output incoming data and response when debugging is on.
|
338
|
+
|
339
|
+
== 0.5.0
|
340
|
+
* Full rewrite to use EventMachine, Rack and Mongrel parser
|
341
|
+
|
342
|
+
== 0.4.1
|
343
|
+
* Fix Rails environment option not being used in thin script.
|
344
|
+
|
345
|
+
== 0.4.0
|
346
|
+
* First alphaish release as a gem.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
Thin
|
2
|
+
====
|
3
|
+
|
4
|
+
Tiny, fast & funny HTTP server
|
5
|
+
|
6
|
+
Thin is a Ruby web server that glues together 3 of the best Ruby libraries in web history:
|
7
|
+
|
8
|
+
* The Mongrel parser: the root of Mongrel speed and security
|
9
|
+
* Event Machine: a network I/O library with extremely high scalability, performance and stability
|
10
|
+
* Rack: a minimal interface between webservers and Ruby frameworks
|
11
|
+
|
12
|
+
Which makes it, with all humility, the most secure, stable, fast and extensible Ruby web server
|
13
|
+
bundled in an easy to use gem for your own pleasure.
|
14
|
+
|
15
|
+
Site: http://code.macournoyer.com/thin/
|
16
|
+
Group: http://groups.google.com/group/thin-ruby/topics
|
17
|
+
Bugs: http://github.com/macournoyer/thin/issues
|
18
|
+
Code: http://github.com/macournoyer/thin
|
19
|
+
IRC: #thin on freenode
|
20
|
+
|
21
|
+
Installation
|
22
|
+
============
|
23
|
+
For the latest stable version:
|
24
|
+
|
25
|
+
`gem install thin`
|
26
|
+
|
27
|
+
Or from source:
|
28
|
+
|
29
|
+
```
|
30
|
+
git clone git://github.com/macournoyer/thin.git
|
31
|
+
cd thin
|
32
|
+
rake install
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
Usage
|
37
|
+
=====
|
38
|
+
A +thin+ script offers an easy way to start your Rack application:
|
39
|
+
|
40
|
+
```
|
41
|
+
cd to/your/app
|
42
|
+
thin start
|
43
|
+
```
|
44
|
+
|
45
|
+
When using with Rails and Bundler, make sure to add `gem 'thin'`
|
46
|
+
to your Gemfile.
|
47
|
+
|
48
|
+
See example directory for samples and run 'thin -h' for usage.
|
49
|
+
|
50
|
+
License
|
51
|
+
=======
|
52
|
+
Ruby License, http://www.ruby-lang.org/en/LICENSE.txt.
|
53
|
+
|
54
|
+
Credits
|
55
|
+
=======
|
56
|
+
The parser was stolen from Mongrel http://mongrel.rubyforge.org by Zed Shaw.
|
57
|
+
Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed under
|
58
|
+
the Ruby license and the GPL2.
|
59
|
+
|
60
|
+
Thin is copyright Marc-Andre Cournoyer <macournoyer@gmail.com>
|
61
|
+
|
62
|
+
Get help at http://groups.google.com/group/thin-ruby/
|
63
|
+
Report bugs at https://github.com/macournoyer/thin/issues
|
64
|
+
and major security issues directly to me macournoyer@gmail.com.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rake'
|
2
|
+
load 'thin.gemspec'
|
3
|
+
|
4
|
+
# Load tasks in tasks/
|
5
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
desc "Build gem packages"
|
10
|
+
task :build do
|
11
|
+
sh "gem build thin.gemspec"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Push gem packages"
|
15
|
+
task :push => :build do
|
16
|
+
sh "gem push thin-*.gem"
|
17
|
+
end
|
18
|
+
|
19
|
+
task :install => :build do
|
20
|
+
sh "gem install thin-*.gem"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Release version #{Thin::VERSION::STRING}"
|
24
|
+
task :release => [:tag, :push]
|
data/bin/thin
ADDED
data/example/adapter.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Run with: ruby adapter.rb
|
2
|
+
# Then browse to http://localhost:3000/test
|
3
|
+
# and http://localhost:3000/files/adapter.rb
|
4
|
+
require 'thin'
|
5
|
+
|
6
|
+
class SimpleAdapter
|
7
|
+
def call(env)
|
8
|
+
body = ["hello!"]
|
9
|
+
[
|
10
|
+
200,
|
11
|
+
{ 'Content-Type' => 'text/plain' },
|
12
|
+
body
|
13
|
+
]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Thin::Server.start('0.0.0.0', 3000) do
|
18
|
+
use Rack::CommonLogger
|
19
|
+
map '/test' do
|
20
|
+
run SimpleAdapter.new
|
21
|
+
end
|
22
|
+
map '/files' do
|
23
|
+
run Rack::File.new('.')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# You could also start the server like this:
|
28
|
+
#
|
29
|
+
# app = Rack::URLMap.new('/test' => SimpleAdapter.new,
|
30
|
+
# '/files' => Rack::File.new('.'))
|
31
|
+
# Thin::Server.start('0.0.0.0', 3000, app)
|
32
|
+
#
|