Skip to content
Myr

Use IDNA2008 to encode hosts.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 35056b1 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:requests/models.py+3 added-2 removed
19 unmodified lines
20from .structures import CaseInsensitiveDict2122from .auth import HTTPBasicAuth23from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar24from .packages import idna25from .packages.urllib3.fields import RequestField26from .packages.urllib3.filepost import encode_multipart_formdata27from .packages.urllib3.util import parse_url28from .packages.urllib3.exceptions import (
334 unmodified lines
363 raise InvalidURL("Invalid URL %r: No host supplied" % url)364365 # Only want to apply IDNA to the hostname366 try:366 host = host.encode('idna').decode('utf-8')367 except UnicodeError:367 host = idna.encode(host).decode('utf-8')368 except (UnicodeError, idna.IDNAError):369 raise InvalidURL('URL has an invalid label.')370371 # Carefully reconstruct the network location372 netloc = auth or ''
510 unmodified lines