| 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" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1169 |
| 1170 // We received 304 or 206 and we want to update the cached response headers. | 1170 // We received 304 or 206 and we want to update the cached response headers. |
| 1171 int HttpCache::Transaction::DoUpdateCachedResponse() { | 1171 int HttpCache::Transaction::DoUpdateCachedResponse() { |
| 1172 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; | 1172 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; |
| 1173 int rv = OK; | 1173 int rv = OK; |
| 1174 // Update cached response based on headers in new_response. | 1174 // Update cached response based on headers in new_response. |
| 1175 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? | 1175 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? |
| 1176 response_.headers->Update(*new_response_->headers); | 1176 response_.headers->Update(*new_response_->headers); |
| 1177 response_.response_time = new_response_->response_time; | 1177 response_.response_time = new_response_->response_time; |
| 1178 response_.request_time = new_response_->request_time; | 1178 response_.request_time = new_response_->request_time; |
| 1179 response_.network_accessed = new_response_->network_accessed; |
| 1179 | 1180 |
| 1180 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { | 1181 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { |
| 1181 if (!entry_->doomed) { | 1182 if (!entry_->doomed) { |
| 1182 int ret = cache_->DoomEntry(cache_key_, NULL); | 1183 int ret = cache_->DoomEntry(cache_key_, NULL); |
| 1183 DCHECK_EQ(OK, ret); | 1184 DCHECK_EQ(OK, ret); |
| 1184 } | 1185 } |
| 1185 } else { | 1186 } else { |
| 1186 // If we are already reading, we already updated the headers for this | 1187 // If we are already reading, we already updated the headers for this |
| 1187 // request; doing it again will change Content-Length. | 1188 // request; doing it again will change Content-Length. |
| 1188 if (!reading_) { | 1189 if (!reading_) { |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 } | 2508 } |
| 2508 | 2509 |
| 2509 int HttpCache::Transaction::ResetCacheIOStart(int return_value) { | 2510 int HttpCache::Transaction::ResetCacheIOStart(int return_value) { |
| 2510 DCHECK(cache_io_start_.is_null()); | 2511 DCHECK(cache_io_start_.is_null()); |
| 2511 if (return_value == ERR_IO_PENDING) | 2512 if (return_value == ERR_IO_PENDING) |
| 2512 cache_io_start_ = base::TimeTicks::Now(); | 2513 cache_io_start_ = base::TimeTicks::Now(); |
| 2513 return return_value; | 2514 return return_value; |
| 2514 } | 2515 } |
| 2515 | 2516 |
| 2516 } // namespace net | 2517 } // namespace net |
| OLD | NEW |