Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
url: improve parsing speed
The url.parse() function now checks whether an escapable character is
in the URL before trying to escape it.

PR-URL: nodejs/node-v0.x-archive#8638
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
CGavrila authored and bnoordhuis committed Dec 6, 2014
commit 36aeae8610d478760460cb5f14103a940c20b0d8
10 changes: 6 additions & 4 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,13 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// need to be.
for (var i = 0, l = autoEscape.length; i < l; i++) {
var ae = autoEscape[i];
var esc = encodeURIComponent(ae);
if (esc === ae) {
esc = escape(ae);
if (rest.indexOf(ae) !== -1) {
var esc = encodeURIComponent(ae);
if (esc === ae) {
esc = escape(ae);
}
rest = rest.split(ae).join(esc);
}
rest = rest.split(ae).join(esc);
}
}

Expand Down