Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direction of this fix is correct. But this fix has a problem.
If this read_nonblock doesn't return a byte, it works as expected. But if it returns a byte, it needs to go forward but the byte is dropped in this patch. The byte needs to be buffered and re-used in actual process

debug "Conn close because of EOF"
@socket.close
connect
Expand Down