summaryrefslogtreecommitdiffstats
path: root/net/http/partial_data.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 18:08:25 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 18:08:25 +0000
commit634739bf391585057f2f1a9f8f173d418958ae0f (patch)
treec68d3b382be4edaebf5aec10de6dba870563df7b /net/http/partial_data.h
parent18699b72815f6f435c4e00f4f1eb900440898468 (diff)
downloadchromium_src-634739bf391585057f2f1a9f8f173d418958ae0f.zip
chromium_src-634739bf391585057f2f1a9f8f173d418958ae0f.tar.gz
chromium_src-634739bf391585057f2f1a9f8f173d418958ae0f.tar.bz2
Http cache: Fix handling of truncated entries.
- Always validate a truncated entry. Furthermore, given that a server can say not-modified (304), followed by 200 when actually asked for the final range, now we validate truncated entries by asking for the next byte that we need. - If a server refuses to serve a byte range and instead sends the whole resource, we just cache the response as if nothing was stored before. - If we receive a network error while reading from the net, we don't discard the cached entry right away. Now we wait until the transaction is closed, and attempt to mark the entry as truncated. BUG=48468 TEST=net_unittests Review URL: http://codereview.chromium.org/6588105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/partial_data.h')
-rw-r--r--net/http/partial_data.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/http/partial_data.h b/net/http/partial_data.h
index 4726d10..6224fdf 100644
--- a/net/http/partial_data.h
+++ b/net/http/partial_data.h
@@ -75,6 +75,9 @@ class PartialData {
bool UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
disk_cache::Entry* entry, bool truncated);
+ // Sets the byte current range to start again at zero (for a truncated entry).
+ void SetRangeToStartDownload();
+
// Returns true if the requested range is valid given the stored data.
bool IsRequestedRangeOK();
@@ -110,6 +113,8 @@ class PartialData {
// update the internal state about the current range.
void OnNetworkReadCompleted(int result);
+ bool initial_validation() const { return initial_validation_; }
+
private:
class Core;
// Returns the length to use when scanning the cache.
@@ -129,6 +134,7 @@ class PartialData {
bool final_range_;
bool sparse_entry_;
bool truncated_; // We have an incomplete 200 stored.
+ bool initial_validation_; // Only used for truncated entries.
Core* core_;
CompletionCallback* callback_;