diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yahns/proxy_http_response.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb index c5e7be5..bd274fe 100644 --- a/lib/yahns/proxy_http_response.rb +++ b/lib/yahns/proxy_http_response.rb @@ -105,8 +105,12 @@ module Yahns::HttpResponse # :nodoc: # chunk the response ourselves if the client supports it, # but the backend does not terminate properly - if alive && ! term && (env['HTTP_VERSION'] == 'HTTP/1.1'.freeze) - res << "Transfer-Encoding: chunked\r\n".freeze + if alive && ! term + if env['HTTP_VERSION'] == 'HTTP/1.1'.freeze + res << "Transfer-Encoding: chunked\r\n".freeze + else # we can't persist HTTP/1.0 and HTTP/0.9 w/o Content-Length + alive = false + end end res << (alive ? "Connection: keep-alive\r\n\r\n".freeze : "Connection: close\r\n\r\n".freeze) |