mirror of https://github.com/aria2/aria2
2010-08-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug which prevents HTTP redirection from working when downloading multiple files from same host. * src/AbstractCommand.cc * src/FileEntry.ccpull/1/head
parent
3434be8110
commit
5cb09dabf5
|
@ -1,3 +1,10 @@
|
||||||
|
2010-08-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Fixed the bug which prevents HTTP redirection from working when
|
||||||
|
downloading multiple files from same host.
|
||||||
|
* src/AbstractCommand.cc
|
||||||
|
* src/FileEntry.cc
|
||||||
|
|
||||||
2010-08-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-08-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Release 1.10.1
|
Release 1.10.1
|
||||||
|
|
|
@ -285,6 +285,7 @@ bool AbstractCommand::execute() {
|
||||||
}
|
}
|
||||||
req_->addTryCount();
|
req_->addTryCount();
|
||||||
req_->resetRedirectCount();
|
req_->resetRedirectCount();
|
||||||
|
req_->resetUri();
|
||||||
const unsigned int maxTries = getOption()->getAsInt(PREF_MAX_TRIES);
|
const unsigned int maxTries = getOption()->getAsInt(PREF_MAX_TRIES);
|
||||||
bool isAbort = maxTries != 0 && req_->getTryCount() >= maxTries;
|
bool isAbort = maxTries != 0 && req_->getTryCount() >= maxTries;
|
||||||
if(isAbort) {
|
if(isAbort) {
|
||||||
|
|
|
@ -125,30 +125,10 @@ FileEntry::getRequest
|
||||||
const std::string& method)
|
const std::string& method)
|
||||||
{
|
{
|
||||||
SharedHandle<Request> req;
|
SharedHandle<Request> req;
|
||||||
Request r;
|
if(requestPool_.empty()) {
|
||||||
std::vector<std::string> inFlightHosts;
|
std::vector<std::string> inFlightHosts;
|
||||||
enumerateInFlightHosts(inFlightRequests_.begin(), inFlightRequests_.end(),
|
enumerateInFlightHosts(inFlightRequests_.begin(), inFlightRequests_.end(),
|
||||||
std::back_inserter(inFlightHosts));
|
std::back_inserter(inFlightHosts));
|
||||||
|
|
||||||
if(!requestPool_.empty()) {
|
|
||||||
for(std::deque<SharedHandle<Request> >::iterator i = requestPool_.begin(),
|
|
||||||
eoi = requestPool_.end(); i != eoi; ++i) {
|
|
||||||
r.setUri((*i)->getUri());
|
|
||||||
if(findSecond(usedHosts.begin(), usedHosts.end(), r.getHost()) !=
|
|
||||||
usedHosts.end()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(std::count(inFlightHosts.begin(), inFlightHosts.end(), r.getHost())
|
|
||||||
>= static_cast<int>(maxConnectionPerServer_)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
req = *i;
|
|
||||||
requestPool_.erase(i);
|
|
||||||
inFlightRequests_.push_back(req);
|
|
||||||
return req;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int g = 0; g < 2; ++g) {
|
for(int g = 0; g < 2; ++g) {
|
||||||
std::vector<std::string> pending;
|
std::vector<std::string> pending;
|
||||||
std::vector<std::string> ignoreHost;
|
std::vector<std::string> ignoreHost;
|
||||||
|
@ -159,7 +139,8 @@ FileEntry::getRequest
|
||||||
}
|
}
|
||||||
req.reset(new Request());
|
req.reset(new Request());
|
||||||
if(req->setUri(uri)) {
|
if(req->setUri(uri)) {
|
||||||
if(std::count(inFlightHosts.begin(), inFlightHosts.end(),req->getHost())
|
if(std::count(inFlightHosts.begin(),
|
||||||
|
inFlightHosts.end(),req->getHost())
|
||||||
>= static_cast<int>(maxConnectionPerServer_)) {
|
>= static_cast<int>(maxConnectionPerServer_)) {
|
||||||
pending.push_back(uri);
|
pending.push_back(uri);
|
||||||
ignoreHost.push_back(req->getHost());
|
ignoreHost.push_back(req->getHost());
|
||||||
|
@ -176,7 +157,6 @@ FileEntry::getRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uris_.insert(uris_.begin(), pending.begin(), pending.end());
|
uris_.insert(uris_.begin(), pending.begin(), pending.end());
|
||||||
// TODO UriReuse is performed only when PREF_REUSE_URI is true.
|
|
||||||
if(g == 0 && uriReuse && req.isNull() && uris_.size() == pending.size()) {
|
if(g == 0 && uriReuse && req.isNull() && uris_.size() == pending.size()) {
|
||||||
// Reuse URIs other than ones in pending
|
// Reuse URIs other than ones in pending
|
||||||
reuseUri(ignoreHost);
|
reuseUri(ignoreHost);
|
||||||
|
@ -184,19 +164,12 @@ FileEntry::getRequest
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(req.isNull()) {
|
} else {
|
||||||
Request r;
|
req = requestPool_.front();
|
||||||
for(std::deque<SharedHandle<Request> >::iterator i = requestPool_.begin(),
|
requestPool_.pop_front();
|
||||||
eoi = requestPool_.end(); i != eoi; ++i) {
|
|
||||||
r.setUri((*i)->getUri());
|
|
||||||
if(std::count(inFlightHosts.begin(), inFlightHosts.end(), r.getHost())
|
|
||||||
>= static_cast<int>(maxConnectionPerServer_)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
req = *i;
|
|
||||||
requestPool_.erase(i);
|
|
||||||
inFlightRequests_.push_back(req);
|
inFlightRequests_.push_back(req);
|
||||||
return req;
|
if(logger_->debug()) {
|
||||||
|
logger_->debug("Picked up from pool: %s", req->getUri().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return req;
|
return req;
|
||||||
|
|
Loading…
Reference in New Issue