diff options
-rw-r--r-- | CHANGELOG.md | 43 | ||||
-rw-r--r-- | lib/torrent.js | 4 | ||||
-rw-r--r-- | package.json | 86 | ||||
-rw-r--r-- | test/node/download-dht-magnet.js | 5 | ||||
-rw-r--r-- | test/node/download-dht-torrent.js | 5 | ||||
-rw-r--r-- | test/node/download-metadata.js | 11 | ||||
-rw-r--r-- | test/node/download-private-dht.js | 5 | ||||
-rw-r--r-- | test/node/download-tracker-magnet.js | 7 | ||||
-rw-r--r-- | test/node/download-tracker-torrent.js | 5 | ||||
-rw-r--r-- | test/node/download-webseed-magnet.js | 7 | ||||
-rw-r--r-- | test/node/download-webseed-torrent.js | 5 | ||||
-rw-r--r-- | test/node/seed-while-download.js | 9 |
12 files changed, 121 insertions, 71 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b0def7..ca96384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # WebTorrent Version History +## v0.95.2 - 2016-06-22 + +- HEAD requests
 to HTTP server should not send entire body +- WebTorrent, LLC is now the steward of the project + +## v0.95.1 - 2016-06-15 + +- Emit 'seed' event on the torrent object + +## v0.95.0 - 2016-06-15 + +- API: Add `file.getBlob()` method
 +- Fix rare exception in `lib/tcp-pool.js` + +## v0.94.4 - 2016-06-10 + +- Support torrent with a single 0 byte file +- Use `<` since it handles `NaN` in a predictable way, i.e. `false` + +## v0.94.3 - 2016-05-30 + +- Use `safe-buffer` for improved buffer safety + +## v0.94.2 - 2016-05-28 + +- Fix rare exception in `lib/file.js` + +## v0.94.1 - 2016-05-26 + +- Make WebTorrent user agent string consistent across whole codebase + +## v0.94.0 - 2016-05-19 + +- Support exact source (xs) paramter of magnet URIs, for retreiving metadata + +## v0.93.4 - 2016-05-17 + +- Fix rare exception caused by race condition in `lib/peer.js` + +## v0.93.3 - 2016-05-13 + +- Don't unset `{tracker: {wrtc: false}}` option to `WebTorrent` constructor. + ## v0.93.2 - 2016-05-12 - When a duplicate torrent is added, don't emit the 'infoHash' event after 'error'. The 'error' event should be the last event. diff --git a/lib/torrent.js b/lib/torrent.js index 6d29c5e..e4bedef 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1574,9 +1574,7 @@ Torrent.prototype._checkDone = function () { if (!self.done && done) { self.done = true self._debug('torrent done: ' + self.infoHash) - if (self.discovery.tracker) { - self.discovery.tracker.complete() - } + self.discovery.complete() self.emit('done') } diff --git a/package.json b/package.json index f5b95a5..01a29f3 100644 --- a/package.json +++ b/package.json @@ -26,64 +26,64 @@ "url": "https://github.com/feross/webtorrent/issues" }, "dependencies": { - "addr-to-ip-port": "^1.0.1", - "bitfield": "^1.0.2", - "bittorrent-dht": "^7.0.0", - "bittorrent-protocol": "^2.0.0", - "chunk-store-stream": "^2.0.0", - "create-torrent": "^3.4.0", - "debug": "^2.1.0", - "end-of-stream": "^1.0.0", - "fs-chunk-store": "^1.3.4", + "addr-to-ip-port": "^1.4.2", + "bitfield": "^1.1.2", + "bittorrent-dht": "^7.2.2", + "bittorrent-protocol": "^2.1.5", + "chunk-store-stream": "^2.0.2", + "create-torrent": "^3.24.5", + "debug": "^2.2.0", + "end-of-stream": "^1.1.0", + "fs-chunk-store": "^1.6.2", "hat": "^0.0.3", - "immediate-chunk-store": "^1.0.7", + "immediate-chunk-store": "^1.0.8", "inherits": "^2.0.1", - "load-ip-set": "^1.0.3", + "load-ip-set": "^1.2.7", "memory-chunk-store": "^1.2.0", - "mime": "^1.2.11", - "multistream": "^2.0.2", - "package-json-versionify": "^1.0.1", - "parse-torrent": "^5.1.0", - "pump": "^1.0.0", + "mime": "^1.3.4", + "multistream": "^2.0.5", + "package-json-versionify": "^1.0.2", + "parse-torrent": "^5.8.0", + "pump": "^1.0.1", "random-iterate": "^1.0.1", - "range-parser": "^1.0.2", - "readable-stream": "^2.1.2", - "render-media": "^2.0.0", - "run-parallel": "^1.0.0", - "run-parallel-limit": "^1.0.2", - "safe-buffer": "^5.0.0", + "range-parser": "^1.2.0", + "readable-stream": "^2.1.4", + "render-media": "^2.6.0", + "run-parallel": "^1.1.6", + "run-parallel-limit": "^1.0.3", + "safe-buffer": "^5.0.1", "simple-concat": "^1.0.0", - "simple-get": "^2.0.0", - "simple-peer": "^6.0.0", - "simple-sha1": "^2.0.0", + "simple-get": "^2.2.1", + "simple-peer": "^6.0.4", + "simple-sha1": "^2.0.8", "speedometer": "^1.0.0", "stream-to-blob": "^1.0.0", - "stream-to-blob-url": "^2.0.0", + "stream-to-blob-url": "^2.1.0", "stream-with-known-length-to-buffer": "^1.0.0", - "torrent-discovery": "^8.0.0", - "torrent-piece": "^1.0.0", + "torrent-discovery": "^8.1.0", + "torrent-piece": "^1.1.0", "uniq": "^1.0.1", "unordered-array-remove": "^1.0.2", - "ut_metadata": "^3.0.2", - "ut_pex": "^1.0.1", - "xtend": "^4.0.0", - "zero-fill": "^2.2.0" + "ut_metadata": "^3.0.8", + "ut_pex": "^1.1.1", + "xtend": "^4.0.1", + "zero-fill": "^2.2.3" }, "devDependencies": { - "bittorrent-tracker": "^8.0.0", - "brfs": "^1.2.0", - "browserify": "^13.0.0", + "bittorrent-tracker": "^8.0.7", + "brfs": "^1.4.3", + "browserify": "^13.0.1", "cross-spawn": "^4.0.0", "electron-prebuilt": "^0.37.2", - "finalhandler": "^0.4.0", + "finalhandler": "^0.5.0", "network-address": "^1.1.0", - "run-series": "^1.0.2", - "serve-static": "^1.9.3", - "standard": "^7.0.0", - "tape": "^4.0.0", - "uglify-js": "^2.4.15", - "webtorrent-fixtures": "^1.0.0", - "zuul": "^3.0.0" + "run-series": "^1.1.4", + "serve-static": "^1.11.1", + "standard": "^7.1.2", + "tape": "^4.6.0", + "uglify-js": "^2.7.0", + "webtorrent-fixtures": "^1.5.0", + "zuul": "^3.10.1" }, "homepage": "https://webtorrent.io", "keywords": [ diff --git a/test/node/download-dht-magnet.js b/test/node/download-dht-magnet.js index 760bb26..f96a666 100644 --- a/test/node/download-dht-magnet.js +++ b/test/node/download-dht-magnet.js @@ -1,6 +1,7 @@ var DHT = require('bittorrent-dht/server') var fixtures = require('webtorrent-fixtures') var fs = require('fs') +var MemoryChunkStore = require('memory-chunk-store') var networkAddress = require('network-address') var series = require('run-series') var test = require('tape') @@ -34,7 +35,7 @@ test('Download using DHT (via magnet uri)', function (t) { client1.on('error', function (err) { t.fail(err) }) client1.on('warning', function (err) { t.fail(err) }) - var torrent = client1.add(fixtures.leaves.parsedTorrent) + var torrent = client1.add(fixtures.leaves.parsedTorrent, {store: MemoryChunkStore}) torrent.on('dhtAnnounce', function () { t.pass('finished dht announce') @@ -89,7 +90,7 @@ test('Download using DHT (via magnet uri)', function (t) { }) }) - client2.add(fixtures.leaves.magnetURI) + client2.add(fixtures.leaves.magnetURI, {store: MemoryChunkStore}) var gotBuffer = false var gotDone = false diff --git a/test/node/download-dht-torrent.js b/test/node/download-dht-torrent.js index 0bc6961..5182dd3 100644 --- a/test/node/download-dht-torrent.js +++ b/test/node/download-dht-torrent.js @@ -1,6 +1,7 @@ var DHT = require('bittorrent-dht/server') var fixtures = require('webtorrent-fixtures') var fs = require('fs') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var test = require('tape') var WebTorrent = require('../../') @@ -33,7 +34,7 @@ test('Download using DHT (via .torrent file)', function (t) { client1.on('error', function (err) { t.fail(err) }) client1.on('warning', function (err) { t.fail(err) }) - var torrent = client1.add(fixtures.leaves.parsedTorrent) + var torrent = client1.add(fixtures.leaves.parsedTorrent, {store: MemoryChunkStore}) torrent.on('ready', function () { // torrent metadata has been fetched -- sanity check it @@ -99,7 +100,7 @@ test('Download using DHT (via .torrent file)', function (t) { } }) - client2.add(fixtures.leaves.parsedTorrent) + client2.add(fixtures.leaves.parsedTorrent, {store: MemoryChunkStore}) } ], function (err) { t.error(err) diff --git a/test/node/download-metadata.js b/test/node/download-metadata.js index 36e7f89..1972f2e 100644 --- a/test/node/download-metadata.js +++ b/test/node/download-metadata.js @@ -1,5 +1,6 @@ var fixtures = require('webtorrent-fixtures') var http = require('http') +var MemoryChunkStore = require('memory-chunk-store') var test = require('tape') var WebTorrent = require('../../') @@ -32,7 +33,7 @@ test('Download metadata for magnet URI with xs parameter', function (t) { createServer(fixtures.leaves.torrent, function (url, server) { var encodedUrl = encodeURIComponent(url) - client.add(fixtures.leaves.magnetURI + '&xs=' + encodedUrl, function (torrent) { + client.add(fixtures.leaves.magnetURI + '&xs=' + encodedUrl, {store: MemoryChunkStore}, function (torrent) { t.equal(torrent.files[0].name, 'Leaves of Grass by Walt Whitman.epub') client.destroy(function (err) { t.error(err, 'client destroyed') }) server.close(function () { t.pass('server closed') }) @@ -56,7 +57,7 @@ test('Download metadata for magnet URI with 2 xs parameters', function (t) { var uri = fixtures.leaves.magnetURI + '&xs=' + encodedUrl1 + '&xs=' + encodedUrl2 - client.add(uri, function (torrent) { + client.add(uri, {store: MemoryChunkStore}, function (torrent) { t.equal(torrent.files[0].name, 'Leaves of Grass by Walt Whitman.epub') client.destroy(function (err) { t.error(err, 'client destroyed') }) server1.close(function () { t.pass('server closed') }) @@ -79,7 +80,7 @@ test('Download metadata for magnet URI with 2 xs parameters, with 1 invalid prot var encodedUrl2 = encodeURIComponent(url) var uri = fixtures.leaves.magnetURI + '&xs=' + encodedUrl1 + '&xs=' + encodedUrl2 - client.add(uri, function (torrent) { + client.add(uri, {store: MemoryChunkStore}, function (torrent) { t.equal(torrent.files[0].name, 'Leaves of Grass by Walt Whitman.epub') client.destroy(function (err) { t.error(err, 'client destroyed') }) server.close(function () { t.pass('server closed') }) @@ -100,7 +101,7 @@ test('Download metadata for magnet URI with 2 xs parameters, with 1 404 URL', fu var encodedUrl2 = encodeURIComponent(url) var uri = fixtures.leaves.magnetURI + '&xs=' + encodedUrl1 + '&xs=' + encodedUrl2 - client.add(uri, function (torrent) { + client.add(uri, {store: MemoryChunkStore}, function (torrent) { t.equal(torrent.files[0].name, 'Leaves of Grass by Walt Whitman.epub') client.destroy(function (err) { t.error(err, 'client destroyed') }) server.close(function () { t.pass('server closed') }) @@ -116,7 +117,7 @@ test('Download metadata magnet URI with unsupported protocol in xs parameter', f client.on('error', function (err) { t.fail(err) }) client.on('warning', function (err) { t.fail(err) }) - client.add(fixtures.leaves.magnetURI + '&xs=' + encodeURIComponent('invalidurl:example')) + client.add(fixtures.leaves.magnetURI + '&xs=' + encodeURIComponent('invalidurl:example'), {store: MemoryChunkStore}) setTimeout(function () { // no crash by now diff --git a/test/node/download-private-dht.js b/test/node/download-private-dht.js index 0f1a984..8a49798 100644 --- a/test/node/download-private-dht.js +++ b/test/node/download-private-dht.js @@ -1,5 +1,6 @@ var DHT = require('bittorrent-dht/server') var fixtures = require('webtorrent-fixtures') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var test = require('tape') var WebTorrent = require('../../') @@ -28,7 +29,7 @@ test('private torrent should not use DHT', function (t) { client.on('error', function (err) { t.fail(err) }) client.on('warning', function (err) { t.fail(err) }) - var torrent = client.add(fixtures.bunny.parsedTorrent) + var torrent = client.add(fixtures.bunny.parsedTorrent, {store: MemoryChunkStore}) torrent.on('dhtAnnounce', function () { t.fail('client announced to dht') @@ -76,7 +77,7 @@ test('public torrent should use DHT', function (t) { client.on('error', function (err) { t.fail(err) }) client.on('warning', function (err) { t.fail(err) }) - var torrent = client.add(fixtures.leaves.parsedTorrent) + var torrent = client.add(fixtures.leaves.parsedTorrent, {store: MemoryChunkStore}) torrent.on('dhtAnnounce', function () { t.pass('client announced to dht') diff --git a/test/node/download-tracker-magnet.js b/test/node/download-tracker-magnet.js index 7224895..9ffa233 100644 --- a/test/node/download-tracker-magnet.js +++ b/test/node/download-tracker-magnet.js @@ -1,6 +1,7 @@ var extend = require('xtend') var fixtures = require('webtorrent-fixtures') var fs = require('fs') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var test = require('tape') var TrackerServer = require('bittorrent-tracker/server') @@ -59,7 +60,7 @@ function magnetDownloadTest (t, serverType) { 'Leaves of Grass by Walt Whitman.epub' ] - torrent.on('noPeers', function (announceType) { + torrent.once('noPeers', function (announceType) { t.equal(announceType, 'tracker', 'noPeers event seen with correct announceType') }) @@ -70,7 +71,7 @@ function magnetDownloadTest (t, serverType) { }) }) - client1.add(parsedTorrent) + client1.add(parsedTorrent, {store: MemoryChunkStore}) }, function (cb) { @@ -102,7 +103,7 @@ function magnetDownloadTest (t, serverType) { } }) - client2.add(magnetURI) + client2.add(magnetURI, {store: MemoryChunkStore}) } ], function (err) { diff --git a/test/node/download-tracker-torrent.js b/test/node/download-tracker-torrent.js index c9068c5..a2ba8e0 100644 --- a/test/node/download-tracker-torrent.js +++ b/test/node/download-tracker-torrent.js @@ -1,6 +1,7 @@ var extend = require('xtend') var fixtures = require('webtorrent-fixtures') var fs = require('fs') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var test = require('tape') var TrackerServer = require('bittorrent-tracker/server') @@ -65,7 +66,7 @@ function torrentDownloadTest (t, serverType) { torrent.load(fs.createReadStream(fixtures.leaves.contentPath), cb) }) - client1.add(parsedTorrent) + client1.add(parsedTorrent, {store: MemoryChunkStore}) }, function (cb) { @@ -73,7 +74,7 @@ function torrentDownloadTest (t, serverType) { client2.on('error', function (err) { t.fail(err) }) client2.on('warning', function (err) { t.fail(err) }) - client2.add(parsedTorrent) + client2.add(parsedTorrent, {store: MemoryChunkStore}) client2.on('torrent', function (torrent) { torrent.files.forEach(function (file) { diff --git a/test/node/download-webseed-magnet.js b/test/node/download-webseed-magnet.js index e0d39bf..2f172a0 100644 --- a/test/node/download-webseed-magnet.js +++ b/test/node/download-webseed-magnet.js @@ -2,6 +2,7 @@ var finalhandler = require('finalhandler') var fixtures = require('webtorrent-fixtures') var http = require('http') var path = require('path') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var serveStatic = require('serve-static') var test = require('tape') @@ -10,7 +11,7 @@ var WebTorrent = require('../../') test('Download using webseed (via magnet uri)', function (t) { t.plan(9) - var serve = serveStatic(path.join(__dirname, 'content')) + var serve = serveStatic(path.dirname(fixtures.leaves.contentPath)) var httpServer = http.createServer(function (req, res) { var done = finalhandler(req, res) serve(req, res, done) @@ -51,7 +52,7 @@ test('Download using webseed (via magnet uri)', function (t) { maybeDone() }) - var torrent = client1.add(fixtures.leaves.parsedTorrent) + var torrent = client1.add(fixtures.leaves.parsedTorrent, {store: MemoryChunkStore}) torrent.on('infoHash', function () { gotListening = true @@ -91,7 +92,7 @@ test('Download using webseed (via magnet uri)', function (t) { } }) - var torrent = client2.add(magnetURI) + var torrent = client2.add(magnetURI, {store: MemoryChunkStore}) torrent.on('infoHash', function () { torrent.addPeer('127.0.0.1:' + client1.address().port) diff --git a/test/node/download-webseed-torrent.js b/test/node/download-webseed-torrent.js index e80ae05..4c23319 100644 --- a/test/node/download-webseed-torrent.js +++ b/test/node/download-webseed-torrent.js @@ -2,6 +2,7 @@ var extend = require('xtend') var finalhandler = require('finalhandler') var fixtures = require('webtorrent-fixtures') var http = require('http') +var MemoryChunkStore = require('memory-chunk-store') var path = require('path') var series = require('run-series') var serveStatic = require('serve-static') @@ -15,7 +16,7 @@ test('Download using webseed (via .torrent file)', function (t) { var httpServer = http.createServer(function (req, res) { var done = finalhandler(req, res) - serveStatic(path.join(__dirname, 'content'))(req, res, done) + serveStatic(path.dirname(fixtures.leaves.contentPath))(req, res, done) }) var client @@ -59,7 +60,7 @@ test('Download using webseed (via .torrent file)', function (t) { } }) - client.add(parsedTorrent) + client.add(parsedTorrent, {store: MemoryChunkStore}) } ], function (err) { t.error(err) diff --git a/test/node/seed-while-download.js b/test/node/seed-while-download.js index 8cb32e4..0581064 100644 --- a/test/node/seed-while-download.js +++ b/test/node/seed-while-download.js @@ -1,6 +1,7 @@ var DHT = require('bittorrent-dht/server') var fixtures = require('webtorrent-fixtures') var fs = require('fs') +var MemoryChunkStore = require('memory-chunk-store') var series = require('run-series') var test = require('tape') var WebTorrent = require('../../') @@ -29,7 +30,7 @@ test('Seed and download a file at the same time', function (t) { client1.on('error', function (err) { t.fail(err) }) client1.on('warning', function (err) { t.fail(err) }) - var torrent = client1.add(fixtures.leaves.torrent) + var torrent = client1.add(fixtures.leaves.torrent, {store: MemoryChunkStore}) torrent.on('dhtAnnounce', function () { t.pass('client1 finished dht announce') @@ -60,7 +61,7 @@ test('Seed and download a file at the same time', function (t) { client2.on('error', function (err) { t.fail(err) }) client2.on('warning', function (err) { t.fail(err) }) - var torrent = client2.add(fixtures.alice.torrent) + var torrent = client2.add(fixtures.alice.torrent, {store: MemoryChunkStore}) torrent.on('dhtAnnounce', function () { t.pass('client2 finished dht announce') @@ -82,7 +83,7 @@ test('Seed and download a file at the same time', function (t) { }, function (cb) { - client1.add(fixtures.alice.magnetURI) + client1.add(fixtures.alice.magnetURI, {store: MemoryChunkStore}) client1.on('torrent', function (torrent) { torrent.files[0].getBuffer(function (err, buf) { @@ -99,7 +100,7 @@ test('Seed and download a file at the same time', function (t) { }) }) - client2.add(fixtures.leaves.magnetURI) + client2.add(fixtures.leaves.magnetURI, {store: MemoryChunkStore}) client2.on('torrent', function (torrent) { torrent.files[0].getBuffer(function (err, buf) { |