yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] proxy_http_response: fix non-terminated fast responses, too
@ 2016-04-21 23:52 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-04-21 23:52 UTC (permalink / raw)
  To: yahns-public

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
         when :wait_readable

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-21 23:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 23:52 [PATCH] proxy_http_response: fix non-terminated fast responses, too Eric Wong

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).