lib/httpx/resolver/native.rb in httpx-0.4.1 vs lib/httpx/resolver/native.rb in httpx-0.5.0

- old
+ new

@@ -29,10 +29,22 @@ timeouts: RESOLVE_TIMEOUT, record_types: RECORD_TYPES.keys, }.freeze end + # nameservers for ipv6 are misconfigured in certain systems; + # this can use an unexpected endless loop + # https://gitlab.com/honeyryderchuck/httpx/issues/56 + DEFAULTS[:nameserver].select! do |nameserver| + begin + IPAddr.new(nameserver) + true + rescue IPAddr::InvalidAddressError + false + end + end if DEFAULTS[:nameserver] + DNS_PORT = 53 def_delegator :@connections, :empty? def initialize(options) @@ -85,10 +97,10 @@ end transition(:idle) else if e.respond_to?(:connection) && e.respond_to?(:host) - emit_resolve_error(connection, host, e) + emit_resolve_error(e.connection, e.host, e) else @queries.each do |host, connection| emit_resolve_error(connection, host, e) end end