diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-05-20 05:17:30 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-05-20 05:17:30 +0300 |
commit | 101fdb7a46593e3abad7517bfee77ce40f30316c (patch) | |
tree | 0b4ae0c060617971c3a2daa1b2ed86bfa35b589c /lib | |
parent | ee5dab1fe0c4f0ffde4d3ed14ea53926e8b83522 (diff) |
Make user agent strings consistent
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 4 | ||||
-rw-r--r-- | lib/webconn.js | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 6b10927..db71a5f 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -51,6 +51,8 @@ var FILESYSTEM_CONCURRENCY = 2 var RECONNECT_WAIT = [ 1000, 5000, 15000 ] +var VERSION = require('./package.json').version + var TMP try { TMP = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent') @@ -393,7 +395,7 @@ Torrent.prototype._getMetadataFromServer = function () { url: url, method: 'GET', headers: { - 'user-agent': 'WebTorrent (https://webtorrent.io)' + 'user-agent': 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' } } var req diff --git a/lib/webconn.js b/lib/webconn.js index a45ca68..3507241 100644 --- a/lib/webconn.js +++ b/lib/webconn.js @@ -7,6 +7,8 @@ var inherits = require('inherits') var sha1 = require('simple-sha1') var Wire = require('bittorrent-protocol') +var VERSION = require('./package.json').version + inherits(WebConn, Wire) /** @@ -112,7 +114,7 @@ WebConn.prototype.httpRequest = function (pieceIndex, offset, length, cb) { url: url, method: 'GET', headers: { - 'user-agent': 'WebTorrent (http://webtorrent.io)', + 'user-agent': 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' 'range': 'bytes=' + start + '-' + end } } |