diff --git a/ChangeLog b/ChangeLog index ddddbe0b..f1c62920 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-03-08 Tatsuhiro Tsujikawa + + Don't reset URI in retry to avoid additional round trips because + of redirects. + * src/AbstractCommand.cc + * src/OptionHandlerFactory.cc + * src/prefs.cc + * src/prefs.h + 2009-03-08 Tatsuhiro Tsujikawa Declared hide() in OptionHandler. diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index fd0ca927..38908436 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -169,9 +169,12 @@ bool AbstractCommand::execute() { req->getTryCount() >= _requestGroup->getMaxTries(); if(isAbort) { onAbort(); + req->resetUrl(); + } else { + if(e->option->getAsBool(PREF_RESET_URI)) { + req->resetUrl(); + } } - // In case where Request::getCurrentUrl() is not a valid URI. - req->resetUrl(); if(isAbort) { logger->info(MSG_MAX_TRY, cuid, req->getTryCount()); logger->error(MSG_DOWNLOAD_ABORTED, err, cuid, req->getUrl().c_str()); diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 6b6ef14a..d00cb667 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -424,6 +424,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_HTTP); handlers.push_back(op); } + { + SharedHandle op(new BooleanOptionHandler + (PREF_RESET_URI, + NO_DESCRIPTION, + V_FALSE, + OptionHandler::OPT_ARG)); + op->hide(); + handlers.push_back(op); + } { SharedHandle op(new NumberOptionHandler (PREF_RETRY_WAIT, diff --git a/src/prefs.cc b/src/prefs.cc index 9306c127..7cc23d64 100644 --- a/src/prefs.cc +++ b/src/prefs.cc @@ -156,6 +156,8 @@ const std::string V_SELECT("select"); const std::string PREF_HTTP_SERVER_LISTEN_PORT("http-server-listen-port"); // value: true | false const std::string PREF_ENABLE_HTTP_SERVER("enable-http-server"); +// value: true | false +const std::string PREF_RESET_URI("reset-uri"); /** * FTP related preferences diff --git a/src/prefs.h b/src/prefs.h index 4a95b821..1cc1cca2 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -160,6 +160,8 @@ extern const std::string V_SELECT; extern const std::string PREF_HTTP_SERVER_LISTEN_PORT; // value: true | false extern const std::string PREF_ENABLE_HTTP_SERVER; +// value: true | false +extern const std::string PREF_RESET_URI; /** * FTP related preferences