about summary refs log tree commit homepage
path: root/lib/rainbows/rev/client.rb
DateCommit message (Collapse)
2010-08-28rev_thread_*: fix IO proxy failures w/pipelining
Proxying IO objects with threaded Rev concurrency models occasionally failed with pipelined requests (t0034). By deferring the on_write_complete callback until the next "tick" (similar to what we do in Rev::Client#write), we prevent clobbering responses during pipelining.
2010-08-17rev/client: fix redundant close of client sockets
Our keep-alive timeout mechanism does not need to kick in and redundantly close when a client. Fortunately there is no danger of redundantly closing the same numeric file descriptors (and perhaps causing difficult-to-track-down errors).
2010-07-26rev*: properly handle pipelined responses w/sendfile
With sendfile enabled, we must avoid writing headers (or normal, non-file responses) while a file is deferred for sending. This means we must disable processing of new requests while a file is deferred for sending and use the on_write_complete callback less aggressively.
2010-07-23rename parse_range => make_range!
It's a destructive method, and it does more than just parsing.
2010-07-22rev*: avoid hung connections when proxying HTTP/0.9
We don't send headers with HTTP/0.9 connections, so the IO write watchers in Rev are never enabled if we're proxying IO objects as the response body.
2010-07-22enable Range: responses for static files for most models
The FileStreamer class of EventMachine (and by extension NeverBlock) unfortunately doesn't handle this. It's possible to do with Revactor (since it uses Rev under the covers), but we'll support what we can easily for now.
2010-07-19ensure file response bodies are properly closed
Middlewares like Clogger may wrap Rack::File responses with another body that responds to to_path and still rely on #close to trigger an action (writing out the log file).
2010-07-19rev: split out deferred chunk logic from unchunked
Similar to what we do in EM, this avoid unnecessary conditional logic inside more frequently used code paths.
2010-07-19rev + em: enable keepalive for pipe/socket responses
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.
2010-07-19rev + em: more easily allow Content-Length in pipe responses
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.
2010-07-19remove unnecessary header munging for static file serving
Rack::File already sets the Content-Length header for us, so there's no reason to ever set this ourselves.
2010-07-19refactor response handling for each concurrency model
This will give each concurrency model more control over particular code paths and serving static files.
2010-07-10doc: avoid documenting internals on RDoc website
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.
2010-07-08restore Rainbows::HttpResponse.write for Cramp
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).
2010-07-06fix string slicing under 1.9 after short writes
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...
2010-07-06rev/client: more aggressive non-blocking write
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.
2010-07-06cleanup error handling for aborted downloads
We shouldn't ever spew errors to the stderr/logger on client disconnects (ECONNRESET/EPIPE/etc...).
2010-07-06rev: avoid unnecessary seeking when using sendfile
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.
2010-07-05rev: properly enable post-fork sendfile() usage
We need to load sendfile-using parts after the "sendfile" library is loaded.
2010-07-04refactor response body handling for sendfile(2)
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.
2010-07-04rev/client: s/sendfile/rev_sendfile/
Avoid confusing people with an overloaded method name
2010-06-30rev: add sendfile support
This should improve performance for static file responses.
2010-06-21rev: documentation update for #write method
2010-06-21rev: restore Ruby 1.8.6 compatibility
2010-06-18rev: cleanup write method
I was originally experimenting with setsockopt to increase the kernel buffer sizes in a loop, but the benefits were negligible at best.
2010-06-18rev: avoid extraneous data copy for small responses
For small responses that can fit inside a kernel socket buffer, copying that data into an IO::Buffer object is a waste of precious memory bandwidth.
2010-06-18prefer Array#[] lookup to Array#first/Array#last
Array#[] lookups are slightly faster under both rbx and 1.9, and easier to read.
2009-11-24Rev*: safer client accounting
Due to the addition of keepalive_timeouts, it's safer to pay a performance penalty and use a hash here instead.
2009-11-24rev/event_machine: avoid needless rewinds
No point in rewinding the NULL_IO especially when most requests use them instead of bodies that actually have something.
2009-11-18rev: implement keepalive timeout
This is a bit trickier than the rest since we have to ensure deferred (proxied) responses aren't nuked.
2009-11-08initial cut of the RevThreadSpawn model
Seems to pass all tests, but that may only mean our test cases are lacking...
2009-11-07ev_core: cleanup handling of APP constant
It'll make development of future ev_core-derived things easier, hopefully.
2009-11-07rev: DeferredResponse is independent of parser state
In the upcoming RevThread* models, the parser may be parsing other requests already by the time DeferredResponse is called.
2009-11-07rev: split out further into separate files for reuse
This will make things easier to manage with more Rev-based concurrency models.