diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-30 08:33:15 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-04 16:37:42 -0800 |
commit | e21939d776673b2f8887adf7a5c64812b7d2e98e (patch) | |
tree | 48aa3a71201e770758bd09b325c3f2704411af7f /lib/rainbows/ev_core.rb | |
parent | 4a76da1833922c74e147be5def9bfe04fd0c16a2 (diff) | |
download | rainbows-e21939d776673b2f8887adf7a5c64812b7d2e98e.tar.gz |
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.
Diffstat (limited to 'lib/rainbows/ev_core.rb')
-rw-r--r-- | lib/rainbows/ev_core.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index 60fbdca..471f6a3 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -36,14 +36,15 @@ module Rainbows::EvCore end # returns whether to enable response chunking for autochunk models - def stream_response_headers(status, headers) + def stream_response_headers(status, headers, alive) + headers = Rack::Utils::HeaderHash.new(headers) if headers['Content-Length'] rv = false else rv = !!(headers['Transfer-Encoding'] =~ %r{\Achunked\z}i) rv = false if headers.delete('X-Rainbows-Autochunk') == 'no' end - write(response_header(status, headers)) + write_headers(status, headers, alive) rv end |