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
urllib2/urllib.parse.splitport does not handle IPv6 correctly #62391
Comments
>>> import urllib.parse
>>> urllib.parse.splitport("::1")
(':', '1') This is obviously invalid. |
Attached is a patch inspired by a function written for OpenStack Oslo library. |
LGTM |
I see only tests. It is more common to use arguments for assertEqual() in the reverse order, first actual value, and than expected value. |
FTR, urllib.parse.splitport is undocumented and it is only used by urllib.request in the stdlib. |
Fixes Serhiy Storchaka's complaints, removes duplicate test. |
Handles "raw" IPv6 URLs |
I posted a patch to bpo-20271 which should fix the issue. I wrote the patch for Python 3.5, but it can be adapted to be tolerant (don't make extensive tests on port number, host and IPv6) for older versions. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: