From 0aa477ce54752123bd8c16317e609fa09d3870ca Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 7 May 2009 20:27:07 +0000 Subject: [PATCH] handle web seed urls that don't end with / when they should --- src/web_peer_connection.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index cabdf9323..6e11a7fa9 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -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();