Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the ipaddress module to detect valid IPV6 #164

Open
azmeuk opened this issue Sep 24, 2022 · 1 comment · May be fixed by #165
Open

Use the ipaddress module to detect valid IPV6 #164

azmeuk opened this issue Sep 24, 2022 · 1 comment · May be fixed by #165

Comments

@azmeuk
Copy link

azmeuk commented Sep 24, 2022

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?

@azmeuk azmeuk linked a pull request Sep 24, 2022 that will close this issue
@vcunat
Copy link

vcunat commented Jun 17, 2023

With python 3.11.4 it fails already without changing anything in furl? I'm getting

=========================== short test summary info ============================
FAILED tests/test_furl.py::TestFurl::test_hosts - ValueError: '0:0:0:0:0:0:0:1:1:1:1:1:1:1:1:9999999999999' does not appear t...
FAILED tests/test_furl.py::TestFurl::test_netloc - ValueError: '0:0:0:0:0:0:0:1:1:1:1:1:1:1:1:9999999999999' does not appear t...
========================= 2 failed, 76 passed in 7.41s =========================

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Jul 6, 2023
https://build.opensuse.org/request/show/1096865
by user mcepl + favogt_factory
FOR STAGING:A

- Add 165-use-ipaddress-library.patch to use standard ipaddress
  library to parse IP addresses (gh#gruns/furl#164).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants