summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2013-03-31 12:28:04 +0100
committerBob Halley <halley@dnspython.org>2013-03-31 12:28:04 +0100
commit5f5644c3528ea2f14559d6ddaff0f6783933bc5f (patch)
tree6397570d52accab9e7d94dbbd18c9f50b4b9efaf
parent7c28c9cdc3a931829e8a4a46420eaf3418926b45 (diff)
downloaddnspython-5f5644c3528ea2f14559d6ddaff0f6783933bc5f.tar.gz
Do not retry SERVFAILing nameservers by default
-rw-r--r--dns/resolver.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/dns/resolver.py b/dns/resolver.py
index f7e8b7a..08e86a2 100644
--- a/dns/resolver.py
+++ b/dns/resolver.py
@@ -433,6 +433,9 @@ class Resolver(object):
@type flags: int
@ivar cache: The cache to use. The default is None.
@type cache: dns.resolver.Cache object
+ @ivar retry_servfail: should we retry a nameserver if it says SERVFAIL?
+ The default is 'false'.
+ @type retry_servfail: bool
"""
def __init__(self, filename='/etc/resolv.conf', configure=True):
"""Initialize a resolver instance.
@@ -473,6 +476,7 @@ class Resolver(object):
self.payload = 0
self.cache = None
self.flags = None
+ self.retry_servfail = False
def read_resolv_conf(self, f):
"""Process f as a file in the /etc/resolv.conf format. If f is
@@ -843,7 +847,7 @@ class Resolver(object):
# rcode in it. Remove the server from the mix if
# the rcode isn't SERVFAIL.
#
- if rcode != dns.rcode.SERVFAIL:
+ if rcode != dns.rcode.SERVFAIL or not retry_servfail:
nameservers.remove(nameserver)
response = None
if not response is None: