From f2a63fa06a931333ac2e4a3a5d36a56418b4b6cd Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 17 Jan 2011 21:19:45 +0900 Subject: Added --retry-wait option. This option was once existed in aria2 but erased on 2009-09-20. Now it is resurrected once again. We choose 2 as default value, but there is no good theory behind it. Now we retry HTTP download when remote server returns 503 Service Unavailable if --retry-wait > 0. We also added error code 29: HTTP_SERVICE_UNAVAILABLE. --- src/HttpSkipResponseCommand.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/HttpSkipResponseCommand.cc') diff --git a/src/HttpSkipResponseCommand.cc b/src/HttpSkipResponseCommand.cc index 60b600d3..bf6db6e3 100644 --- a/src/HttpSkipResponseCommand.cc +++ b/src/HttpSkipResponseCommand.cc @@ -207,6 +207,16 @@ bool HttpSkipResponseCommand::processResponse() } else if(statusCode == 404) { throw DL_ABORT_EX2(MSG_RESOURCE_NOT_FOUND, error_code::RESOURCE_NOT_FOUND); + } else if(statusCode == 503) { + // Only retry if pretry-wait > 0. Hammering 'busy' server is not + // a good idea. + if(getOption()->getAsInt(PREF_RETRY_WAIT) > 0) { + throw DL_RETRY_EX2(fmt(EX_BAD_STATUS, statusCode), + error_code::HTTP_SERVICE_UNAVAILABLE); + } else { + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, statusCode), + error_code::HTTP_SERVICE_UNAVAILABLE); + } } else { throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, statusCode), error_code::HTTP_PROTOCOL_ERROR); -- cgit