[issue32958] socket module calls with long host names can fail with idna codec error
Ned Deily
report at bugs.python.org
Fri Mar 2 16:32:44 EST 2018
Ned Deily <nad at python.org> added the comment:
Thanks for the report. The behavior you see can be further isolated to socket.gethostbyname:
>>> import socket
>>> h = "0123456789012345678901234567890123456789012345678901234567890123.example.com"
>>> socket.gethostbyname(h)
Traceback (most recent call last):
File "/usr/lib/python3.6/encodings/idna.py", line 165, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)
Other socket module calls accepting host names fail similarly, such as getaddrinfo.
----------
nosy: +ned.deily
stage: -> needs patch
title: Urllib proxy_bypass crashes for urls containing long basic auth strings -> socket module calls with long host names can fail with idna codec error
type: crash ->
versions: +Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32958>
_______________________________________
More information about the Python-bugs-list
mailing list