diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2017-01-20 02:28:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-20 02:28:58 +0300 |
commit | 0bda84ff6c7a2ab5a5517ed515ca8aef2983bb86 (patch) | |
tree | eef68bf4360ae44041d7b0ed445379a674b5ed0c /lib | |
parent | beda5162c573adbecf5d6777b6821ec451b46639 (diff) | |
parent | 5d7fe98c6c1134bc057c27a57333dfd1a3964e6a (diff) |
Merge pull request #1019 from feross/fix-962
Set user-agent header for http tracker requests
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 ad0785d..21b19af 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 |