Skip to content

Commit

Permalink
Rescue EOFError when reading on socket.
Browse files Browse the repository at this point in the history
  • Loading branch information
blambeau committed Jan 24, 2014
1 parent 33d34c2 commit b967bf9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/http/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ def readpartial(size = BUFFER_SIZE) # rubocop:disable CyclomaticComplexity

chunk = @parser.chunk
unless chunk
@parser << @socket.readpartial(BUFFER_SIZE)
chunk = @parser.chunk
begin
@parser << @socket.readpartial(BUFFER_SIZE)
chunk = @parser.chunk
rescue EOFError
chunk = nil
end

# TODO: consult @body_remaining here and raise if appropriate
return unless chunk
Expand Down

0 comments on commit b967bf9

Please sign in to comment.