Skip to content

Commit 32717a9

Browse files
committed
Ignore connection errors in read_line?.
1 parent 25b9e48 commit 32717a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/protocol/http1/connection.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ def read(length)
350350
# Read a line from the connection.
351351
#
352352
# @returns [String | Nil] the line read, or nil if the connection is closed.
353-
# @raises [EOFError] if the connection is closed.
354353
# @raises [LineLengthError] if the line is too long.
355354
def read_line?
356355
if line = @stream.gets(CRLF, @maximum_line_length)
@@ -361,6 +360,8 @@ def read_line?
361360
end
362361

363362
return line
363+
rescue EOFError, Errno::ECONNRESET, Errno::EPIPE
364+
return nil
364365
end
365366

366367
# Read a line from the connection.

0 commit comments

Comments
 (0)