From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.5 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 264B8202FD for ; Thu, 21 Apr 2016 23:52:13 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH] proxy_http_response: fix non-terminated fast responses, too Date: Thu, 21 Apr 2016 23:52:13 +0000 Message-Id: <20160421235213.13975-1-e@80x24.org> List-Id: 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 3fc522d..f38cd34 100644 --- a/lib/yahns/proxy_http_response.rb +++ b/lib/yahns/proxy_http_response.rb @@ -168,6 +168,7 @@ def proxy_response_start(res, tip, kcar, req_res) 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 -- EW