summaryrefslogtreecommitdiff
path: root/src/HttpResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-29 23:19:10 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-29 23:19:10 +0900
commit1b9329c67c3fdacba048b529a6ad4245b8cefb0c (patch)
treee5773f88fe11b53a79684eb83354d72bb1cd1f84 /src/HttpResponseCommand.cc
parent7a6ec762ef44376d209ab20275dd78d468d7af3e (diff)
Accept HTTP 304 reply as success when If-None-Match request-header
field is specified using --header option. When --conditional-get is used, --allow-overwrite is now required to overwrite existing file.
Diffstat (limited to 'src/HttpResponseCommand.cc')
-rw-r--r--src/HttpResponseCommand.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc
index bb03659d..aa7afd42 100644
--- a/src/HttpResponseCommand.cc
+++ b/src/HttpResponseCommand.cc
@@ -174,26 +174,22 @@ bool HttpResponseCommand::executeInternal()
}
int statusCode = httpResponse->getStatusCode();
- if(!httpResponse->getHttpRequest()->getIfModifiedSinceHeader().empty()) {
- if(statusCode == 304) {
- uint64_t totalLength = httpResponse->getEntityLength();
- getFileEntry()->setLength(totalLength);
- getRequestGroup()->initPieceStorage();
- getPieceStorage()->markAllPiecesDone();
- // Just set checksum verification done.
- getDownloadContext()->setChecksumVerified(true);
- A2_LOG_NOTICE(fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
- util::itos(getRequestGroup()->getGID()).c_str(),
- getRequestGroup()->getFirstFilePath().c_str()));
- poolConnection();
- getFileEntry()->poolRequest(getRequest());
- return true;
- } else if(statusCode == 200 || statusCode == 206) {
- // Remote file is newer than local file. We allow overwrite.
- getOption()->put(PREF_ALLOW_OVERWRITE, A2_V_TRUE);
- }
+
+ if(statusCode == 304) {
+ uint64_t totalLength = httpResponse->getEntityLength();
+ getFileEntry()->setLength(totalLength);
+ getRequestGroup()->initPieceStorage();
+ getPieceStorage()->markAllPiecesDone();
+ // Just set checksum verification done.
+ getDownloadContext()->setChecksumVerified(true);
+ A2_LOG_NOTICE(fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
+ util::itos(getRequestGroup()->getGID()).c_str(),
+ getRequestGroup()->getFirstFilePath().c_str()));
+ poolConnection();
+ getFileEntry()->poolRequest(getRequest());
+ return true;
}
- if(statusCode != 304 && statusCode >= 300) {
+ if(statusCode >= 300) {
if(statusCode == 404) {
getRequestGroup()->increaseAndValidateFileNotFoundCount();
}