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

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

Issue 10829114: Http cache: Always revalidate PUT and DELETE requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« 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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 // TODO(darin): need to do more work here: 1763 // TODO(darin): need to do more work here:
1764 // - make sure we have a matching request method 1764 // - make sure we have a matching request method
1765 // - watch out for cached responses that depend on authentication 1765 // - watch out for cached responses that depend on authentication
1766 // In playback mode, nothing requires validation. 1766 // In playback mode, nothing requires validation.
1767 if (cache_->mode() == net::HttpCache::PLAYBACK) 1767 if (cache_->mode() == net::HttpCache::PLAYBACK)
1768 return false; 1768 return false;
1769 1769
1770 if (effective_load_flags_ & LOAD_VALIDATE_CACHE) 1770 if (effective_load_flags_ & LOAD_VALIDATE_CACHE)
1771 return true; 1771 return true;
1772 1772
1773 if (request_->method == "PUT" || request_->method == "DELETE")
1774 return true;
1775
1773 if (response_.headers->RequiresValidation( 1776 if (response_.headers->RequiresValidation(
1774 response_.request_time, response_.response_time, Time::Now())) 1777 response_.request_time, response_.response_time, Time::Now()))
1775 return true; 1778 return true;
1776 1779
1777 // Since Vary header computation is fairly expensive, we save it for last. 1780 // Since Vary header computation is fairly expensive, we save it for last.
1778 if (response_.vary_data.is_valid() && 1781 if (response_.vary_data.is_valid() &&
1779 !response_.vary_data.MatchesRequest(*request_, *response_.headers)) 1782 !response_.vary_data.MatchesRequest(*request_, *response_.headers))
1780 return true; 1783 return true;
1781 1784
1782 return false; 1785 return false;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 if (transaction_delegate_) 2179 if (transaction_delegate_)
2177 transaction_delegate_->OnCacheActionStart(); 2180 transaction_delegate_->OnCacheActionStart();
2178 } 2181 }
2179 2182
2180 void HttpCache::Transaction::ReportCacheActionFinish() { 2183 void HttpCache::Transaction::ReportCacheActionFinish() {
2181 if (transaction_delegate_) 2184 if (transaction_delegate_)
2182 transaction_delegate_->OnCacheActionFinish(); 2185 transaction_delegate_->OnCacheActionFinish();
2183 } 2186 }
2184 2187
2185 } // namespace net 2188 } // 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