aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-07-06 13:12:37 -0700
committerisaacs <i@izs.me>2011-07-06 13:17:50 -0700
commit87900b14da5f72ea7d049bdebc6a71034a9e34aa (patch)
tree6c94a2b24e95bf448f9b865d50d84207d669ef66 /lib
parent8475e1527ddc3fcfa3ed30846130e05e183935c6 (diff)
downloadandroid-node-v8-87900b14da5f72ea7d049bdebc6a71034a9e34aa.tar.gz
android-node-v8-87900b14da5f72ea7d049bdebc6a71034a9e34aa.tar.bz2
android-node-v8-87900b14da5f72ea7d049bdebc6a71034a9e34aa.zip
url: Don't swallow punycode errors
Diffstat (limited to 'lib')
-rw-r--r--lib/url.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/url.js b/lib/url.js
index ed90e5cad1..a30fa8a9cf 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -222,18 +222,14 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
// It only converts the part of the domain name that
// has non ASCII characters. I.e. it dosent matter if
// you call it with a domain that already is in ASCII.
- try {
- var domainArray = out.hostname.split('.');
- var newOut = [];
- for (var i = 0; i < domainArray.length; ++i) {
- var s = domainArray[i];
- newOut.push(s.match(/[^A-Za-z0-9-]/) ?
- 'xn--' + punycode.encode(s) : s);
- }
- out.hostname = newOut.join('.');
- } catch (e) {
- // if encode fail for some reason, we just do the classic behavior.
+ var domainArray = out.hostname.split('.');
+ var newOut = [];
+ for (var i = 0; i < domainArray.length; ++i) {
+ var s = domainArray[i];
+ newOut.push(s.match(/[^A-Za-z0-9-]/) ?
+ 'xn--' + punycode.encode(s) : s);
}
+ out.hostname = newOut.join('.');
out.host = ((out.auth) ? out.auth + '@' : '') +
(out.hostname || '') +