summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-06-20 12:59:29 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-27 07:43:32 -0700
commit2b6a9f3a1ffcdb00bf89798979d475c6d189d419 (patch)
tree8a3c5cbd1e898e38135e6a8c96a044d309af2b20 /lib/net/http.rb
parent80d0b6f132e6475c0b9c78ff857e7bb81c93df0d (diff)
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]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2494
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb8
1 files changed, 7 insertions, 1 deletions
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