diff options
author | Eric Wong <e@80x24.org> | 2016-04-22 00:13:12 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-23 04:41:31 +0000 |
commit | 8d7af351b76389eac236dcc2fb024272f92166aa (patch) | |
tree | 9635589dd7cec905647313486ad9d2e55170738f | |
parent | e02ba5134edb578b1b429b44860640912400eefd (diff) | |
download | yahns-8d7af351b76389eac236dcc2fb024272f92166aa.tar.gz |
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
-rw-r--r-- | lib/yahns/proxy_http_response.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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) |