| 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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 int HttpCache::Transaction::DoUpdateCachedResponse() { | 1047 int HttpCache::Transaction::DoUpdateCachedResponse() { |
| 1048 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; | 1048 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; |
| 1049 int rv = OK; | 1049 int rv = OK; |
| 1050 // Update cached response based on headers in new_response. | 1050 // Update cached response based on headers in new_response. |
| 1051 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? | 1051 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? |
| 1052 response_.headers->Update(*new_response_->headers); | 1052 response_.headers->Update(*new_response_->headers); |
| 1053 response_.response_time = new_response_->response_time; | 1053 response_.response_time = new_response_->response_time; |
| 1054 response_.request_time = new_response_->request_time; | 1054 response_.request_time = new_response_->request_time; |
| 1055 | 1055 |
| 1056 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { | 1056 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { |
| 1057 int ret = cache_->DoomEntry(cache_key_, NULL); | 1057 if (!entry_->doomed) { |
| 1058 DCHECK_EQ(OK, ret); | 1058 int ret = cache_->DoomEntry(cache_key_, NULL); |
| 1059 DCHECK_EQ(OK, ret); |
| 1060 } |
| 1059 } else { | 1061 } else { |
| 1060 // If we are already reading, we already updated the headers for this | 1062 // If we are already reading, we already updated the headers for this |
| 1061 // request; doing it again will change Content-Length. | 1063 // request; doing it again will change Content-Length. |
| 1062 if (!reading_) { | 1064 if (!reading_) { |
| 1063 target_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; | 1065 target_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; |
| 1064 next_state_ = STATE_CACHE_WRITE_RESPONSE; | 1066 next_state_ = STATE_CACHE_WRITE_RESPONSE; |
| 1065 rv = OK; | 1067 rv = OK; |
| 1066 } | 1068 } |
| 1067 } | 1069 } |
| 1068 return rv; | 1070 return rv; |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 return false; | 2105 return false; |
| 2104 | 2106 |
| 2105 return true; | 2107 return true; |
| 2106 } | 2108 } |
| 2107 | 2109 |
| 2108 void HttpCache::Transaction::OnIOComplete(int result) { | 2110 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2109 DoLoop(result); | 2111 DoLoop(result); |
| 2110 } | 2112 } |
| 2111 | 2113 |
| 2112 } // namespace net | 2114 } // namespace net |
| OLD | NEW |