about summary refs log tree commit homepage
DateCommit message (Collapse)
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-23t9000: disable app_pool test for WriterThread*
Those are entirely single-threaded during the application dispatch phase.
2010-07-22t0501: workarounds for non-GNU awks
While gawk can handle binary data, other awks cannot, so use tr(1) to filter out non-printable characters from the WebSocket message. We need to send a bigger message, too, since tr(1) output is buffered and there's no portable way to unbuffer it :<
2010-07-22t0105: I/O reductions and speedups
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-22writer_thread_pool: fix include ordering issues under 1.8
This was always an issue, but not noticed until 0cd65fa1e01be369b270c72053cf21a3d6bcb45f ...
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-20event_machine: avoid redundant open() for static files
This is cheaper for serving static files and only slightly more expensive for pipes and sockets (extra path lookup for File.stat).
2010-07-20rely on autoload for Base and TeeInput
Its conceivable that we can avoid loading TeeInput for EventMachine and Rev concurrency models in the future since it's unused there.
2010-07-19ensure client aborted file/stream response bodies are closed
We need to remember to close response bodies even if a client aborts the connection, since body.close can trigger interesting things like logging and such...
2010-07-19event_machine: close body descriptor before streaming file
EM::FileStreamer must be passed a path, so should release our newly opened descriptor first :<
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-19ensure stream response bodies get closed
Some middlewares such as Clogger rely on wrapping the body having the close method called on it for logging.
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/deferred_response: cleanups
Remove unnecessary include and also remove unnecessary nesting.
2010-07-19rev: autoload DeferredResponse
Some apps never serve static files nor proxy pipes/sockets, so they'll never need to deal with deferred responses.
2010-07-19prefer Integer#to_s(16) to sprintf("%x\r\n")
It's slightly faster as theres no string to parse and also no garbage format string to be discarded.
2010-07-19event_machine: don't set @body unless it's EM::Deferrable
We also properly fail on EM::FileStreamer responses, too
2010-07-19event_machine: small simplification for async responses
Extraneous returns are harder to follow.
2010-07-19event_machine: split out uncommonly used modules
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.
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-19event_machine: ResponseChunkPipe style cleanup
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.
2010-07-19event_machine: garbage avoidance for pipe responses
Since the EM loop runs entirely in one thread, we can get away with using a single buffer across all pipe/socket responses.
2010-07-19event_machine: avoid race in unchunked fast pipe 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.
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-19dev_fd_response: remove needless begin block
2010-07-19no need to pass 'rb' as File.open flags
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.
2010-07-19sendfile middleware: various style cleanups
Favor constants over literal strings for a small garbage reduction.
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-11Rainbows! v0.95.1 - depend on newer Unicorn v0.95.1
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
2010-07-11bump Unicorn dependency to 1.1.1
This avoids costant resolution problems on client EOF during input processing.
2010-07-10doc: make RDoc skip private methods
2010-07-10test_isolate: document why we test with Rack 1.1.0
2010-07-10Rainbows! 0.95.0 - sendfile() support! v0.95.0
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
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-10doc: Static_Files documentation
Some folks may be interested in setting up Rainbows! as a static file server.
2010-07-09event_machine: rename response_write => em_write_response
For consistency with rev_write_response (and the existing "write_response").
2010-07-09http_response: allow Cramp 0.11 to send proper WS headers
Cramp needs to override our normal header sending for (old) WebSockets connections.
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-08dev: bump isolate dependency to 2.1.0
2010-07-08TODO: documentation needs work, so document it :P
2010-07-08bump TCP_DEFER_ACCEPT default value
Unicorn 1.1.0 lets us change this default, and we need it higher to avoid wasting workers against stupidly (or maliciously) slow clients.
2010-07-08bump unicorn dependencies
2010-07-08stream_file: split this out from rev/sendfile
Other concurrency models will eventually be able to use it, too.
2010-07-06byte_slice: String#[range] is faster than String#slice!(range)
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.
2010-07-06doc: update TODO
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.