diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-02-08 22:45:20 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-02-11 01:57:05 +0000 |
commit | e166cfe5e8d648b544b1291ec157bd234a425e21 (patch) | |
tree | 8ac56aadc51d81d4d250cfec696446f19ffd1d64 /lib/rainbows/ev_core.rb | |
parent | e6faf9e26bcb172026a4984ecadbaa8b6789bcb7 (diff) | |
download | rainbows-e166cfe5e8d648b544b1291ec157bd234a425e21.tar.gz |
This requires Rack 1.5.x and unicorn 4.6.0 for hijacking support. Older versions of Rack continue to work fine, but we must use unicorn 4.6.0 features to support this.
Diffstat (limited to 'lib/rainbows/ev_core.rb')
-rw-r--r-- | lib/rainbows/ev_core.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index 46feaff..5c3c5b8 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -52,16 +52,17 @@ module Rainbows::EvCore end # returns whether to enable response chunking for autochunk models - def stream_response_headers(status, headers, alive) + # returns nil if request was hijacked in response stage + def stream_response_headers(status, headers, alive, body) headers = Rack::Utils::HeaderHash.new(headers) unless Hash === headers if headers.include?(Content_Length) - write_headers(status, headers, alive) + write_headers(status, headers, alive, body) or return return false end case @env[HTTP_VERSION] when "HTTP/1.0" # disable HTTP/1.0 keepalive to stream - write_headers(status, headers, false) + write_headers(status, headers, false, body) or return @hp.clear false when nil # "HTTP/0.9" @@ -69,7 +70,7 @@ module Rainbows::EvCore else rv = !!(headers[Transfer_Encoding] =~ %r{\Achunked\z}i) rv = false unless @env["rainbows.autochunk"] - write_headers(status, headers, alive) + write_headers(status, headers, alive, body) or return rv end end |