From 2b6a9f3a1ffcdb00bf89798979d475c6d189d419 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 20 Jun 2019 12:59:29 -0700 Subject: Ignore Errno::EPIPE when sending requests in net/http An EPIPE when sending the request should be ignored. Even if you cannot write more data, you may still be able to read the server's response. Fixes [Bug #14466] --- lib/net/http.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/net/http.rb b/lib/net/http.rb index bc181c01af..663b901a96 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1504,7 +1504,13 @@ module Net #:nodoc: begin begin_transport req res = catch(:response) { - req.exec @socket, @curr_http_version, edit_path(req.path) + begin + req.exec @socket, @curr_http_version, edit_path(req.path) + rescue Errno::EPIPE + # Failure when writing full request, but we can probably + # still read the received response. + end + begin res = HTTPResponse.read_new(@socket) res.decode_content = req.decode_content -- cgit v1.2.3