summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/disk_cache/mem_entry_impl.cc2
-rw-r--r--net/http/http_cache_unittest.cc3
-rw-r--r--net/http/partial_data.cc3
3 files changed, 7 insertions, 1 deletions
diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc
index dcab54b..17eb65f 100644
--- a/net/disk_cache/mem_entry_impl.cc
+++ b/net/disk_cache/mem_entry_impl.cc
@@ -168,7 +168,7 @@ int MemEntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
if (!InitSparseInfo())
return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
- if (offset < 0 || buf_len < 0 || !buf_len)
+ if (offset < 0 || buf_len < 0)
return net::ERR_INVALID_ARGUMENT;
// We will keep using this buffer and adjust the offset in this buffer.
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 35e6736..064f7c4 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -2214,6 +2214,9 @@ TEST(HttpCache, RangeGET_Previous200) {
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
+ // The last transaction has finished so make sure the entry is deactivated.
+ MessageLoop::current()->RunAllPending();
+
// Now we should receive a range from the server and drop the stored entry.
handler.set_not_modified(false);
transaction2.request_headers = kRangeGET_TransactionOK.request_headers;
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 1b4b575..7257f00 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -256,6 +256,9 @@ void PartialData::FixContentLength(HttpResponseHeaders* headers) {
int PartialData::CacheRead(disk_cache::Entry* entry, IOBuffer* data,
int data_len, CompletionCallback* callback) {
int read_len = std::min(data_len, cached_min_len_);
+ if (!read_len)
+ return 0;
+
int rv = 0;
if (sparse_entry_) {
rv = entry->ReadSparseData(current_range_start_, data, read_len,