Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: net/http/http_cache_transaction.cc

Issue 976373005: Http Cache: Update vary data after a 304. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 1658
1659 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE; 1659 next_state_ = STATE_UPDATE_CACHED_RESPONSE_COMPLETE;
1660 int rv = OK; 1660 int rv = OK;
1661 // Update cached response based on headers in new_response. 1661 // Update cached response based on headers in new_response.
1662 // TODO(wtc): should we update cached certificate (response_.ssl_info), too? 1662 // TODO(wtc): should we update cached certificate (response_.ssl_info), too?
1663 response_.headers->Update(*new_response_->headers.get()); 1663 response_.headers->Update(*new_response_->headers.get());
1664 response_.response_time = new_response_->response_time; 1664 response_.response_time = new_response_->response_time;
1665 response_.request_time = new_response_->request_time; 1665 response_.request_time = new_response_->request_time;
1666 response_.network_accessed = new_response_->network_accessed; 1666 response_.network_accessed = new_response_->network_accessed;
1667 response_.unused_since_prefetch = new_response_->unused_since_prefetch; 1667 response_.unused_since_prefetch = new_response_->unused_since_prefetch;
1668 if (new_response_->vary_data.is_valid()) {
1669 response_.vary_data = new_response_->vary_data;
1670 } else if (response_.vary_data.is_valid()) {
1671 // There is a vary header in the stored response but not in the current one.
1672 // Update the data with the new request headers.
1673 HttpVaryData new_vary_data;
1674 new_vary_data.Init(*request_, *response_.headers.get());
1675 response_.vary_data = new_vary_data;
1676 }
1668 1677
1669 if (response_.headers->HasHeaderValue("cache-control", "no-store")) { 1678 if (response_.headers->HasHeaderValue("cache-control", "no-store")) {
1670 if (!entry_->doomed) { 1679 if (!entry_->doomed) {
1671 int ret = cache_->DoomEntry(cache_key_, NULL); 1680 int ret = cache_->DoomEntry(cache_key_, NULL);
1672 DCHECK_EQ(OK, ret); 1681 DCHECK_EQ(OK, ret);
1673 } 1682 }
1674 } else { 1683 } else {
1675 // If we are already reading, we already updated the headers for this 1684 // If we are already reading, we already updated the headers for this
1676 // request; doing it again will change Content-Length. 1685 // request; doing it again will change Content-Length.
1677 if (!reading_) { 1686 if (!reading_) {
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 3279
3271 void HttpCache::Transaction::OnIOComplete(int result) { 3280 void HttpCache::Transaction::OnIOComplete(int result) {
3272 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. 3281 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed.
3273 tracked_objects::ScopedTracker tracking_profile( 3282 tracked_objects::ScopedTracker tracking_profile(
3274 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete")); 3283 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete"));
3275 3284
3276 DoLoop(result); 3285 DoLoop(result);
3277 } 3286 }
3278 3287
3279 } // namespace net 3288 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698