Skip to content
Myr

Enable UTS46 mode.

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 110684e · Browse files · 2 files+13 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

2 files+13 added−2 removed

  • tests:+12 added−1 removed
  • other:+1 added−1 removed

2 files+13 added−2 removed

modified:requests/models.py+1 added-1 removed
362 unmodified lines
363 raise InvalidURL("Invalid URL %r: No host supplied" % url)364365 # Only want to apply IDNA to the hostname366 try:367 host = idna.encode(host).decode('utf-8')367 host = idna.encode(host, uts46=True).decode('utf-8')368 except (UnicodeError, idna.IDNAError):369 raise InvalidURL('URL has an invalid label.')370371 # Carefully reconstruct the network location
511 unmodified lines
modified:tests/test_requests.py+12 added-1 removed
1898 unmodified lines
1899 (1900 u'http://ジェーピーニック.jp'.encode('utf-8'),1901 u'http://xn--hckqz9bzb1cyrb.jp/'1902 ),1903 (u'http://straße.de/straße', u'http://xn--strae-oqa.de/stra%C3%9Fe'),1903 (1904 u'http://straße.de/straße',1905 u'http://xn--strae-oqa.de/stra%C3%9Fe'1906 ),1907 (1908 u'http://straße.de/straße'.encode('utf-8'),1909 u'http://xn--strae-oqa.de/stra%C3%9Fe'1910 ),1911 (1912 u'http://Königsgäßchen.de/straße',1913 u'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'1914 ),1915 (1916 u'http://Königsgäßchen.de/straße'.encode('utf-8'),1917 u'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'1918 ),1919 )1920 )1921 def test_preparing_url(self, url, expected):1922 r = requests.Request(url=url)
16 unmodified lines