DAGDA SEARCH | Back to results | Support

Message 332413 - Python tracker

Source: https://bugs.python.org/msg332413

homepage

Message332413 ➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Divya Rani, steven.daprano, xtreak
Date 2018-12-24.06:02:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1545631358.88.0.0770528567349.issue35573@roundup.psfhosted.org>
In-reply-to
Content
> 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
History
Date User Action Args
2018-12-24 06:02:40xtreaksetrecipients: + xtreak, steven.daprano, Divya Rani
2018-12-24 06:02:38xtreaksetmessageid: <1545631358.88.0.0770528567349.issue35573@roundup.psfhosted.org>
2018-12-24 06:02:38xtreaklinkissue35573 messages
2018-12-24 06:02:38xtreakcreate
Supported by The Python Software Foundation,
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements