diff options
author | isaacs <i@izs.me> | 2011-03-21 18:36:50 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-03-21 18:38:05 +0300 |
commit | b8698c5f399b0e28fb2db7560a786aedce9dce9e (patch) | |
tree | c518d22b20b10b874f330d639c2f567dba451746 | |
parent | 0ab84bfaadbeae4776e2226a348750d89bc8d77d (diff) |
Closes GH-726 Put port on hostname.
-rw-r--r-- | lib/utils/fetch.js | 1 | ||||
-rw-r--r-- | lib/utils/proxyify.js | 4 | ||||
-rw-r--r-- | lib/utils/registry/request.js | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils/fetch.js b/lib/utils/fetch.js index 06ae028f7..f86f2824f 100644 --- a/lib/utils/fetch.js +++ b/lib/utils/fetch.js @@ -57,6 +57,7 @@ function fetchAndWrite (remote, fstr, headers, maxRedirects, redirects) { , agent: false } if (!opts.port) opts.port = opts.secure ? 443 : 80 + if (opts.port !== (opts.secure ? 443 : 80)) opts.host += ":" + opts.port opts = proxyify(npm.config.get("proxy"), remote, opts) if (!opts) return cb(new Error("Bad proxy config: "+npm.config.get("proxy"))) diff --git a/lib/utils/proxyify.js b/lib/utils/proxyify.js index aa675f3c3..9c16850da 100644 --- a/lib/utils/proxyify.js +++ b/lib/utils/proxyify.js @@ -32,6 +32,10 @@ function proxyify (proxyConfig, remote, opts) { :proxy.protocol === "https:" ? 443 :80) + if (opts.port !== (proxy.protocol === "https:" ? 443 : 80)) { + opts.host += ":" + proxy.port + } + if (typeof remote === "string") remote = url.parse(remote) if (remote.auth) { headers.authorization = (new Buffer(remote.auth).toString("base64")) diff --git a/lib/utils/registry/request.js b/lib/utils/registry/request.js index 1192f4fed..5e1ce92fc 100644 --- a/lib/utils/registry/request.js +++ b/lib/utils/registry/request.js @@ -66,6 +66,7 @@ function request (method, where, what, etag, nofollow, cb_) { , auth = authRequired && npm.config.get("_auth") log.verbose(remote, "url parsed "+where) + if (port !== (secure ? 443 : 80)) hostname += ":" + port if (authRequired && !auth) { return cb(new Error( |