mirror of https://github.com/aria2/aria2
2009-12-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that query parameter in magnet URI is not decoded. * src/magnet.cc * test/MagnetTest.ccpull/1/head
parent
58bb1fa266
commit
8cd1d845f2
|
@ -1,3 +1,9 @@
|
|||
2009-12-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Fixed the bug that query parameter in magnet URI is not decoded.
|
||||
* src/magnet.cc
|
||||
* test/MagnetTest.cc
|
||||
|
||||
2009-12-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Specified defaultSize as an argument for easy testing.
|
||||
|
|
|
@ -53,11 +53,12 @@ BDE parse(const std::string& magnet)
|
|||
i != queries.end(); ++i) {
|
||||
std::pair<std::string, std::string> kv;
|
||||
util::split(kv, *i, '=');
|
||||
std::string value = util::urldecode(kv.second);
|
||||
if(dict.containsKey(kv.first)) {
|
||||
dict[kv.first] << kv.second;
|
||||
dict[kv.first] << value;
|
||||
} else {
|
||||
BDE list = BDE::list();
|
||||
list << kv.second;
|
||||
list << value;
|
||||
dict[kv.first] = list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ void MagnetTest::testParse()
|
|||
{
|
||||
BDE r = parse
|
||||
("magnet:?xt=urn:btih:248d0a1cd08284299de78d5c1ed359bb46717d8c&dn=aria2"
|
||||
"&tr=http://tracker1&tr=http://tracker2");
|
||||
"&tr=http%3A%2F%2Ftracker1&tr=http://tracker2");
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(std::string("urn:btih:248d0a1cd08284299de78d5c1ed359bb46717d8c"),
|
||||
r["xt"][0].s());
|
||||
|
|
Loading…
Reference in New Issue