From b9f6a33cc83fd877c30a6249ac454b817e7a3c06 Mon Sep 17 00:00:00 2001 From: Michal Charemza Date: Mon, 28 Aug 2023 11:50:19 +0100 Subject: [PATCH] fix: don't lowercase TXT records This is borderline out of scope of aiodnsresolver, but it's a small fix --- aiodnsresolver.py | 3 ++- test.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/aiodnsresolver.py b/aiodnsresolver.py index 2222061..0b8b312 100644 --- a/aiodnsresolver.py +++ b/aiodnsresolver.py @@ -605,7 +605,8 @@ def rdata_expires_at(record, expires_at): return \ IPv4AddressExpiresAt(record.rdata, expires_at) if record.qtype == TYPES.A else \ IPv6AddressExpiresAt(record.rdata, expires_at) if record.qtype == TYPES.AAAA else \ - BytesExpiresAt(record.rdata.lower(), expires_at) + BytesExpiresAt(record.rdata.lower(), expires_at) if record.qtype == TYPES.CNAME else \ + BytesExpiresAt(record.rdata, expires_at) def rdata_expires_at_min(rdatas, expires_at): return tuple( diff --git a/test.py b/test.py index dad0250..d0a4656 100644 --- a/test.py +++ b/test.py @@ -1688,6 +1688,8 @@ async def test_a_query_multiple(self): async def test_txt_query(self): resolve, _ = Resolver() res = await resolve('charemza.name', TYPES.TXT) + all_lowercase = all(r == r.lower() for r in res) + self.assertFalse(all_lowercase) self.assertIn(b'google', res[0]) @async_test