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

Label has disallowed hyphens #32

Closed
quantenschaum opened this issue Nov 22, 2016 · 1 comment
Closed

Label has disallowed hyphens #32

quantenschaum opened this issue Nov 22, 2016 · 1 comment

Comments

@quantenschaum
Copy link

quantenschaum commented Nov 22, 2016

Consider the following

Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import idna
>>> idna.encode('r6---sn-i5onxoxu-cxgl.c.doc-0-0-sj.sj.googleusercontent.com')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/idna/core.py", line 355, in encode
    result.append(alabel(label))
  File "/usr/local/lib/python2.7/dist-packages/idna/core.py", line 276, in alabel
    check_label(label)
  File "/usr/local/lib/python2.7/dist-packages/idna/core.py", line 239, in check_label
    check_hyphen_ok(label)
  File "/usr/local/lib/python2.7/dist-packages/idna/core.py", line 134, in check_hyphen_ok
    raise IDNAError('Label has disallowed hyphens in 3rd and 4th position')
idna.core.IDNAError: Label has disallowed hyphens in 3rd and 4th position

Same issue for decoding. The hostname is valid, so it should just pass without error.

I came here because requests unconditionally does idna encoding of the hostname.

@kjd
Copy link
Owner

kjd commented Nov 22, 2016

On first glance, this looks like it is the same issue as #27 which is not a bug in the library but an illegal hostname. Will investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants