From 554d31d119b94a3fede6cf68a1a76e9586c66eb3 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Sat, 28 Mar 2015 22:20:54 +0300 Subject: [PATCH] should add via header for all requests --- lib/storage.js | 7 ++++--- lib/up-storage.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/storage.js b/lib/storage.js index 587ef392d..5daad1b76 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -385,9 +385,10 @@ Storage.prototype.search = function(startkey, options, callback) { return merge_with_local_packages(null, null, {}) } self.uplinks[uplinks[i]].request({ - uri: options.req.url, - timeout: self.uplinks[p].timeout, - json: true, + uri : options.req.url, + timeout : self.uplinks[p].timeout, + json : true, + req : options.req, }, function(err, res, body) { if (err || Math.floor(res.statusCode / 100) > 3) { i++ diff --git a/lib/up-storage.js b/lib/up-storage.js index e434dd384..144f70299 100644 --- a/lib/up-storage.js +++ b/lib/up-storage.js @@ -111,6 +111,7 @@ Storage.prototype.request = function(options, cb) { headers['Accept'] = headers['Accept'] || 'application/json' headers['Accept-Encoding'] = headers['Accept-Encoding'] || 'gzip' headers['User-Agent'] = headers['User-Agent'] || this.userAgent + this._add_proxy_headers(options.req, headers) var method = options.method || 'GET' var uri = options.uri_full || (this.config.url + options.uri) @@ -253,12 +254,12 @@ Storage.prototype.get_package = function(name, options, callback) { headers['If-None-Match'] = options.etag headers['Accept'] = 'application/octet-stream' } - this._add_proxy_headers(options.req, headers) this.request({ uri : '/' + encode(name), json : true, headers : headers, + req : options.req, }, function(err, res, body) { if (err) return callback(err) if (res.statusCode === 404) {