summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2013-03-31 12:21:34 +0100
committerBob Halley <halley@dnspython.org>2013-03-31 12:21:34 +0100
commite2bdfe09e419cfe0a55dc3187121e41a5a0cd675 (patch)
tree10f08d3df5a2c0b0ca676fecab5881f16b74e594
parentfe3ee7ec3145bf5472601b0ceb11fc085aa14705 (diff)
downloaddnspython-e2bdfe09e419cfe0a55dc3187121e41a5a0cd675.tar.gz
Raise YXDOMAIN if we see a YXDOMAIN rcode
-rw-r--r--dns/resolver.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/resolver.py b/dns/resolver.py
index 97fda1c..21592bc 100644
--- a/dns/resolver.py
+++ b/dns/resolver.py
@@ -41,6 +41,10 @@ class NXDOMAIN(dns.exception.DNSException):
"""The query name does not exist."""
pass
+class YXDOMAIN(dns.exception.DNSException):
+ """The query name is too long after DNAME substitution."""
+ pass
+
# The definition of the Timeout exception has moved from here to the
# dns.exception module. We keep dns.resolver.Timeout defined for
# backwards compatibility.
@@ -714,6 +718,7 @@ class Resolver(object):
@rtype: dns.resolver.Answer instance
@raises Timeout: no answers could be found in the specified lifetime
@raises NXDOMAIN: the query name does not exist
+ @raises YXDOMAIN: the query name is too long after DNAME substitution
@raises NoAnswer: the response did not contain an answer and
raise_on_no_answer is True.
@raises NoNameservers: no non-broken nameservers are available to
@@ -818,6 +823,8 @@ class Resolver(object):
response = None
continue
rcode = response.rcode()
+ if rcode == dns.rcode.YXDOMAIN:
+ raise YXDOMAIN
if rcode == dns.rcode.NOERROR or \
rcode == dns.rcode.NXDOMAIN:
break