summary refs log tree commit homepage
path: root/lib/rainbows/dev_fd_response.rb
AgeCommit message (Collapse)AuthorFilesLines
2011-02-06minimize &block usage for yieldEric Wong1-2/+2
No need to allocate a proc every time when we can just yield much more efficiently.
2011-01-20dev_fd_response: garbage reductionEric Wong1-7/+14
Constant strings mean the runtime won't have to allocate new objects all the time since GC is currently the biggest performance problem of Ruby 1.9.x in my experience.
2011-01-19dev_fd_response: do not send chunks to 1.0 clientsEric Wong1-1/+1
chunked Transfer-Encoding is only valid for HTTP/1.1
2011-01-19remove support for X-Rainbows-* headersEric Wong1-1/+1
We guarantee the Rack env will exist for the duration of the request/response cycle, so we can just tweak "rainbows.autochunk".
2011-01-07more consistent use/avoidance of HeaderHashEric Wong1-1/+1
Rack::Utils::HeaderHash is still expensive, so avoid forcing it on users since we can assume app/library authors use normally-cased HTTP headers.
2011-01-07favor Hash#include? for some existence checksEric Wong1-1/+1
Hash#[] is slightly slower on the miss case due to calling Hash#default (but faster for the hit case, probably because it is inlined in 1.9).
2010-12-28dev_fd_response: pass files straight throughEric Wong1-1/+5
No need to wrap regular files
2010-12-27initial cool.io supportEric Wong1-1/+1
Cool.io is the new name for Rev. We'll continue to support Rev until Cool.io breaks backwards compatibility. Rev may not be supported if Cool.io is.
2010-11-19upgrade to Kgio 2.x and Unicorn 3.xEric Wong1-1/+1
Kgio 2.0.0 has a superior API and less likely to conflict or blow up with other applications. Unicorn 3.x requires Kgio 2.x, too.
2010-10-22dev_fd_response: do not wrap for Fiber-aware IOsEric Wong1-1/+2
Applications may use wait_readable-aware methods directly to work with Rainbows!
2010-08-17avoid EBADF with certain middlewares when proxyingEric Wong1-1/+3
First off we use an FD_MAP to avoid creating redundant IO objects which map to the same FD. When that doesn't work, we'll fall back to trapping Errno::EBADF and IOError where appropriate.
2010-08-13dev_fd_response: weaken /dev/fd check for compatibilityEric Wong1-1/+1
/dev/fd/0 may not be stat()-able on some systems after dropping permissions from root to a regular user. So just check for "/dev/fd" which seems to work on RHEL 2.6.18 kernels. This also allow us to be used independently of Unicorn in case somebody ever feels the compelling need to /close/ stdin.
2010-07-29revactor: Actor-aware dev_fd_response proxyingEric Wong1-0/+2
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-19ensure stream response bodies get closedEric Wong1-4/+6
Some middlewares such as Clogger rely on wrapping the body having the close method called on it for logging.
2010-07-19rev + em: more easily allow Content-Length in pipe responsesEric Wong1-5/+6
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-19dev_fd_response: remove needless begin blockEric Wong1-4/+2
2010-07-19no need to pass 'rb' as File.open flagsEric Wong1-1/+1
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-06-30dev_fd_response: avoid redeclaring Rainbows moduleEric Wong1-70/+67
slowly cleaning up the generated RDoc
2010-06-21dev_fd_response: disable under Rubinius for nowEric Wong1-0/+11
We can't use it effectively in Rubinius yet, and it's broken due to the issue described in: http://github.com/evanphx/rubinius/issues/379
2010-06-21dev_fd_response: cleanup and reorganizationEric Wong1-21/+21
There's no need to #dup the middleware object, just use a custom Rainbows::DevFdResponse::Body object.
2010-06-18avoid needless HeaderHash#to_hash callsEric Wong1-2/+2
HeaderHash objects can only be used as headers without violating Rack::Lint in Rack 1.1.0 or later.
2009-12-22new RevFiberSpawn concurrency modelEric Wong1-1/+1
This is like the traditional FiberSpawn, but more scalable (but not necessarily faster) as it can use epoll or kqueue.
2009-11-25add FiberPool concurrency modelEric Wong1-1/+3
This is another Fiber-based concurrency model that can exploit a streaming "rack.input" for clients. Spawning Fibers seems pretty fast, but maybe there are apps that will benefit from this.
2009-11-25add FiberSpawn concurrency modelEric Wong1-0/+4
This one seems a easy to get working and supports everything we need to support from the server perspective. Apps will need modified drivers, but it doesn't seem too hard to add more/better support for wrapping IO objects with Fiber::IO.
2009-10-18rev: async response bodies with DevFdResponse middlewareEric Wong1-0/+69
This new middleware should be a no-op for non-Rev concurrency models (or by explicitly setting env['rainbows.autochunk'] to false). Setting env['rainbows.autochunk'] to true (the default when Rev is used) allows (e)poll-able IO objects (sockets, pipes) to be sent asynchronously after app.call(env) returns. This also has a fortunate side effect of introducing a code path which allows large, static files to be sent without slurping them into a Rev IO::Buffer, too. This new change works even without the DevFdResponse middleware, so you won't have to reconfigure your app. This lets us epoll on response bodies that come in from a pipe or even a socket and send them either straight through or with chunked encoding.