about summary refs log tree commit homepage
DateCommit message (Collapse)
2010-08-03Rainbows! 0.96.0 - range support v0.96.0
For concurrency models that use sendfile or IO.copy_stream, HTTP Range requests are honored when serving static files. Due to the lack of known use cases, multipart range responses are not supported. When serving static files with sendfile and proxying pipe/socket bodies, responses bodies are always properly closed and we have more test cases for dealing with prematurely disconnecting clients. Concurrency model specific changes: EventMachine, NeverBlock - * keepalive is now supported when proxying pipes/sockets * pipelining works properly when using EM::FileStreamer * these remain the only concurrency models _without_ Range support (EM::FileStreamer doesn't support ranges) Rev, RevThreadSpawn, RevThreadPool - * keepalive is now supported when proxying pipes/sockets * pipelining works properly when using sendfile RevThreadPool - * no longer supported under 1.8, it pegs the CPU at 100%. Use RevThreadSpawn (or any other concurrency model) if you're on 1.8, or better yet, switch to 1.9. Revactor - * proxying pipes/sockets with DevFdResponse is much faster thanks to a new Actor-aware IO wrapper (used transparently with DevFdResponse) * sendfile support added, along with Range responses FiberSpawn, FiberPool, RevFiberSpawn - * Range responses supported when using sendfile ThreadPool, ThreadSpawn, WriterThreadPool, WriterThreadSpawn - * Range responses supported when using sendfile or IO.copy_stream. See the full git logs for a list of all changes.
2010-08-03t0500: avoid race condition with timestamps
Not sure what possessed me to clobber the original variable set in the parent, but the initial time for the subshell could be set too late in relation to the actual server time. So we need to stash the original time before any HTTP requests were made.
2010-08-03maint: publish Rubyforge news on release
I keep forgetting, so I'll force it on myself.
2010-08-03doc: hide internal Response416 error constant
It's an internal implementation detail and not for user consumption.
2010-08-03doc: update Static_Files documentation page
Things have change slightly since 0.95.1, which is ancient.
2010-08-02doc: update TODO
We've knocked out a few of these, so we're closer to being "done" :)
2010-08-02event_machine: protect IO#close from EBADF
EventMachine may close the underlying file descriptor on us if there are unrecoverable errors during write. So IO#closed? is a pointless check because EM does not invalidate the underlying file descriptor.
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-08-01t0015: cleanup after working directory test
Our test suite doesn't include facilities for dealing with temporary directories, yet.
2010-08-01tests: do not clobber existing RUBYLIB
We may want to try some external libraries for some tests via RUBYLIB/RUBYOPT while doing development.
2010-07-29fiber/io: reuse buffer in Rainbows::Fiber::IO#each
This makes life easier for the lazy GC when proxying large responses (and also improves memory locality).
2010-07-29revactor: Actor-aware dev_fd_response proxying
Proxying regular Ruby IO objects while Revactor is in use is highly suboptimal, so proxy it with an Actor-aware wrapper for better scheduling.
2010-07-28event_machine: better handling of staggered pipelines
Since TCP sockets stream, HTTP requests do not come in at well-defined boundaries and it's possible for pipelined requests to come in in a staggered form. We need to ensure our receive_data callback doesn't fire any actions at all while responding with a deferrable @body. We still need to be careful about buffering, since EM does not appear to allow temporarily disabling read events (without pausing writes), so we shutdown the read end of the socket if it reaches a maximum header size limit.
2010-07-27event_machine: prevent double close of client socket
Not sure where this is happening, but this can trigger Errno::EBADF under heavy load.
2010-07-27rev/client: workaround close ordering issue when proxying
When proxying pipes/sockets, it's possible for the Rev::IO#write to fail and close our connection. In that case we do not want our client to continue with the on_write_complete callback.
2010-07-27rev_thread_pool: stop supporting this under Ruby 1.8
It hits 100% CPU usage and Rev's 1.8 support when mixed with threads is currently suboptimal. Unfortunately our tests can not check for 100% CPU usage, so I had to *gasp* confirm it by actually starting an app :x This appears to be a fixable bug in Rev, however, and we'll try to fix it as soon as we have time.
2010-07-27t0020: speed up rate limited tests
They were taking long enough to be annoying :<
2010-07-27t00{2,3}1: beef tests up with more aborted requests
HTTP/1.1 and HTTP/1.0 code paths may vary significantly from the (highly uncommon) HTTP/0.9 ones in our concurrency models, so add extra tests for those.
2010-07-27event_machine: fix pipelining of static files
EM::FileStreamer writes may be intermingled with the headers in the subsequent response if we enable processing of the second pipelined response right away, so wait until the first response is complete before hitting the second one. This also avoids potential deep stack recursion in the unlikely case where too many requests are pipelined.
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.