summaryrefslogtreecommitdiffstats
path: root/net/http/partial_data.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 00:04:20 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 00:04:20 +0000
commite75e8afa0cf126ca22e403874a22249d51b86219 (patch)
treeecaf299653c89555d53af5f3d6af91119be7f902 /net/http/partial_data.cc
parent60507b1cedf0d19b1a5d9034abb2eb25a2432439 (diff)
downloadchromium_src-e75e8afa0cf126ca22e403874a22249d51b86219.zip
chromium_src-e75e8afa0cf126ca22e403874a22249d51b86219.tar.gz
chromium_src-e75e8afa0cf126ca22e403874a22249d51b86219.tar.bz2
Http cache: Always preserve extra headers when dealing with
byte range requests. BUG=25755 TEST=unittests Review URL: http://codereview.chromium.org/339088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/partial_data.cc')
-rw-r--r--net/http/partial_data.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 128c5b7..162948c 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -22,8 +22,7 @@ const int kDataStream = 1;
namespace net {
-bool PartialData::Init(const std::string& headers,
- const std::string& new_headers) {
+bool PartialData::Init(const std::string& headers) {
std::vector<HttpByteRange> ranges;
if (!HttpUtil::ParseRanges(headers, &ranges) || ranges.size() != 1)
return false;
@@ -33,13 +32,16 @@ bool PartialData::Init(const std::string& headers,
if (!byte_range_.IsValid())
return false;
- extra_headers_ = new_headers;
resource_size_ = 0;
-
current_range_start_ = byte_range_.first_byte_position();
return true;
}
+void PartialData::SetHeaders(const std::string& headers) {
+ DCHECK(extra_headers_.empty());
+ extra_headers_ = headers;
+}
+
void PartialData::RestoreHeaders(std::string* headers) const {
DCHECK(current_range_start_ >= 0 || byte_range_.IsSuffixByteRange());
int64 end = byte_range_.IsSuffixByteRange() ?