summaryrefslogtreecommitdiffstats
path: root/net/http/partial_data.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-30 23:15:20 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-30 23:15:20 +0000
commit9f03cb7a90e6258a3c240918bc411855fd4beb9a (patch)
tree357ef5bc753ee3e19a791a2a9562c304c6c5d433 /net/http/partial_data.cc
parent913069ad07a4a37ca919507b4204f3cbea1fb3bb (diff)
downloadchromium_src-9f03cb7a90e6258a3c240918bc411855fd4beb9a.zip
chromium_src-9f03cb7a90e6258a3c240918bc411855fd4beb9a.tar.gz
chromium_src-9f03cb7a90e6258a3c240918bc411855fd4beb9a.tar.bz2
Http cache: Make sure that issuing a byte range request
does not prevent caching of responses that are not 200, and does not delete the cached response if not really needed. For example, we should be able to cache redirects when the request is made using a byte range. BUG=134267 TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/10829069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/partial_data.cc')
-rw-r--r--net/http/partial_data.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index eb0239d..0e095ad 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -242,9 +242,6 @@ bool PartialData::UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
disk_cache::Entry* entry,
bool truncated) {
resource_size_ = 0;
- if (!headers->HasStrongValidators())
- return false;
-
if (truncated) {
DCHECK_EQ(headers->response_code(), 200);
// We don't have the real length and the user may be trying to create a
@@ -252,6 +249,9 @@ bool PartialData::UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
if (byte_range_.IsValid())
return false;
+ if (!headers->HasStrongValidators())
+ return false;
+
// Now we avoid resume if there is no content length, but that was not
// always the case so double check here.
int64 total_length = headers->GetContentLength();
@@ -270,7 +270,7 @@ bool PartialData::UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
return true;
}
- if (headers->response_code() == 200) {
+ if (headers->response_code() != 206) {
DCHECK(byte_range_.IsValid());
sparse_entry_ = false;
resource_size_ = entry->GetDataSize(kDataStream);