making sure that addresses map to proper addrinfo when in tcp mode

This commit is contained in:
HoneyryderChuck 2021-03-09 19:27:14 +00:00
parent e34c998f5a
commit cad4079cb3

View File

@ -16,7 +16,6 @@ module HTTPX
def initialize(origin, addresses, options)
@state = :idle
@hostname = origin.host
@addresses = addresses
@options = Options.new(options)
@fallback_protocol = @options.fallback_protocol
@port = origin.port
@ -36,8 +35,9 @@ module HTTPX
@keep_open = true
@state = :connected
else
@ip_index = @addresses.size - 1
@addresses = addresses.map { |addr| addr.is_a?(IPAddr) ? addr : IPAddr.new(addr) }
end
@ip_index = @addresses.size - 1
@io ||= build_socket
end