summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-09-16 17:48:09 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-09-16 17:48:09 -0700
commit7ca5af87a0662a1f8dca2391ae90a6342592302b (patch)
tree11be3300f5b2a7e81ca6893d768682dbeb114d8b /lib/url.js
parent21e60643b0795fe7b6a46ff29d73df60e6a7c9f5 (diff)
parent84952da24192da98746573f1086b7f393f423a3c (diff)
downloadandroid-node-v8-7ca5af87a0662a1f8dca2391ae90a6342592302b.tar.gz
android-node-v8-7ca5af87a0662a1f8dca2391ae90a6342592302b.tar.bz2
android-node-v8-7ca5af87a0662a1f8dca2391ae90a6342592302b.zip
Merge remote-tracking branch 'upstream/v0.10' into v0.12
Conflicts: ChangeLog deps/v8/src/hydrogen.cc lib/http.js lib/querystring.js src/node_crypto.cc src/node_version.h test/simple/test-querystring.js
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/url.js b/lib/url.js
index 7d2ac4e2d0..4c0ef0102f 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -278,18 +278,11 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
}
if (!ipv6Hostname) {
- // IDNA Support: Returns a puny coded representation of "domain".
- // 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.
- var domainArray = this.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);
- }
- this.hostname = newOut.join('.');
+ // IDNA Support: Returns a punycoded representation of "domain".
+ // It only converts parts of the domain name that
+ // have non-ASCII characters, i.e. it doesn't matter if
+ // you call it with a domain that already is ASCII-only.
+ this.hostname = punycode.toASCII(this.hostname);
}
var p = this.port ? ':' + this.port : '';