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
---
  A hopefully better version of what I proposed in:
  https://yhbt.net/yahns-public/[email protected]/

 lib/yahns/proxy_http_response.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index d0e3e41..c8a2a42 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -187,7 +187,6 @@ def proxy_response_start(res, tip, kcar, req_res)
 
   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)
@@ -233,6 +232,7 @@ def proxy_response_finish(kcar, wbuf, req_res)
 
     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
@@ -248,7 +248,7 @@ def proxy_response_finish(kcar, wbuf, req_res)
     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)
-- 
EW
--
unsubscribe: [email protected]
archive: http://yhbt.net/yahns-public/

Reply via email to