lib/httpx/resolver/https.rb in httpx-1.1.5 vs lib/httpx/resolver/https.rb in httpx-1.2.0

- old
+ new

@@ -25,11 +25,11 @@ DEFAULTS = { uri: NAMESERVER, use_get: false, }.freeze - def_delegators :@resolver_connection, :state, :connecting?, :to_io, :call, :close + def_delegators :@resolver_connection, :state, :connecting?, :to_io, :call, :close, :terminate def initialize(_, options) super @resolver_options = DEFAULTS.merge(@options.resolver_options) @queries = {} @@ -48,10 +48,11 @@ @uri_addresses ||= HTTPX::Resolver.nolookup_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) + connection.force_reset throw(:resolve_error, ex) end resolve(connection) end @@ -65,10 +66,10 @@ end def resolver_connection @resolver_connection ||= @pool.find_connection(@uri, @options) || begin @building_connection = true - connection = @options.connection_class.new("ssl", @uri, @options.merge(ssl: { alpn_protocols: %w[h2] })) + connection = @options.connection_class.new(@uri, @options.merge(ssl: { alpn_protocols: %w[h2] })) @pool.init_connection(connection, @options) # only explicity emit addresses if connection didn't pre-resolve, i.e. it's not an IP. emit_addresses(connection, @family, @uri_addresses) unless connection.addresses @building_connection = false connection