Apply lowercasing before IDNA-encoding
@@ -183,7 +183,7 @@ def parse_url(url):
except ImportError:
raise LocationParseError("Unable to parse URL without the 'idna' module")
try:
- return idna.encode(name, strict=True, std3_rules=True).lower()
+ return idna.encode(name.lower(), strict=True, std3_rules=True)
except idna.IDNAError:
raise LocationParseError(u"Name '%s' is not a valid IDNA label" % name)
return name
