Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-09-29 21:47:24 +0400
committerisaacs <i@izs.me>2010-09-29 21:47:24 +0400
commitbd3c5039f540846ab3ee98a8ab7c19249687287d (patch)
tree087e31d41969841b4889a09d59c5aef20e0ef6ba
parentd70ec0d13a43229f9c6268cb922c9134da71f9f6 (diff)
put proxy auth on the headers in the right place
-rw-r--r--lib/utils/registry/request.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/utils/registry/request.js b/lib/utils/registry/request.js
index 97b571558..5a15d6549 100644
--- a/lib/utils/registry/request.js
+++ b/lib/utils/registry/request.js
@@ -32,10 +32,6 @@ function request (method, where, what, cb) {
}
var proxy = (proxyConfig) ? url.parse(proxyConfig) : null
if (!proxy.host) return cb(new Error("Bad proxy config: "+proxyConfig))
- if (proxy.auth) {
- headers["proxy-authorization"] =
- "Basic " + (new Buffer(proxy.auth).toString("base64"))
- }
}
var https = (proxy || u).protocol === "https:"
, port = (proxy || u).port || (https ? 443 : 80)
@@ -56,6 +52,10 @@ function request (method, where, what, cb) {
, "accept" : "application/json"
}
if (auth) headers.authorization = "Basic " + auth
+ if (proxy && proxy.auth) {
+ headers["proxy-authorization"] =
+ "Basic " + (new Buffer(proxy.auth).toString("base64"))
+ }
if (what) {
if (what instanceof File) {
log.verbose(what.name, "uploading")