Merge remote-tracking branch 'upstream/master'

This commit is contained in:
fisch0920 2014-05-15 06:31:58 -04:00
commit 6857b65d0b
3 changed files with 4 additions and 6 deletions

View File

@ -36,8 +36,7 @@ module.exports = function (metadata) {
// if buffer fails to decode or there is no info key, then metadata is corrupt
info = bncode.encode(bncode.decode(metadata).info)
} catch (err) {
// TODO: throw or disregard invalid metadata?
//throw new Error('ut_metadata constructed with invalid metadata')
throw new Error('`ut_metadata` constructed with corrupt/invalid metadata')
}
if (info)

View File

@ -1,7 +1,7 @@
{
"name": "ut_metadata",
"description": "Extension for Peers to Send Metadata Files (BEP 9)",
"version": "1.4.0",
"version": "2.0.1",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",

View File

@ -142,7 +142,7 @@ test('discard invalid metadata', function (t) {
wire1.pipe(wire2).pipe(wire1)
var invalidMetadata = metadata.slice(0)
invalidMetadata[0] = 99 // mess up the first byte of the metadata
invalidMetadata[55] = 65 // mess up a byte in the info block
wire1.use(ut_metadata(invalidMetadata))
wire2.use(ut_metadata())
@ -163,4 +163,3 @@ test('discard invalid metadata', function (t) {
wire1.handshake(parsedTorrent.infoHash, id1)
})