Skip to content

Use the ipaddress module to detect valid IPV6 #164

@azmeuk

Description

@azmeuk

I was surprised to see that furl would allow invalid but well-formed IPV6:

furl/tests/test_furl.py

Lines 1658 to 1661 in 7748462

# Invalid, but well-formed, IPv6 addresses shouldn't raise an
# exception because urlparse.urlsplit() doesn't raise an
# exception on invalid IPv6 addresses.
furl.furl('http://[0:0:0:0:0:0:0:1:1:1:1:1:1:1:1:9999999999999]/')

I would suggest to use the IPV6Address object from the python3 ipaddress module to validate IPV6. For python2 I would suggest using the ipaddress backport on pypi.

If it is OK I would volunteer for a PR. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions