Closed Tugzrida closed 3 years ago
That's a good point - Need to think about matchSuffix
and stripSuffix
but hash
should definitely be case-insensitive. Fixed in 0.9.15
@paulc wanted to ask what the status of matchSuffix is, will there also be a fix here ?
I just got an issue with matchSuffix as well. I belive that it (at least most of the time) should be case insensitive https://datatracker.ietf.org/doc/html/rfc4343
>>> from dnslib.dns import DNSLabel
>>> l = DNSLabel("test.example.Com")
>>> l
<DNSLabel: 'test.example.Com.'>
>>> l.matchSuffix("example.Com")
True
>>> l.matchSuffix("example.com")
False
>>>
The last command is False, expected True
It is seen in the wild that requests are coming in especially as .ip6.arpa.
and .IP6.ARPA.
I'm not sure if there's a reason behind this, but the
__eq__
method of DNSLabel allows for case-insensitive comparison, whereas__hash__
,matchSuffix
andstripSuffix
are case sensitive.My use case is storing some records in a dict keyed by name and to get it to work properly now requires manually converting everything to lowercase before searching.