fixes problem with torrents that have a name.utf-8 entry

This commit is contained in:
Arvid Norberg 2007-09-24 18:51:04 +00:00
parent 6ad17a69a8
commit 020902ac4c
2 changed files with 19 additions and 3 deletions

View File

@ -400,9 +400,7 @@ namespace libtorrent
{
if (i->first == "pieces"
|| i->first == "piece length"
|| i->first == "length"
// || i->first == "files"
|| i->first == "name")
|| i->first == "length")
continue;
m_extra_info[i->first] = i->second;
}

View File

@ -3,6 +3,8 @@
#include "libtorrent/buffer.hpp"
#include "libtorrent/xml_parse.hpp"
#include "libtorrent/upnp.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/torrent_info.hpp"
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/bind.hpp>
@ -185,6 +187,22 @@ int test_main()
TEST_CHECK(is_local(address::from_string("192.168.0.1")));
TEST_CHECK(is_local(address::from_string("10.1.1.56")));
TEST_CHECK(!is_local(address::from_string("14.14.251.63")));
// test torrent parsing
entry info;
info["pieces"] = "aaaaaaaaaaaaaaaaaaaa";
info["name.utf-8"] = "test1";
info["name"] = "test__";
info["piece length"] = 16 * 1024;
info["length"] = 3245;
entry torrent;
torrent["info"] = info;
torrent_info ti(torrent);
TEST_CHECK(ti.name() == "test1");
return 0;
}