summaryrefslogtreecommitdiffstats
path: root/net/http/http_cache_transaction.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/http/http_cache_transaction.cc')
-rw-r--r--net/http/http_cache_transaction.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index b829623..32808e8 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -548,6 +548,11 @@ bool HttpCache::Transaction::AddTruncatedFlag() {
if (!entry_->disk_entry->GetDataSize(kResponseContentIndex))
return false;
+ if (response_.headers->GetContentLength() <= 0 ||
+ response_.headers->HasHeaderValue("Accept-Ranges", "none") ||
+ !response_.headers->HasStrongValidators())
+ return false;
+
truncated_ = true;
target_state_ = STATE_NONE;
next_state_ = STATE_CACHE_WRITE_TRUNCATED_RESPONSE;
@@ -1142,7 +1147,7 @@ bool HttpCache::Transaction::ConditionalizeRequest() {
custom_request_->extra_headers.append("\r\n");
// For byte-range requests, make sure that we use only one way to validate
// the request.
- if (partial_.get())
+ if (partial_.get() && !partial_->IsCurrentRangeCached())
return true;
}
@@ -1224,7 +1229,10 @@ bool HttpCache::Transaction::ValidatePartialResponse(
return true;
}
- // 304 is not expected here, but we'll spare the entry.
+ // 304 is not expected here, but we'll spare the entry (unless it was
+ // truncated).
+ if (truncated_)
+ failure = true;
}
if (failure) {