about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-11-11 22:55:22 +0000
committerEric Wong <e@80x24.org>2016-11-12 01:36:19 +0000
commit662f9062a6e738fc10e6cd2ebebb1d9b8670aedb (patch)
treed3160c7c324221cf0e285550fe14781a18a55175
parent11b0ed968dc005c9c291b82d672e648b5243af08 (diff)
downloadyahns-662f9062a6e738fc10e6cd2ebebb1d9b8670aedb.tar.gz
If we already started writing a response, we cannot be sending a
502 to inform a user a connection has failed.  This should
prevent errors from the OpenSSL layer about mismatched buffers
due to the combination of slow clients and upstreams prematurely
aborting.
-rw-r--r--lib/yahns/req_res.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/yahns/req_res.rb b/lib/yahns/req_res.rb
index 041b908..4ad8e5c 100644
--- a/lib/yahns/req_res.rb
+++ b/lib/yahns/req_res.rb
@@ -76,7 +76,7 @@ class Yahns::ReqRes < Kgio::Socket # :nodoc:
     when Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE
       e.set_backtrace([])
     end
-    c.proxy_err_response(502, self, e)
+    c.proxy_err_response(Yahns::WbufCommon === @resbuf ? nil : 502, self, e)
   end
 
   def send_req_body_chunk(buf)