-
Notifications
You must be signed in to change notification settings - Fork 100
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
Codepoint U+005B not allowed at position1 in '[::1]' #29
Comments
It seems to me that this is a bug in requests, not idna. idna's functions expect to be passed domain names, not IP literals - requests should be detecting the presence of the literal in the URL and not passing it to idna in the first place. |
@jribbens thanks for the input. |
Concur with @jribbens that this is the result of passing invalid input to a function that expects domain names. There may be an argument for adding a flag to enable a pass-through for situations where the input could include IP addresses, but the default should be protocol adherence and on that front the string is not a valid domain. I suspect it is likely more desirable for everyone for downstream users like the requests library to distinguish between domains and IP addresses before passing the host part for normalization/conversion. As an aside, having personally run into similar problems before, there may be a need to normalize/convert IP addresses which can have multiple valid representations too. For example, such that "0000:0000::1" == "::1". Even IPv4 addresses have normalization quirks — such as zero padding, or being represented as integers rather than dotted quads:
|
kennethreitz/requests#3695 seems to address this issue. |
@kjd thanks for finding that! I'll close this issue since the fix for requests is on the way. |
I believe this to be a bug with idna rather than in requests but I think that @kennethreitz should probably be aware of this too:
Using python 3.4 and requests 2.12.1 I tried to get this URL:
requests.get('http://[::]:5000/files')
Which returns this bunch of errors:
I downgraded to requests 2.11.1 (prior to the idna update) and now my code works again.
The text was updated successfully, but these errors were encountered: