ruby-changes:40687
From: naruse <ko1@a...>
Date: Sat, 28 Nov 2015 00:03:47 +0900 (JST)
Subject: [ruby-changes:40687] naruse:r52766 (trunk): 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 <kris.hanekamp@g...> https://github.com/ruby/ruby/pull/1089 fix GH-1089
naruse 2015-11-28 00:03:24 +0900 (Sat, 28 Nov 2015) New Revision: 52766 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52766 Log: 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 <kris.hanekamp@g...> https://github.com/ruby/ruby/pull/1089 fix GH-1089 Modified files: trunk/lib/net/http.rb Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 52765) +++ lib/net/http.rb (revision 52766) @@ -1478,7 +1478,7 @@ module Net #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L1478 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/