2009-07-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Don't append "/" if base URI ends with "/".
	* src/bittorrent_helper.cc
	* test/url-list-multiFile.torrent
pull/1/head
Tatsuhiro Tsujikawa 2009-06-30 17:20:34 +00:00
parent cf19dce855
commit 30b65f79e7
3 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2009-07-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Don't append "/" if base URI ends with "/".
* src/bittorrent_helper.cc
* test/url-list-multiFile.torrent
2009-07-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-07-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
HTTP pipelining is now working. Fixed Segmention fault in HTTP pipelining is now working. Fixed Segmention fault in

View File

@ -134,6 +134,21 @@ static void extractUrlList(std::vector<std::string>& uris, const BDE& bde)
} }
} }
template<typename InputIterator, typename OutputIterator>
static OutputIterator createUri
(InputIterator first, InputIterator last, OutputIterator out,
const std::string& filePath)
{
for(; first != last; ++first) {
if(Util::endsWith(*first, "/")) {
*out++ = (*first)+filePath;
} else {
*out++ = (*first)+"/"+filePath;
}
}
return out;
}
static void extractFileEntries static void extractFileEntries
(const SharedHandle<DownloadContext>& ctx, (const SharedHandle<DownloadContext>& ctx,
BDE& torrent, BDE& torrent,
@ -209,8 +224,7 @@ static void extractFileEntries
path = Util::joinPath(elements.begin(), elements.end()); path = Util::joinPath(elements.begin(), elements.end());
std::deque<std::string> uris; std::deque<std::string> uris;
std::transform(urlList.begin(), urlList.end(), std::back_inserter(uris), createUri(urlList.begin(), urlList.end(), std::back_inserter(uris), path);
std::bind2nd(std::plus<std::string>(), "/"+path));
SharedHandle<FileEntry> fileEntry SharedHandle<FileEntry> fileEntry
(new FileEntry(strconcat(ctx->getDir(), "/", path), (new FileEntry(strconcat(ctx->getDir(), "/", path),
fileLengthData.i(), fileLengthData.i(),

View File

@ -1 +1 @@
d8:url-listl21:http://localhost/dist18:http://mirror/diste8:announce36:http://aria.rednoah.com/announce.php13:announce-listll15:http://tracker1el15:http://tracker2el15:http://tracker3ee7:comment17:REDNOAH.COM RULES13:creation datei1123456789e4:infod5:filesld6:lengthi284e4:pathl5:aria23:src6:aria2ceed6:lengthi100e4:pathl19:aria2-0.2.2.tar.bz2eee4:name10:aria2-test12:piece lengthi128e6:pieces60:AAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCee d8:url-listl22:http://localhost/dist/18:http://mirror/diste8:announce36:http://aria.rednoah.com/announce.php13:announce-listll15:http://tracker1el15:http://tracker2el15:http://tracker3ee7:comment17:REDNOAH.COM RULES13:creation datei1123456789e4:infod5:filesld6:lengthi284e4:pathl5:aria23:src6:aria2ceed6:lengthi100e4:pathl19:aria2-0.2.2.tar.bz2eee4:name10:aria2-test12:piece lengthi128e6:pieces60:AAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCee