forked from pool/python-eventlet
Hostname in /etc/hosts are not case-sensitive, this fixes HostsResolver() accordingly. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-eventlet?expand=0&rev=45
40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
From 6ad13590aff7d6544443e6646555d949bd316796 Mon Sep 17 00:00:00 2001
|
|
From: Ralf Haferkamp <rhafer@suse.de>
|
|
Date: Fri, 12 Jan 2018 13:48:09 +0100
|
|
Subject: [PATCH] greendns: Treat /etc/hosts entries case-insensitive
|
|
|
|
Hostname in /etc/hosts are not case-sensitive, this fixes
|
|
HostsResolver() accordingly.
|
|
|
|
eventlet#458
|
|
|
|
Co-Authored-By: Thomas Bechtold <tbechtold@suse.com>
|
|
---
|
|
eventlet/support/greendns.py | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/eventlet/support/greendns.py b/eventlet/support/greendns.py
|
|
index cff0581c..140388ec 100644
|
|
--- a/eventlet/support/greendns.py
|
|
+++ b/eventlet/support/greendns.py
|
|
@@ -222,9 +222,10 @@ def _load(self):
|
|
ipmap = self._v6
|
|
else:
|
|
continue
|
|
- cname = parts.pop(0)
|
|
+ cname = parts.pop(0).lower()
|
|
ipmap[cname] = ip
|
|
for alias in parts:
|
|
+ alias = alias.lower()
|
|
ipmap[alias] = ip
|
|
self._aliases[alias] = cname
|
|
self._last_load = time.time()
|
|
@@ -251,6 +252,7 @@ def query(self, qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN,
|
|
qname = dns.name.from_text(qname)
|
|
else:
|
|
name = str(qname)
|
|
+ name = name.lower()
|
|
rrset = dns.rrset.RRset(qname, rdclass, rdtype)
|
|
rrset.ttl = self._last_load + self.interval - now
|
|
if rdclass == dns.rdataclass.IN and rdtype == dns.rdatatype.A:
|