diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-19 10:09:56 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-19 17:04:26 -0700 |
commit | 1e6d3d19da2b62bfe7f8fd7827dcad3ee3fe9923 (patch) | |
tree | 5de875617e5cf3befb7c0ae9e1add9b2ee2f451e /lib/rainbows/rev/client.rb | |
parent | cc18035c5105751a3e67a8e449ee0021fd313ea9 (diff) | |
download | rainbows-1e6d3d19da2b62bfe7f8fd7827dcad3ee3fe9923.tar.gz |
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.
Diffstat (limited to 'lib/rainbows/rev/client.rb')
-rw-r--r-- | lib/rainbows/rev/client.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb index bc3785f..f067d1b 100644 --- a/lib/rainbows/rev/client.rb +++ b/lib/rainbows/rev/client.rb @@ -7,7 +7,6 @@ module Rainbows class Client < ::Rev::IO include Rainbows::ByteSlice include Rainbows::EvCore - include Rainbows::Response G = Rainbows::G def initialize(io) @@ -59,14 +58,7 @@ module Rainbows # used for streaming sockets and pipes def stream_response(status, headers, io, body) - if headers - do_chunk = !!(headers['Transfer-Encoding'] =~ %r{\Achunked\z}i) - do_chunk = false if headers.delete('X-Rainbows-Autochunk') == 'no' - headers[CONNECTION] = CLOSE # TODO: allow keep-alive - write(response_header(status, headers)) - else - do_chunk = false - end + do_chunk = stream_response_headers(status, headers) if headers # we only want to attach to the Rev::Loop belonging to the # main thread in Ruby 1.9 io = DeferredResponse.new(io, self, do_chunk, body) |