Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1868 if (!cache_.get()) | 1868 if (!cache_.get()) |
| 1869 return ERR_UNEXPECTED; | 1869 return ERR_UNEXPECTED; |
| 1870 | 1870 |
| 1871 if (result != write_len_) { | 1871 if (result != write_len_) { |
| 1872 DLOG(ERROR) << "failed to write response data to cache"; | 1872 DLOG(ERROR) << "failed to write response data to cache"; |
| 1873 DoneWritingToEntry(false); | 1873 DoneWritingToEntry(false); |
| 1874 | 1874 |
| 1875 // We want to ignore errors writing to disk and just keep reading from | 1875 // We want to ignore errors writing to disk and just keep reading from |
| 1876 // the network. | 1876 // the network. |
| 1877 result = write_len_; | 1877 result = write_len_; |
| 1878 } else if (!done_reading_ && entry_) { | 1878 } else if (!done_reading_ && entry_ && (!partial_ || truncated_)) { |
|
asanka
2015/09/17 14:43:34
I'll note that this change doesn't affect the newl
rvargas (doing something else)
2015/09/17 20:18:37
These tests are actually a regression test for htt
| |
| 1879 int current_size = entry_->disk_entry->GetDataSize(kResponseContentIndex); | 1879 int current_size = entry_->disk_entry->GetDataSize(kResponseContentIndex); |
| 1880 int64 body_size = response_.headers->GetContentLength(); | 1880 int64 body_size = response_.headers->GetContentLength(); |
| 1881 if (body_size >= 0 && body_size <= current_size) | 1881 if (body_size >= 0 && body_size <= current_size) |
| 1882 done_reading_ = true; | 1882 done_reading_ = true; |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 if (partial_) { | 1885 if (partial_) { |
| 1886 // This may be the last request. | 1886 // This may be the last request. |
| 1887 if (result != 0 || truncated_ || | 1887 if (result != 0 || truncated_ || |
| 1888 !(partial_->IsLastRange() || mode_ == WRITE)) { | 1888 !(partial_->IsLastRange() || mode_ == WRITE)) { |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2934 default: | 2934 default: |
| 2935 NOTREACHED(); | 2935 NOTREACHED(); |
| 2936 } | 2936 } |
| 2937 } | 2937 } |
| 2938 | 2938 |
| 2939 void HttpCache::Transaction::OnIOComplete(int result) { | 2939 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2940 DoLoop(result); | 2940 DoLoop(result); |
| 2941 } | 2941 } |
| 2942 | 2942 |
| 2943 } // namespace net | 2943 } // namespace net |
| OLD | NEW |