From dab944e3194f996156278cbfb74caa8e70fb0f5c Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 27 Nov 2015 15:03:24 +0000 Subject: [PATCH] fixup! * lib/net/http.rb (connect): detect closed connection and reconnect If the server closes a keep-alive http connection, the client socket reaches EOF. To avoid an EOFError, detect the closed connection and reconnect. Added test to ensure HTTP#post succeeds even if the keep-alive-connection has been closed by the server. by Kristian Hanekamp https://github.com/ruby/ruby/pull/1089 fix GH-1089 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/http.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 65cacbd175..fa6185b0ba 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1478,7 +1478,7 @@ module Net #:nodoc: D 'Conn close because of keep_alive_timeout' @socket.close connect - elsif @socket.io.wait_readable(0) && @socket.eof? + elsif @socket.io.to_io.wait_readable(0) && @socket.eof? D "Conn close because of EOF" @socket.close connect