From d16326723dcbc0a58e5a91078eac6a6058441702 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 21 Apr 2016 23:52:13 +0000 Subject: proxy_http_response: fix non-terminated fast responses, too Without this, non-terminated backends were not properly supported if they gave tiny responses or responded faster than we could stream the response to the client. This is necessary to support fast responses from some non-Rack HTTP/1.0-only backend servers which rely on connection termination to terminate responses. Tested manually with a Perl PSGI application running under "plackup". Unlike Rack, the PSGI spec does not specify whether the PSGI application or PSGI server should handle response termination: git clone https://github.com/plack/psgi-specs.git Follow-up-to: 8c9f33a5396d2 ("workaround non-terminated backends") --- lib/yahns/proxy_http_response.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb index a23c21d..c8a2a42 100644 --- a/lib/yahns/proxy_http_response.rb +++ b/lib/yahns/proxy_http_response.rb @@ -168,6 +168,7 @@ module Yahns::HttpResponse # :nodoc: tmp = chunk_out(tmp) if alive wbuf = proxy_write(wbuf, tmp, alive) when nil + wbuf = proxy_write(wbuf, "0\r\n\r\n".freeze, true) if alive req_res.shutdown break when :wait_readable -- cgit v1.2.3-24-ge0c7