Permalink
Browse files

Closes GH-726 Put port on hostname.

  • Loading branch information...
1 parent 0ab84bf commit b8698c5f399b0e28fb2db7560a786aedce9dce9e @isaacs isaacs committed Mar 21, 2011
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/utils/fetch.js
  2. +4 −0 lib/utils/proxyify.js
  3. +1 −0 lib/utils/registry/request.js
View
@@ -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")))
@@ -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"))
@@ -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(

0 comments on commit b8698c5

Please sign in to comment.