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: https://github.com/joyent/node/pull/8638 [trev.norris@gmail.com: Switch to use continue instead of if] Signed-off-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
890baa03a8
commit
6a03fce16e
@ -318,6 +318,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
||||
// need to be.
|
||||
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
||||
var ae = autoEscape[i];
|
||||
if (rest.indexOf(ae) === -1)
|
||||
continue;
|
||||
var esc = encodeURIComponent(ae);
|
||||
if (esc === ae) {
|
||||
esc = escape(ae);
|
||||
|
Loading…
x
Reference in New Issue
Block a user