Another critical bugfix for this yet-to-be-released feature.
By the time we call proxy_unbuffer in proxy_read_body,
the req_res socket may be completely drained of readable data
and a persistent-connection-capable backend will be waiting
for the next request (not knowing we do not yet support
persistent connections).

This affects both chunked and identity responses from the
upstream.
---
 lib/yahns/wbuf_lite.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/yahns/wbuf_lite.rb b/lib/yahns/wbuf_lite.rb
index fa52f54..25daf21 100644
--- a/lib/yahns/wbuf_lite.rb
+++ b/lib/yahns/wbuf_lite.rb
@@ -33,10 +33,14 @@ def wbuf_flush(client)
   def wbuf_close(client)
     wbuf_abort
 
-    # resume reading when @blocked is empty
+    # resume the event loop when @blocked is empty
+    # The actual Yahns::ReqRes#yahns_step is actually read/write-event
+    # agnostic, and we should actually watch for writability here since
+    # the req_res socket itself could be completely drained of readable
+    # data and just waiting for another request (which we don't support, yet)
     if @req_res
       client.hijack_cleanup
-      Thread.current[:yahns_queue].queue_mod(@req_res, Yahns::Queue::QEV_RD)
+      Thread.current[:yahns_queue].queue_mod(@req_res, Yahns::Queue::QEV_WR)
       return :ignore
     end
     @wbuf_persist
-- 
EW

--
unsubscribe: yahns-public+unsubscr...@yhbt.net
archive: https://yhbt.net/yahns-public/

Reply via email to