url: Don't swallow punycode errors
This commit is contained in:
parent
8475e1527d
commit
87900b14da
@ -222,7 +222,6 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|||||||
// It only converts the part of the domain name that
|
// It only converts the part of the domain name that
|
||||||
// has non ASCII characters. I.e. it dosent matter if
|
// has non ASCII characters. I.e. it dosent matter if
|
||||||
// you call it with a domain that already is in ASCII.
|
// you call it with a domain that already is in ASCII.
|
||||||
try {
|
|
||||||
var domainArray = out.hostname.split('.');
|
var domainArray = out.hostname.split('.');
|
||||||
var newOut = [];
|
var newOut = [];
|
||||||
for (var i = 0; i < domainArray.length; ++i) {
|
for (var i = 0; i < domainArray.length; ++i) {
|
||||||
@ -231,9 +230,6 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|||||||
'xn--' + punycode.encode(s) : s);
|
'xn--' + punycode.encode(s) : s);
|
||||||
}
|
}
|
||||||
out.hostname = newOut.join('.');
|
out.hostname = newOut.join('.');
|
||||||
} catch (e) {
|
|
||||||
// if encode fail for some reason, we just do the classic behavior.
|
|
||||||
}
|
|
||||||
|
|
||||||
out.host = ((out.auth) ? out.auth + '@' : '') +
|
out.host = ((out.auth) ? out.auth + '@' : '') +
|
||||||
(out.hostname || '') +
|
(out.hostname || '') +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user