remove last dot (which is RFC possiblity) the dnspython way. thank Bob Halley

This commit is contained in:
Nikos Kouremenos 2005-12-06 22:08:10 +00:00
parent eae33b3677
commit 9e85df37b1

View file

@ -1584,10 +1584,9 @@ class Connection:
answers = [x for x in dns.resolver.query(query, 'SRV')] answers = [x for x in dns.resolver.query(query, 'SRV')]
if answers: if answers:
for a in answers: for a in answers:
target = str(a.target) target = dns.name.from_text(str(a.target))
if target.endswith('.'): # target is f.e. talk.google.com. remove last dot
# target is f.e. talk.google.com. remove last dot target = target.to_text(omit_final_dot = True)
target = target[:-1]
hosts.append({'host': target, hosts.append({'host': target,
'port': int(a.port), 'port': int(a.port),
'prio': int(a.priority), 'prio': int(a.priority),