Classes and Modules
Constants
DEFAULTS | = | { uri: NAMESERVER, use_get: false, }.freeze | ||
NAMESERVER | = | "https://1.1.1.1/dns-query" |
Public Class methods
new(_, options)
[show source]
# File lib/httpx/resolver/https.rb 32 def initialize(_, options) 33 super 34 @resolver_options = DEFAULTS.merge(@options.resolver_options) 35 @queries = {} 36 @requests = {} 37 @connections = [] 38 @uri = URI(@resolver_options[:uri]) 39 @uri_addresses = nil 40 @resolver = Resolv::DNS.new 41 @resolver.timeouts = @resolver_options.fetch(:timeouts, Resolver::RESOLVE_TIMEOUT) 42 @resolver.lazy_initialize 43 end
Public Instance methods
<<(connection)
[show source]
# File lib/httpx/resolver/https.rb 45 def <<(connection) 46 return if @uri.origin == connection.origin.to_s 47 48 @uri_addresses ||= HTTPX::Resolver.nolookup_resolve(@uri.host) || @resolver.getaddresses(@uri.host) 49 50 if @uri_addresses.empty? 51 ex = ResolveError.new("Can't resolve DNS server #{@uri.host}") 52 ex.set_backtrace(caller) 53 connection.force_reset 54 throw(:resolve_error, ex) 55 end 56 57 resolve(connection) 58 end
resolver_connection()
[show source]
# File lib/httpx/resolver/https.rb 68 def resolver_connection 69 @resolver_connection ||= @pool.find_connection(@uri, @options) || begin 70 @building_connection = true 71 connection = @options.connection_class.new(@uri, @options.merge(ssl: { alpn_protocols: %w[h2] })) 72 @pool.init_connection(connection, @options) 73 # only explicity emit addresses if connection didn't pre-resolve, i.e. it's not an IP. 74 catch(:coalesced) do 75 @building_connection = false 76 emit_addresses(connection, @family, @uri_addresses) unless connection.addresses 77 connection 78 end 79 end 80 end