diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 00:14:48 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 00:14:48 +0000 |
commit | 44f873a6f7b7b9778756b57d59c6a8d43f696bde (patch) | |
tree | 0ea01098e650aee927a61c3de5ea4f2fccd37269 /net/http/http_response_headers.cc | |
parent | 5506e7813e6ab6330665ae8cc5fb3cc8275d90ff (diff) | |
download | chromium_src-44f873a6f7b7b9778756b57d59c6a8d43f696bde.zip chromium_src-44f873a6f7b7b9778756b57d59c6a8d43f696bde.tar.gz chromium_src-44f873a6f7b7b9778756b57d59c6a8d43f696bde.tar.bz2 |
Http cache: Extend support for byte range requests.
* Now we handle regular requests (not byte range requests) that
end up reading a cached entry that stores byte ranges. In this
case we create a control object (partial_), but it's byte_range_
member is always invalid because the user is not requesting
a range.
* Given that we may find stored 206s that are not keeping sparse
data, we detect that case and handle it.
* Now we may end up reading 206 from disk (and the net) and having
to change the returned status to be 200 (for regular requests).
* We avoid performing re-validations for each piece of stored data.
Instead, we consider the whole entry to be revalidated once, and
read from the cache without asking the server (as far as we can).
* When processing the received headers we now consider receiving
200 and 416 (instead of 206/304) and we handle inconsistencies
in the range returned by the server (from what we expect). We
also handle receiving 206 when we don't expect it.
BUG=12258
TEST=unittests
Review URL: http://codereview.chromium.org/164304
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers.cc')
-rw-r--r-- | net/http/http_response_headers.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index f86eff8..9cbd72f 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -256,6 +256,15 @@ void HttpResponseHeaders::AddHeader(const std::string& header) { Parse(new_raw_headers); } +void HttpResponseHeaders::ReplaceStatusLine(const std::string& new_status) { + // Copy up to the null byte. This just copies the status line. + std::string new_raw_headers(new_status); + new_raw_headers.push_back('\0'); + + HeaderSet empty_to_remove; + MergeWithHeaders(new_raw_headers, empty_to_remove); +} + void HttpResponseHeaders::Parse(const std::string& raw_input) { raw_headers_.reserve(raw_input.size()); |