about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-05 06:58:43 +0000
committerEric Wong <e@80x24.org>2016-07-05 13:40:59 +0000
commit405435825e90c5f79209946ecd8fc842519b42ba (patch)
treebd3552c0cffe3ee31299d7482c5e5daee6cb4811 /lib
parent0b00ee9677fdedbfb40a877c797a81b0beb7cbde (diff)
downloadyahns-405435825e90c5f79209946ecd8fc842519b42ba.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/wbuf_lite.rb8
1 files 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 @@ class Yahns::WbufLite < Yahns::Wbuf # :nodoc:
   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