Enabling /etc/hosts parsing by default in greendns, solves a few silly-seeming issues like not being able to look up localhost.
This commit is contained in:
@@ -68,9 +68,12 @@ class ResolverProxy(object):
|
||||
self._load_etc_hosts()
|
||||
|
||||
def _load_etc_hosts(self):
|
||||
try:
|
||||
fd = open('/etc/hosts', 'r')
|
||||
contents = fd.read()
|
||||
fd.close()
|
||||
except (IOError, OSError):
|
||||
return
|
||||
contents = [line for line in contents.split('\n') if line and not line[0] == '#']
|
||||
for line in contents:
|
||||
line = line.replace('\t', ' ')
|
||||
@@ -104,7 +107,7 @@ class ResolverProxy(object):
|
||||
#
|
||||
# cache
|
||||
#
|
||||
resolver = ResolverProxy()
|
||||
resolver = ResolverProxy(dev=True)
|
||||
|
||||
def resolve(name):
|
||||
error = None
|
||||
|
Reference in New Issue
Block a user