class Resolv::DNS::Config
Attributes
raise_errors[RW]
Public Instance Methods
resolv(name) { |candidate, tout, nameserver, port| ... }
click to toggle source
# File lib/spf/ext/resolv.rb, line 122 def resolv(name) candidates = generate_candidates(name) timeouts = generate_timeouts # Collect errors while making the various lookup attempts: # PATCH errors = [] # PATCH begin candidates.each {|candidate| begin timeouts.each {|tout| @nameserver_port.each {|nameserver, port| begin yield candidate, tout, nameserver, port rescue ResolvTimeout end } } # Collect a timeout: # PATCH errors << TimeoutError.new("DNS resolv timeout: #{name}") # PATCH rescue NXDomain # Collect an NXDOMAIN error: # PATCH errors << NXDomainError.new("DNS name does not exist: #{name}") # PATCH end } rescue ResolvError # Allow subclasses to set this to override this behavior without # PATCH # wholesale monkeypatching. # PATCH raise if raise_errors # PATCH # Ignore other errors like vanilla Resolv::DNS does. # PATCH # Perhaps this is not a good idea, though, as it silently swallows # PATCH # SERVFAILs, etc. # PATCH end # If one lookup succeeds, we will have returned within "yield" already. # PATCH # Otherwise we now raise the first error that occurred: # PATCH raise errors.first if not errors.empty? # PATCH end