Some chromagnon cache keys aren't bytes or text?

This commit is contained in:
Jim Miller 2021-01-21 12:41:56 -06:00
parent f82e534cb5
commit 10a6554c81

View file

@ -108,10 +108,18 @@ class CacheEntry():
# It is probably an HTTP header
self.key = cacheData.CacheData(addr, self.keyLength, True)
# Some keys seem to be '_dk_http://example.com https://example.com https://www.example.com/full/url/path'
# fix those up so the actual URL will work as a hash key in our table
# if key has whitespace followed by final http[s]://something, substitute, otherwise this leaves it unchanged
self.key = re.sub(r'^.*\s(https?://\S+)$', r'\1', self.key)
try:
# Some keys seem to be '_dk_http://example.com https://example.com https://www.example.com/full/url/path'
# fix those up so the actual URL will work as a hash key
# in our table if key has whitespace followed by final
# http[s]://something, substitute, otherwise this leaves
# it unchanged
self.key = re.sub(r'^.*\s(https?://\S+)$', r'\1', self.key)
except TypeError:
## Some 'keys' are not bytes or text types. No idea why
## not.
# print(self.key)
pass
block.close()
def keyToStr(self):