summaryrefslogtreecommitdiff
path: root/src/HttpSkipResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-17 09:09:31 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-17 09:09:31 +0000
commitd4b29c84fcfdd893b4a19ac468c1152d94ddc5a4 (patch)
tree07159eeb85d77a434418c36d83bb12f058d2f626 /src/HttpSkipResponseCommand.cc
parenta79e7a5fd58672be2ab371b895565b519cc8bc95 (diff)
2008-06-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Cancel download if http redirect is bounded more than 20 times. * src/AbstractCommand.cc * src/HttpSkipResponseCommand.cc * src/Request.cc * src/Request.h * test/RequestTest.cc
Diffstat (limited to 'src/HttpSkipResponseCommand.cc')
-rw-r--r--src/HttpSkipResponseCommand.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/HttpSkipResponseCommand.cc b/src/HttpSkipResponseCommand.cc
index 6272b09a..8e6dafc9 100644
--- a/src/HttpSkipResponseCommand.cc
+++ b/src/HttpSkipResponseCommand.cc
@@ -129,6 +129,11 @@ bool HttpSkipResponseCommand::executeInternal()
bool HttpSkipResponseCommand::processResponse()
{
if(_httpResponse->isRedirect()) {
+ unsigned int rnum =
+ _httpResponse->getHttpRequest()->getRequest()->getRedirectCount();
+ if(rnum >= Request::MAX_REDIRECT) {
+ throw DlAbortEx(StringFormat("Too many redirects: count=%u", rnum).str());
+ }
_httpResponse->processRedirect();
logger->info(MSG_REDIRECT, cuid, _httpResponse->getRedirectURI().c_str());
return prepareForRetry(0);