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 authored and Tony Arcieri committed Mar 4, 2014
1 parent 50cf6e0 commit 78036f3
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 @@ -68,8 +68,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 78036f3

Please sign in to comment.