diff --git a/lib/net/http.rb b/lib/net/http.rb index 800b8ef..50cbccb 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -2495,7 +2495,7 @@ def begin_transport(req) debug 'Conn close because of keep_alive_timeout' @socket.close connect - elsif @socket.io.to_io.wait_readable(0) && @socket.eof? + elsif @socket.io.to_io.wait_readable(0) && @socket.io.read_nonblock(1, exception: false).nil? debug "Conn close because of EOF" @socket.close connect