mirror of https://github.com/aria2/aria2
2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Made aria2 not send "application/metalink4+xml,application/metalink+xml" in Accept header for web-seeding URIs and tracker request. * src/Metalink2RequestGroup.cc * src/TrackerWatcherCommand.cc * src/download_helper.cc * src/util.cc * src/util.hpull/1/head
parent
d67f4cefac
commit
5cc28b2d80
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Made aria2 not send
|
||||
"application/metalink4+xml,application/metalink+xml" in Accept
|
||||
header for web-seeding URIs and tracker request.
|
||||
* src/Metalink2RequestGroup.cc
|
||||
* src/TrackerWatcherCommand.cc
|
||||
* src/download_helper.cc
|
||||
* src/util.cc
|
||||
* src/util.h
|
||||
|
||||
2010-04-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added download_helper.{cc,h} to SRCS
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "FileEntry.h"
|
||||
#include "A2STR.h"
|
||||
#include "a2functional.h"
|
||||
#include "DownloadHandlerConstants.h"
|
||||
#ifdef ENABLE_BITTORRENT
|
||||
# include "BtDependency.h"
|
||||
# include "download_helper.h"
|
||||
|
@ -124,18 +123,6 @@ Metalink2RequestGroup::generate
|
|||
createRequestGroup(groups, entries, option);
|
||||
}
|
||||
|
||||
namespace {
|
||||
void removeMetalinkContentTypes(const SharedHandle<RequestGroup>& group)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator i =
|
||||
DownloadHandlerConstants::getMetalinkContentTypes().begin(),
|
||||
eoi = DownloadHandlerConstants::getMetalinkContentTypes().end();
|
||||
i != eoi; ++i) {
|
||||
group->removeAcceptType(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Metalink2RequestGroup::createRequestGroup
|
||||
(std::vector<SharedHandle<RequestGroup> >& groups,
|
||||
|
@ -213,7 +200,7 @@ Metalink2RequestGroup::createRequestGroup
|
|||
torrentRg->clearPostDownloadHandler();
|
||||
// remove "metalink" from Accept Type list to avoid loop in
|
||||
// tranparent metalink
|
||||
removeMetalinkContentTypes(torrentRg);
|
||||
util::removeMetalinkContentTypes(torrentRg);
|
||||
// make it in-memory download
|
||||
SharedHandle<PreDownloadHandler> preh
|
||||
(new MemoryBufferPreDownloadHandler());
|
||||
|
@ -306,7 +293,7 @@ Metalink2RequestGroup::createRequestGroup
|
|||
rg->setDownloadContext(dctx);
|
||||
// remove "metalink" from Accept Type list to avoid loop in
|
||||
// tranparent metalink
|
||||
removeMetalinkContentTypes(rg);
|
||||
util::removeMetalinkContentTypes(rg);
|
||||
#ifdef ENABLE_BITTORRENT
|
||||
// Inject depenency between rg and torrentRg here if
|
||||
// torrentRg.isNull() == false
|
||||
|
|
|
@ -248,6 +248,7 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
|
|||
rg->setDiskWriterFactory(dwf);
|
||||
rg->setFileAllocationEnabled(false);
|
||||
rg->setPreLocalFileCheckEnabled(false);
|
||||
util::removeMetalinkContentTypes(rg);
|
||||
if(logger->info()) {
|
||||
logger->info("Creating tracker request group GID#%s",
|
||||
util::itos(rg->getGID()).c_str());
|
||||
|
|
|
@ -236,6 +236,9 @@ createBtRequestGroup(const std::string& torrentFilePath,
|
|||
((*i).first, util::applyDir(dctx->getDir(), (*i).second));
|
||||
}
|
||||
rg->setDownloadContext(dctx);
|
||||
// Remove "metalink" from Accept Type list to avoid server from
|
||||
// responding Metalink file for web-seeding URIs.
|
||||
util::removeMetalinkContentTypes(rg);
|
||||
return rg;
|
||||
}
|
||||
|
||||
|
|
12
src/util.cc
12
src/util.cc
|
@ -76,6 +76,8 @@
|
|||
#include "array_fun.h"
|
||||
#include "a2functional.h"
|
||||
#include "bitfield.h"
|
||||
#include "DownloadHandlerConstants.h"
|
||||
#include "RequestGroup.h"
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
# include "MessageDigestHelper.h"
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
|
@ -1291,6 +1293,16 @@ bool inSameCidrBlock(const std::string& ip1, const std::string& ip2, int bits)
|
|||
return in1.s_addr == in2.s_addr;
|
||||
}
|
||||
|
||||
void removeMetalinkContentTypes(const SharedHandle<RequestGroup>& group)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator i =
|
||||
DownloadHandlerConstants::getMetalinkContentTypes().begin(),
|
||||
eoi = DownloadHandlerConstants::getMetalinkContentTypes().end();
|
||||
i != eoi; ++i) {
|
||||
group->removeAcceptType(*i);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -62,6 +62,7 @@ class Randomizer;
|
|||
class BitfieldMan;
|
||||
class BinaryStream;
|
||||
class FileEntry;
|
||||
class RequestGroup;
|
||||
|
||||
#define STRTOLL(X) strtoll(X, reinterpret_cast<char**>(0), 10)
|
||||
#define STRTOULL(X) strtoull(X, reinterpret_cast<char**>(0), 10)
|
||||
|
@ -392,6 +393,8 @@ bool getCidrPrefix(struct in_addr& in, const std::string& ip, int bits);
|
|||
// Returns true if ip1 and ip2 are in the same CIDR block.
|
||||
bool inSameCidrBlock(const std::string& ip1, const std::string& ip2, int bits);
|
||||
|
||||
void removeMetalinkContentTypes(const SharedHandle<RequestGroup>& group);
|
||||
|
||||
} // namespace util
|
||||
|
||||
} // namespace aria2
|
||||
|
|
Loading…
Reference in New Issue