whitespace throws regex failure and check for servfail

This commit is contained in:
Evan Fagerberg 2015-07-24 16:18:16 +00:00
parent 59e8c64853
commit 42b337cb28
1 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ except (ImportError, AttributeError):
# even when it's not strictly necessary. This way we don't forget
# when it is necessary.)
#
WSP = r'[ \t]' # see 2.2.2. Structured Header Field Bodies
WSP = r'[\s]' # see 2.2.2. Structured Header Field Bodies
CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields
NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens
QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters
@ -101,7 +101,7 @@ def get_mx_ip(hostname):
try:
MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname)
except ServerError as e:
if e.rcode == 3: # NXDOMAIN (Non-Existent Domain)
if e.rcode == 3 or e.rcode == 2: # NXDOMAIN (Non-Existent Domain) or SERVFAIL
MX_DNS_CACHE[hostname] = None
else:
raise