]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Do not retry SERVFAILing nameservers by default
authorBob Halley <halley@dnspython.org>
Sun, 31 Mar 2013 11:32:16 +0000 (12:32 +0100)
committerBob Halley <halley@dnspython.org>
Sun, 31 Mar 2013 11:32:16 +0000 (12:32 +0100)
dns/resolver.py

index 21592bc7a77fc6c2ebb220d3d1e69b5fba7cac1a..a041ce24c1b49b68d76b07f770cff8165541a36b 100644 (file)
@@ -430,6 +430,9 @@ class Resolver(object):
     @type payload: 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.
@@ -469,6 +472,7 @@ class Resolver(object):
         self.ednsflags = 0
         self.payload = 0
         self.cache = 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
@@ -833,7 +837,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: