diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2017-01-18 10:00:21 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2017-01-18 10:00:21 +0300 |
commit | 5d7fe98c6c1134bc057c27a57333dfd1a3964e6a (patch) | |
tree | 07119457057b750eb1dad09bdfdb62d21b5edf87 /lib | |
parent | 9ef79bd384cfcd836cf66d069368959cf626d85c (diff) |
Set user-agent header for http tracker requests
Fixes: https://github.com/feross/webtorrent/issues/962
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 0b69556..dc186c2 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -52,6 +52,7 @@ var FILESYSTEM_CONCURRENCY = 2 var RECONNECT_WAIT = [ 1000, 5000, 15000 ] var VERSION = require('../package.json').version +var USER_AGENT = 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' var TMP try { @@ -332,7 +333,8 @@ Torrent.prototype._onListening = function () { peerId: self.client.peerId, dht: !self.private && self.client.dht, tracker: trackerOpts, - port: self.client.torrentPort + port: self.client.torrentPort, + userAgent: USER_AGENT }) self.discovery.on('error', onError) @@ -395,7 +397,7 @@ Torrent.prototype._getMetadataFromServer = function () { url: url, method: 'GET', headers: { - 'user-agent': 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' + 'user-agent': USER_AGENT } } var req |