Class: Resolv::DNS::Config
- Inherits:
-
Object
- Object
- Resolv::DNS::Config
- Defined in:
- lib/spf/ext/resolv.rb
Instance Attribute Summary collapse
-
#raise_errors ⇒ Object
PATCH.
Instance Method Summary collapse
Instance Attribute Details
#raise_errors ⇒ Object
PATCH
121 122 123 |
# File 'lib/spf/ext/resolv.rb', line 121 def raise_errors @raise_errors end |
Instance Method Details
#resolv(name) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# 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 |