Skip to content
This repository has been archived by the owner. It is now read-only.

Don't assume we can resolve a domain name #278

Merged
merged 2 commits into from Oct 24, 2018
Merged

Conversation

Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
@pastly
Copy link
Member

@pastly pastly commented Oct 22, 2018

Even for a valid domain that usually resolves, sometimes the local DNS
resolver won't be able to resolve it (duh). Catch the exception that gets
thrown in that instance and fail gracefully by returning an empty list.

pastly added 2 commits Oct 22, 2018
Even for a valid domain that usually resolves, sometimes the local DNS
resolver won't be able to resolve it (duh). Catch the exception that gets
thrown in that instance and fail gracefully by returning an empty list.
sbws/globals.py Outdated
@@ -67,8 +67,16 @@ def touch_file(fname, times=None):

def resolve(hostname, ipv4_only=False, ipv6_only=False):
assert not (ipv4_only and ipv6_only)
results = []
try:
results = socket.getaddrinfo(hostname, 0):
Copy link
Contributor

@juga0 juga0 Oct 23, 2018

Invalid syntax. There is a semicolon at the end of the line

@juga0 juga0 merged commit 8787741 into torproject:master Oct 24, 2018
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.