mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-09 00:02:50 -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::ENETUNREACH,
|
||||||
Errno::EPIPE,
|
Errno::EPIPE,
|
||||||
Errno::ENOENT,
|
Errno::ENOENT,
|
||||||
SocketError => e
|
SocketError,
|
||||||
|
IOError => e
|
||||||
# connect errors, exit gracefully
|
# connect errors, exit gracefully
|
||||||
error = ConnectionError.new(e.message)
|
error = ConnectionError.new(e.message)
|
||||||
error.set_backtrace(e.backtrace)
|
error.set_backtrace(e.backtrace)
|
||||||
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
|
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
|
||||||
@state = :closed
|
@state = :closed
|
||||||
emit(:close)
|
emit(:close)
|
||||||
rescue TLSError => e
|
rescue TLSError, HTTP2Next::Error::ProtocolError, HTTP2Next::Error::HandshakeError => e
|
||||||
# connect errors, exit gracefully
|
# connect errors, exit gracefully
|
||||||
handle_error(e)
|
handle_error(e)
|
||||||
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
|
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
|
||||||
|
@ -78,7 +78,8 @@ module HTTPX
|
|||||||
rescue Errno::ECONNREFUSED,
|
rescue Errno::ECONNREFUSED,
|
||||||
Errno::EADDRNOTAVAIL,
|
Errno::EADDRNOTAVAIL,
|
||||||
Errno::EHOSTUNREACH,
|
Errno::EHOSTUNREACH,
|
||||||
SocketError => e
|
SocketError,
|
||||||
|
IOError => e
|
||||||
raise e if @ip_index <= 0
|
raise e if @ip_index <= 0
|
||||||
|
|
||||||
log { "failed connecting to #{@ip} (#{e.message}), trying next..." }
|
log { "failed connecting to #{@ip} (#{e.message}), trying next..." }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user