[go: nahoru, domu]

Handle range request on a truncated entry

This change will doom the truncated entry and creates a new sparse entry.

TEST=unit tests

Review URL: http://codereview.chromium.org/251067

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27859 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 7257f00..b61d9be 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -120,14 +120,13 @@
   resource_size_ = 0;
   if (truncated) {
     DCHECK_EQ(headers->response_code(), 200);
-    truncated_ = true;
-    sparse_entry_ = false;
-
     // We don't have the real length and the user may be trying to create a
     // sparse entry so let's not write to this entry.
     if (byte_range_.IsValid())
       return false;
 
+    truncated_ = true;
+    sparse_entry_ = false;
     byte_range_.set_first_byte_position(entry->GetDataSize(kDataStream));
     current_range_start_ = 0;
     return true;