about summary refs log tree commit homepage
path: root/lib/yahns/proxy_pass.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-04-10 23:53:20 +0000
committerEric Wong <e@80x24.org>2015-04-11 00:09:34 +0000
commitb2e1325d95950f648f915ab07c31362f3524a638 (patch)
treebf033e7bea5caddbab6d3c93a90a69324086be6e /lib/yahns/proxy_pass.rb
parent18f0ab28eae3c5db32ee9e59a3fe104f981983d0 (diff)
downloadyahns-b2e1325d95950f648f915ab07c31362f3524a638.tar.gz
Upstreams may shut us down while we're writing a request body,
attempt to forward any responses from the upstream back to the
client which may explain the rejection reason for giant uploads.
Diffstat (limited to 'lib/yahns/proxy_pass.rb')
-rw-r--r--lib/yahns/proxy_pass.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb
index d02bb40..e86e9c9 100644
--- a/lib/yahns/proxy_pass.rb
+++ b/lib/yahns/proxy_pass.rb
@@ -139,6 +139,11 @@ class Yahns::ProxyPass # :nodoc:
         close_req_body(input)
         prepare_wait_readable
       end
+    rescue Errno::EPIPE, Errno::ECONNRESET, Errno::ENOTCONN
+      # no more reading off the client socket, just prepare to forward
+      # the rejection response from the upstream (if any)
+      @yahns_client.to_io.shutdown(Socket::SHUT_RD)
+      prepare_wait_readable
     end
 
     def prepare_wait_readable