Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
> What is the module "cookiejar" you are importing? Is that a third-party > module? It doesn't seem to be in the standard library. There is a module > `http.cookiejar` but it doesn't seem to have an `is_HDN` function. is_HDN does exist in http.cookiejar [0] which I assume OP is referring to but it's undocumented and used internally in other functions. From the comments and given it was added in 2a6ba9097ee (2004) this may not be as extensive as the guava implementation which I assume is at [1] IPV4_RE = re.compile(r"\.\d+$", re.ASCII) def is_HDN(text): """Return True if text is a host domain name.""" # XXX # This may well be wrong. Which RFC is HDN defined in, if any (for # the purposes of RFC 2965)? # For the current implementation, what about IPv6? Remember to look # at other uses of IPV4_RE also, if change this. if IPV4_RE.search(text): return False if text == "": return False if text[0] == "." or text[-1] == ".": return False return True [0] https://github.com/python/cpython/blob/b7105c9c9663637e4500bfcac75c911e78d9a1c0/Lib/http/cookiejar.py#L521 [1] https://github.com/google/guava/blob/1e072a7922a0b3f7b45b9f53405a233834175177/guava/src/com/google/common/net/InternetDomainName.java#L132 ---------- nosy: +xtreak _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35573> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com