yahns Ruby server user/dev discussion
 help / color / 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	[flat|nested] only message in thread

only message in thread, back to index

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

yahns Ruby server user/dev discussion

Archives are clonable:
	git clone --mirror https://yhbt.net/yahns-public
	git clone --mirror http://ou63pmih66umazou.onion/yahns-public

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git