lib/httpx/resolver/https.rb in httpx-0.10.2 vs lib/httpx/resolver/https.rb in httpx-0.11.0

- old
+ new

@@ -35,16 +35,18 @@ @queries = {} @requests = {} @connections = [] @uri = URI(@resolver_options[:uri]) @uri_addresses = nil + @resolver = Resolv::DNS.new + @resolver.timeouts = @resolver_options.fetch(:timeouts, Resolver::RESOLVE_TIMEOUT) end def <<(connection) return if @uri.origin == connection.origin.to_s - @uri_addresses ||= Resolv.getaddresses(@uri.host) + @uri_addresses ||= ip_resolve(@uri.host) || system_resolve(@uri.host) || @resolver.getaddresses(@uri.host) if @uri_addresses.empty? ex = ResolveError.new("Can't resolve DNS server #{@uri.host}") ex.set_backtrace(caller) throw(:resolve_error, ex) @@ -97,10 +99,10 @@ end type = @_record_types[hostname].first || "A" log { "resolver: query #{type} for #{hostname}" } begin request = build_request(hostname, type) - request.on(:response, &method(:on_response).curry[request]) + request.on(:response, &method(:on_response).curry(2)[request]) request.on(:promise, &method(:on_promise)) @requests[request] = connection resolver_connection.send(request) @queries[hostname] = connection @connections << connection