Date | Commit message (Collapse) |
|
Some apps never serve static files nor proxy pipes/sockets,
so they'll never need to deal with deferred responses.
|
|
It's slightly faster as theres no string to parse and also
no garbage format string to be discarded.
|
|
We also properly fail on EM::FileStreamer responses, too
|
|
Extraneous returns are harder to follow.
|
|
Some applications may not use Response*Pipe and TryDefer at all,
so there's no reason to pollute the runtime with extra nodes to
mark during GC.
|
|
This makes it easier to write proxies for slow clients that
benefit from keep-alive. We also need to be careful about
non-HTTP/1.1 connections that can't do keepalive, now.
|
|
If a response proxying a pipe (or socket) includes a
Content-Length, do not attempt to outsmart the application
and just use the given Content-Length.
This helps avoid exposing applications to weird internals such
as env["rainbows.autochunk"] and X-Rainbows-* response headers.
|
|
No need to double up on begin blocks since we know @client.write
won't raise exceptions @io.read_nonblock does. Also prefer
@client.write to @client.send_data since it looks more in
line with other IO interfaces.
|
|
Since the EM loop runs entirely in one thread, we can get away
with using a single buffer across all pipe/socket responses.
|
|
Using EM.enable_proxy with EM.attach seems to cause
EM::Connection#receive_data callbacks to be fired before the
proxy has a chance to act, leading the first few chunks of data
being lost in the default receive_data handler. Instead
just rely on EM.watch like the chunked pipe.
|
|
Rack::File already sets the Content-Length header for us,
so there's no reason to ever set this ourselves.
|
|
|
|
IO#read always returns a binary string buffer if passed an
explicit length to read, and we always do that. This is
a small garbage reduction.
|
|
Favor constants over literal strings for a small garbage
reduction.
|
|
This will give each concurrency model more control over
particular code paths and serving static files.
|
|
Eric Wong (3):
test_isolate: document why we test with Rack 1.1.0
doc: make RDoc skip private methods
bump Unicorn dependency to 1.1.1
|
|
This avoids costant resolution problems on client EOF
during input processing.
|
|
|
|
|
|
In addition to the 1.9-only IO.copy_stream, the new sendfile
1.0.0 gem may optionally be used with most concurrency models
(even under 1.8).
See http://rainbows.rubyforge.org/Static_Files.html for more info
Other changes:
* 1.9 encoding bugfix for (Rev)FiberSpawn and FiberPool
* fixed potential rack.input corruption with Revactor
* ThreadPool graceful shutdown no longer blocks until timeout
* optional ServerToken middleware for to display Server: header
* Dependencies bumped to Rack 1.1+ and Unicorn 1.1.0+
* numerous internal cleanups, small bugfixes and speedups
* more concise website oriented at users
|
|
Since we suck at building websites, we just rely on RDoc as a
website builder. And since Rainbows! is an application server
(and not a programming library), our internal API should be of
little interest to end users.
Anybody interested in Rainbows! (or any other project) internals
should be reading the source.
|
|
Some folks may be interested in setting up Rainbows!
as a static file server.
|
|
For consistency with rev_write_response (and the existing
"write_response").
|
|
Cramp needs to override our normal header sending for
(old) WebSockets connections.
|
|
Cramp monkey patches Rainbows internals for WebSockets
support and we forgot about it. Add a new integration
test to ensure this continues to work in the future
(and force us to update the test for newer Cramp).
|
|
|
|
|
|
Unicorn 1.1.0 lets us change this default, and we need it higher
to avoid wasting workers against stupidly (or maliciously) slow
clients.
|
|
|
|
Other concurrency models will eventually be able to use it, too.
|
|
rb_str_slice_bang() allocates a new string internally and calls
rb_str_aref_m() AND rb_str_aset_m(), too. String#[] just
calls rb_str_aref_m() directly, so it's a much quicker code
path. Also, "[]" methods dispatch faster under 1.9, too.
|
|
|
|
Fortunately this only affects the hardly-used FiberSpawn and
FiberPool concurrency models, and also unreleased revisions of
Rev. 1.9 encoding is tricky to handle right when doing I/O in
Ruby...
|
|
non-blocking write() may cause kernel buffers to be allocated
behind the scenes, so retry the write() even if it's short
because it may succeed the next time around.
|
|
We shouldn't ever spew errors to the stderr/logger
on client disconnects (ECONNRESET/EPIPE/etc...).
|
|
There's no need to ever change the underlying offset of a file
descriptor when using sendfile(), so don't. This allows us to
avoid contention in the kernel/filesystem and eventually reuse
the same filesystem file descriptor for serving multiple
requests.
|
|
We need to load sendfile-using parts after the
"sendfile" library is loaded.
|
|
This hopefully allows the "sendfile" gem to be required
anywhere in the Rainbows!/Unicorn config file, and not
have to be required via RUBYOPT or the '-r' command-line
switch.
We also modularize HttpResponse and avoids singleton methods
in the response path. This (hopefully) makes it easier for
individual concurrency models to share code and override
individual methods.
|
|
Avoid confusing people with an overloaded method name
|
|
While we're at it, fix a comment, too.
|
|
We may use a blocking accept() loop if there is
only a single listener. In that case threads may
not be able to exit if a SIGQUIT is received, so
force them to run when joining.
|
|
This should improve performance for static file responses.
|
|
slowly cleaning up the generated RDoc
|
|
|
|
|
|
This still needs work and lots of cleanup, but the basics are
there. The sendfile 1.0.0 RubyGem is now safe to use under MRI
1.8, and is superior to current (1.9.2-preview3) versions of
IO.copy_stream for static files in that it supports more
platforms and doesn't truncate large files on 32-bit platforms.
|
|
This fleshes out Rainbows::Fiber::IO with a few
more methods for people using it.
|
|
|
|
|
|
|