mirror of https://github.com/aria2/aria2
2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
In Magnet URI with tr parameter, put each announce URI in separate tier. * src/bittorrent_helper.cc * test/BittorrentHelperTest.ccpull/1/head
parent
6939be2765
commit
5f082a9ff4
|
@ -1,3 +1,10 @@
|
|||
2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
In Magnet URI with tr parameter, put each announce URI in separate
|
||||
tier.
|
||||
* src/bittorrent_helper.cc
|
||||
* test/BittorrentHelperTest.cc
|
||||
|
||||
2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Renamed ExtensionMessage::getBencodedData() as
|
||||
|
|
|
@ -881,7 +881,13 @@ BDE parseMagnet(const std::string& magnet)
|
|||
}
|
||||
BDE announceList = BDE::list();
|
||||
if(r.containsKey("tr")) {
|
||||
announceList << r["tr"];
|
||||
const BDE& uris = r["tr"];
|
||||
for(BDE::List::const_iterator i = uris.listBegin(); i != uris.listEnd();
|
||||
++i) {
|
||||
BDE tier = BDE::list();
|
||||
tier << *i;
|
||||
announceList << tier;
|
||||
}
|
||||
}
|
||||
std::string name = "[METADATA]";
|
||||
if(r.containsKey("dn") && r["dn"].size()) {
|
||||
|
|
|
@ -712,10 +712,11 @@ void BittorrentHelperTest::testParseMagnet()
|
|||
util::toHex(attrs[bittorrent::INFO_HASH].s()));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("[METADATA]aria2"),
|
||||
attrs[bittorrent::NAME].s());
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)2, attrs[bittorrent::ANNOUNCE_LIST].size());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("http://tracker1"),
|
||||
attrs[bittorrent::ANNOUNCE_LIST][0][0].s());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("http://tracker2"),
|
||||
attrs[bittorrent::ANNOUNCE_LIST][0][1].s());
|
||||
attrs[bittorrent::ANNOUNCE_LIST][1][0].s());
|
||||
|
||||
magnet = "magnet:?xt=urn:btih:248d0a1cd08284299de78d5c1ed359bb46717d8c";
|
||||
attrs = bittorrent::parseMagnet(magnet);
|
||||
|
|
Loading…
Reference in New Issue