From 725527aa84ad8fdb3ddf378b48d4180da1ca85d5 Mon Sep 17 00:00:00 2001 From: ZunSThy Date: Sat, 29 Oct 2016 02:51:37 +0800 Subject: [PATCH] add 'user-agent' in HTTP header --- lib/client/http-tracker.js | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/client/http-tracker.js b/lib/client/http-tracker.js index 8b767e2..0c677fc 100644 --- a/lib/client/http-tracker.js +++ b/lib/client/http-tracker.js @@ -89,8 +89,14 @@ HTTPTracker.prototype._request = function (requestUrl, params, cb) { var self = this var u = requestUrl + (requestUrl.indexOf('?') === -1 ? '?' : '&') + common.querystringStringify(params) + var opts = { + url: u, + header: { + 'user-agent': self.client._userAgent || '', + } + } - get.concat(u, function (err, res, data) { + get.concat(opts, function (err, res, data) { if (self.destroyed) return if (err) return self.client.emit('warning', err) if (res.statusCode !== 200) { diff --git a/package.json b/package.json index 2110d96..0efb598 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bittorrent-tracker", "description": "Simple, robust, BitTorrent tracker (client & server) implementation", - "version": "8.0.12", + "version": "8.0.13", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org",