diff --git a/lib/http/client.rb b/lib/http/client.rb index 75078d2f..f7c10be5 100644 --- a/lib/http/client.rb +++ b/lib/http/client.rb @@ -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