handle web seed urls that don't end with / when they should

This commit is contained in:
Arvid Norberg 2009-05-07 20:27:07 +00:00
parent a961e253ef
commit 0aa477ce54
1 changed files with 8 additions and 3 deletions

View File

@ -162,9 +162,14 @@ namespace libtorrent
TORRENT_ASSERT(t->valid_metadata());
bool single_file_request = false;
if (!m_path.empty() && m_path[m_path.size() - 1] != '/')
single_file_request = true;
bool single_file_request = t->torrent_file().num_files() == 1;
// handle incorrect .torrent files which are multi-file
// but have web seeds not ending with a slash
if (!single_file_request && (m_path.empty() || m_path[m_path.size() - 1] != '/'))
{
m_path += "/";
}
torrent_info const& info = t->torrent_file();