mirror of https://github.com/aria2/aria2
Cleanup
parent
8512fe992e
commit
bc1c9cae00
|
@ -188,7 +188,6 @@ void HttpSkipResponseCommand::poolConnection() const
|
||||||
|
|
||||||
bool HttpSkipResponseCommand::processResponse()
|
bool HttpSkipResponseCommand::processResponse()
|
||||||
{
|
{
|
||||||
int statusCode;
|
|
||||||
if(httpResponse_->isRedirect()) {
|
if(httpResponse_->isRedirect()) {
|
||||||
int rnum =
|
int rnum =
|
||||||
httpResponse_->getHttpRequest()->getRequest()->getRedirectCount();
|
httpResponse_->getHttpRequest()->getRequest()->getRedirectCount();
|
||||||
|
@ -198,42 +197,43 @@ bool HttpSkipResponseCommand::processResponse()
|
||||||
}
|
}
|
||||||
httpResponse_->processRedirect();
|
httpResponse_->processRedirect();
|
||||||
return prepareForRetry(0);
|
return prepareForRetry(0);
|
||||||
} else if((statusCode = httpResponse_->getStatusCode()) >= 400) {
|
}
|
||||||
if(statusCode == 401) {
|
|
||||||
if(getOption()->getAsBool(PREF_HTTP_AUTH_CHALLENGE) &&
|
auto statusCode = httpResponse_->getStatusCode();
|
||||||
!httpResponse_->getHttpRequest()->authenticationUsed() &&
|
if (statusCode >= 400) {
|
||||||
getDownloadEngine()->getAuthConfigFactory()->activateBasicCred
|
switch (statusCode) {
|
||||||
(getRequest()->getHost(), getRequest()->getPort(),
|
case 401:
|
||||||
getRequest()->getDir(), getOption().get())) {
|
if (getOption()->getAsBool(PREF_HTTP_AUTH_CHALLENGE) &&
|
||||||
|
!httpResponse_->getHttpRequest()->authenticationUsed() &&
|
||||||
|
getDownloadEngine()->getAuthConfigFactory()->activateBasicCred(
|
||||||
|
getRequest()->getHost(), getRequest()->getPort(),
|
||||||
|
getRequest()->getDir(), getOption().get())) {
|
||||||
return prepareForRetry(0);
|
return prepareForRetry(0);
|
||||||
} else {
|
|
||||||
throw DL_ABORT_EX2(EX_AUTH_FAILED,
|
|
||||||
error_code::HTTP_AUTH_FAILED);
|
|
||||||
}
|
}
|
||||||
} else if(statusCode == 404) {
|
throw DL_ABORT_EX2(EX_AUTH_FAILED, error_code::HTTP_AUTH_FAILED);
|
||||||
if(getOption()->getAsInt(PREF_MAX_FILE_NOT_FOUND) == 0) {
|
case 404:
|
||||||
|
if (getOption()->getAsInt(PREF_MAX_FILE_NOT_FOUND) == 0) {
|
||||||
throw DL_ABORT_EX2(MSG_RESOURCE_NOT_FOUND,
|
throw DL_ABORT_EX2(MSG_RESOURCE_NOT_FOUND,
|
||||||
error_code::RESOURCE_NOT_FOUND);
|
error_code::RESOURCE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
throw DL_RETRY_EX2(MSG_RESOURCE_NOT_FOUND,
|
throw DL_RETRY_EX2(MSG_RESOURCE_NOT_FOUND,
|
||||||
error_code::RESOURCE_NOT_FOUND);
|
error_code::RESOURCE_NOT_FOUND);
|
||||||
} else if(statusCode == 503) {
|
case 503:
|
||||||
// Only retry if pretry-wait > 0. Hammering 'busy' server is not
|
// Only retry if pretry-wait > 0. Hammering 'busy' server is not
|
||||||
// a good idea.
|
// a good idea.
|
||||||
if(getOption()->getAsInt(PREF_RETRY_WAIT) > 0) {
|
if (getOption()->getAsInt(PREF_RETRY_WAIT) > 0) {
|
||||||
throw DL_RETRY_EX2(fmt(EX_BAD_STATUS, statusCode),
|
throw DL_RETRY_EX2(fmt(EX_BAD_STATUS, statusCode),
|
||||||
error_code::HTTP_SERVICE_UNAVAILABLE);
|
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),
|
throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, statusCode),
|
||||||
error_code::HTTP_PROTOCOL_ERROR);
|
error_code::HTTP_SERVICE_UNAVAILABLE);
|
||||||
}
|
};
|
||||||
} else {
|
|
||||||
return prepareForRetry(0);
|
throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, statusCode),
|
||||||
|
error_code::HTTP_PROTOCOL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return prepareForRetry(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSkipResponseCommand::disableSocketCheck()
|
void HttpSkipResponseCommand::disableSocketCheck()
|
||||||
|
|
Loading…
Reference in New Issue