rescue from IOError and terminate the connection

contrary to what was probably assumed, IOError is not a SocketError...

Closes #295
This commit is contained in:
HoneyryderChuck 2024-01-25 00:15:27 +00:00
parent dd0473e7cf
commit 5a08853e7a
2 changed files with 4 additions and 2 deletions

View File

@ -522,7 +522,8 @@ 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)

View File

@ -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..." }