summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-04-21 20:16:13 -0700
committerJames M Snell <jasnell@gmail.com>2017-04-24 13:13:44 -0700
commitc005ebb0ce3888c7fc6d088fab75561c29c2a31c (patch)
tree9cdfb28493a3dd3eba77817a6557356cfe8fef78 /lib/url.js
parentbcb1d9c39a51d7d50cc2e68c25db4e55429a19eb (diff)
downloadandroid-node-v8-c005ebb0ce3888c7fc6d088fab75561c29c2a31c.tar.gz
android-node-v8-c005ebb0ce3888c7fc6d088fab75561c29c2a31c.tar.bz2
android-node-v8-c005ebb0ce3888c7fc6d088fab75561c29c2a31c.zip
url: improve descriptiveness of identifier
Change variable for protocols that do not always contain `//` to `noLeadingSlashes` so someone reading the code knows what it means. PR-URL: https://github.com/nodejs/node/pull/12579 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/url.js b/lib/url.js
index 258bc864ee..530632a50b 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -765,14 +765,14 @@ Url.prototype.resolveObject = function resolveObject(relative) {
var removeAllDots = mustEndAbs;
var srcPath = result.pathname && result.pathname.split('/') || [];
var relPath = relative.pathname && relative.pathname.split('/') || [];
- var psychotic = result.protocol && !slashedProtocol[result.protocol];
+ var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];
// if the url is a non-slashed url, then relative
// links like ../.. should be able
// to crawl up to the hostname, as well. This is strange.
// result.protocol has already been set by now.
// Later on, put the first path part into the host field.
- if (psychotic) {
+ if (noLeadingSlashes) {
result.hostname = '';
result.port = null;
if (result.host) {
@@ -820,7 +820,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// just pull out the search.
// like href='?foo'.
// Put this after the other two cases because it simplifies the booleans
- if (psychotic) {
+ if (noLeadingSlashes) {
result.hostname = result.host = srcPath.shift();
//occasionally the auth can get stuck only in host
//this especially happens in cases like
@@ -901,7 +901,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
(srcPath[0] && srcPath[0].charAt(0) === '/');
// put the host back
- if (psychotic) {
+ if (noLeadingSlashes) {
result.hostname = result.host = isAbsolute ? '' :
srcPath.length ? srcPath.shift() : '';
//occasionally the auth can get stuck only in host