Throw InvalidURL not UnicodeError on bad label.

This commit is contained in:
Cory Benfield
2012-08-10 17:29:12 +01:00
parent e08b853a0c
commit 79d53d3b8a
+4 -1
View File
@@ -413,7 +413,10 @@ class Request(object):
if not scheme in SCHEMAS:
raise InvalidSchema("Invalid scheme %r" % scheme)
netloc = netloc.encode('idna').decode('utf-8')
try:
netloc = netloc.encode('idna').decode('utf-8')
except UnicodeError:
raise InvalidURL('URL has an invalid label.')
if not path:
path = '/'