Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 26550) +++ lib/net/http.rb (working copy) @@ -1057,7 +1057,7 @@ res rescue => exception D "Conn close because of error #{exception}" - @socket.close unless @socket.closed? + @socket.close if @socket and not @socket.closed? raise exception end