about summary refs log tree commit homepage
path: root/lib/rainbows/response.rb
DateCommit message (Collapse)
2011-05-16add "copy_stream" config directive
This allows using IO::Splice.copy_stream from the "io_splice" RubyGem on recent Linux systems. This also allows users to disable copy_stream usage entirely and use traditional response_body.each calls which are compatible with all Rack servers (to workaround bugs in IO.copy_stream under 1.9.2-p180).
2011-05-10configurator: move validation logic over
There's actually no reason we can't have these methods in Rainbows::Configurator where it's easier to document nowadays.
2011-03-10switch from IO#sendfile_nonblock to IO#trysendfile
IO#trysendfile does not raise exceptions for common EAGAIN errors, making it far less expensive to use with the following concurrency models: * Coolio * CoolioFiberSpawn * Revactor * FiberSpawn * FiberPool This requires the new sendfile 1.1.0 RubyGem and removes support for the sendfile 1.0.0. All sendfile users must upgrade or be left without sendfile(2) support. IO#sendfile behaves the same if you're using a multi-threaded concurrency option, but we don't detect nor use it unless IO#trysendfile exists.
2011-01-19remove support for X-Rainbows-* headers
We guarantee the Rack env will exist for the duration of the request/response cycle, so we can just tweak "rainbows.autochunk".
2011-01-07response: do not skip Status header set by app
Rack::Lint already stops apps from using it. If a developer insists on it, then users who inspect their HTTP headers can point and laugh at them for not using Rack::Lint!
2011-01-07response: fix skipping of Status: header from app
We already set a Status: header by default for compatibility with some existing, broken libraries out there.
2011-01-07ev_core: garbage reduction with const strings
Reading headers is common and we don't want to create new String objects (even if they're tiny or copy-on-write) for the GC to munch on.
2011-01-06simplify keepalive_timeout accounting
Easier just to use an instance variable
2011-01-05response: use optimized httpdate implementation
Believe it or not, Time#httpdate showed up at the top of my profiler output for the past couple of years now. I guess that's what happens when all HTTP applications I write are less complex than Rack::Lobster :P
2011-01-05response: allow normal Hash for crafting Range headers
HeaderHash is quite expensive, and Rack::File currently uses a regular Ruby Hash with properly-cased headers the same way they're presented in rfc2616.
2011-01-05send proper 416 responses
416 responses without a body should respond with a zero Content-Length and a Content-Range that allows clients to specify a proper range in the future. rfc2616, section 14.16 says: > A server sending a response with status code 416 (Requested > range not satisfiable) SHOULD include a Content-Range field > with a byte-range- resp-spec of "*". The instance-length > specifies the current length of the selected resource.
2011-01-04globally refactor Range handling for responses
Rack::Utils::HeaderHash is still very expensive in Rack 1.2, especially for simple things that we want to run as fast as possible with minimal interference. HeaderHash is unnecessary for most requests that do not send Content-Range in responses.
2011-01-04simplify per-client keepalive state checks
This lets us simplify repetitive checks worry less about properly maintaining/closing client connections for each concurrency model we support.
2010-12-27writer_thread_*: split out classes into separate files
Use a consistent "Client" naming to reduce confusion
2010-08-28"keepalive_timeout 0" (really) disables keepalive
Although this behavior is mentioned on the documentation, this was broken under EventMachine, Rev*, and Revactor. Furthermore, we set the "Connection: close" header to allow the client to optimize is handling of non-keepalive connections.
2010-08-02revactor: implement sendfile and range support
Due to the synchronous nature of Revactor, we can be certain sendfile won't overstep the userspace output buffering done by Rev.
2010-07-23rename parse_range => make_range!
It's a destructive method, and it does more than just parsing.
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-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).