summaryrefslogtreecommitdiff
path: root/src/HttpSkipResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-17 21:19:45 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-17 21:19:45 +0900
commitf2a63fa06a931333ac2e4a3a5d36a56418b4b6cd (patch)
tree1a9114f36cdb32cfd5e0272b672f0c8d5b420cde /src/HttpSkipResponseCommand.cc
parent4824b09237e049ac7d912cdaa4a8a041eedd5dab (diff)
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.
Diffstat (limited to 'src/HttpSkipResponseCommand.cc')
-rw-r--r--src/HttpSkipResponseCommand.cc10
1 files changed, 10 insertions, 0 deletions
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);