2009-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

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
pull/1/head
Tatsuhiro Tsujikawa 2009-03-08 08:22:00 +00:00
parent 1c4e7d39d4
commit c2447e3094
5 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2009-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
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 <t-tujikawa@users.sourceforge.net>
Declared hide() in OptionHandler.

View File

@ -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());

View File

@ -424,6 +424,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP);
handlers.push_back(op);
}
{
SharedHandle<OptionHandler> op(new BooleanOptionHandler
(PREF_RESET_URI,
NO_DESCRIPTION,
V_FALSE,
OptionHandler::OPT_ARG));
op->hide();
handlers.push_back(op);
}
{
SharedHandle<OptionHandler> op(new NumberOptionHandler
(PREF_RETRY_WAIT,

View File

@ -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

View File

@ -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