diff options
author | Ben Murdoch <benm@google.com> | 2011-01-07 14:18:56 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-01-11 10:23:13 +0000 |
commit | 201ade2fbba22bfb27ae029f4d23fca6ded109a0 (patch) | |
tree | b793f4ed916f73cf18357ea467ff3deb5ffb5b52 /net/http/http_cache_transaction.cc | |
parent | d8c4c37a7d0961944bfdfaa117d5c68c8e129c97 (diff) | |
download | external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.zip external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.gz external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.bz2 |
Merge chromium at 9.0.597.55: Initial merge by git.
Change-Id: Id686a88437441ec7e17abb3328a404c7b6c3c6ad
Diffstat (limited to 'net/http/http_cache_transaction.cc')
-rw-r--r-- | net/http/http_cache_transaction.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 873ccf4..1720509 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -112,6 +112,7 @@ HttpCache::Transaction::Transaction(HttpCache* cache, bool enable_range_support) invalid_range_(false), enable_range_support_(enable_range_support), truncated_(false), + is_sparse_(false), server_responded_206_(false), cache_pending_(false), read_offset_(0), @@ -676,7 +677,7 @@ int HttpCache::Transaction::DoSuccessfulSendRequest() { return OK; } if (server_responded_206_ && mode_ == READ_WRITE && !truncated_ && - response_.headers->response_code() == 200) { + !is_sparse_) { // We have stored the full entry, but it changed and the server is // sending a range. We have to delete the old entry. DoneWritingToEntry(false); @@ -886,6 +887,7 @@ int HttpCache::Transaction::DoAddToEntryComplete(int result) { return OK; } +// We may end up here multiple times for a given request. int HttpCache::Transaction::DoStartPartialCacheValidation() { if (mode_ == NONE) return OK; @@ -1446,6 +1448,7 @@ int HttpCache::Transaction::BeginPartialCacheValidation() { return ValidateEntryHeadersAndContinue(false); } +// This should only be called once per request. int HttpCache::Transaction::ValidateEntryHeadersAndContinue( bool byte_range_requested) { DCHECK(mode_ == READ_WRITE); @@ -1461,6 +1464,9 @@ int HttpCache::Transaction::ValidateEntryHeadersAndContinue( return OK; } + if (response_.headers->response_code() == 206) + is_sparse_ = true; + if (!partial_->IsRequestedRangeOK()) { // The stored data is fine, but the request may be invalid. invalid_range_ = true; @@ -1842,6 +1848,7 @@ void HttpCache::Transaction::DoomPartialEntry(bool delete_object) { DCHECK_EQ(OK, rv); cache_->DoneWithEntry(entry_, this, false); entry_ = NULL; + is_sparse_ = false; if (delete_object) partial_.reset(NULL); } |