From 8d7af351b76389eac236dcc2fb024272f92166aa Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 22 Apr 2016 00:13:12 +0000 Subject: proxy_pass: honor wbuf_persist when ending response If a static file response gets truncated while writing, we set wbuf_persist to false in wbuf_flush of lib/yahns/wbuf_common.rb Thus, we must check wbuf_persist attribute as late as possible before yielding control back to the caller in proxy_response_finish --- lib/yahns/proxy_http_response.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb index 0e72d3a..a23c21d 100644 --- a/lib/yahns/proxy_http_response.rb +++ b/lib/yahns/proxy_http_response.rb @@ -186,7 +186,6 @@ module Yahns::HttpResponse # :nodoc: def proxy_response_finish(kcar, wbuf, req_res) rbuf = Thread.current[:yahns_rbuf] - alive = wbuf.wbuf_persist if len = kcar.body_bytes_left # known Content-Length case tmp = req_res.kgio_tryread(0x2000, rbuf) @@ -232,6 +231,7 @@ module Yahns::HttpResponse # :nodoc: else # no Content-Length or Transfer-Encoding: chunked, wait on EOF! + alive = wbuf.wbuf_persist case tmp = req_res.kgio_tryread(0x2000, rbuf) when String tmp = chunk_out(tmp) if alive @@ -247,7 +247,7 @@ module Yahns::HttpResponse # :nodoc: end busy = wbuf.busy and return proxy_busy_mod_blocked(wbuf, busy) - proxy_busy_mod_done(alive) # returns nil + proxy_busy_mod_done(wbuf.wbuf_persist) # returns nil end def proxy_wait_next(qflags) -- cgit v1.2.3-24-ge0c7