mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
Merge branch 'issue-288' into 'master'
cleanly close the connection on HTTP2 protocol error Closes #288, #294, and #295 See merge request os85/httpx!325
This commit is contained in:
commit
566b804b65
@ -522,14 +522,15 @@ module HTTPX
|
||||
Errno::ENETUNREACH,
|
||||
Errno::EPIPE,
|
||||
Errno::ENOENT,
|
||||
SocketError => e
|
||||
SocketError,
|
||||
IOError => e
|
||||
# connect errors, exit gracefully
|
||||
error = ConnectionError.new(e.message)
|
||||
error.set_backtrace(e.backtrace)
|
||||
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
|
||||
@state = :closed
|
||||
emit(:close)
|
||||
rescue TLSError => e
|
||||
rescue TLSError, HTTP2Next::Error::ProtocolError, HTTP2Next::Error::HandshakeError => e
|
||||
# connect errors, exit gracefully
|
||||
handle_error(e)
|
||||
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
|
||||
|
@ -78,7 +78,8 @@ module HTTPX
|
||||
rescue Errno::ECONNREFUSED,
|
||||
Errno::EADDRNOTAVAIL,
|
||||
Errno::EHOSTUNREACH,
|
||||
SocketError => e
|
||||
SocketError,
|
||||
IOError => e
|
||||
raise e if @ip_index <= 0
|
||||
|
||||
log { "failed connecting to #{@ip} (#{e.message}), trying next..." }
|
||||
|
Loading…
x
Reference in New Issue
Block a user