summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-11 19:31:24 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-11 19:31:24 +0000
commit685af593818425e6b2b3b879212f50d0a7bee56f (patch)
tree946bd2073483558f174d9bb9e6658f01dbd0e7f2 /net
parente3acb7c982749406952040173ffd729491c25577 (diff)
downloadchromium_src-685af593818425e6b2b3b879212f50d0a7bee56f.zip
chromium_src-685af593818425e6b2b3b879212f50d0a7bee56f.tar.gz
chromium_src-685af593818425e6b2b3b879212f50d0a7bee56f.tar.bz2
Bypass the DNS cache when the LOAD_VALIDATE_CACHE load flag is set.
This fixes problem where cached negative DNS entries were being used on a regular page refresh. BUG=34737 TEST=HttpNetworkTransactionTest.BypassHostCacheOnRefresh* Review URL: http://codereview.chromium.org/2051006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_transaction.cc1
-rw-r--r--net/http/http_network_transaction_unittest.cc22
2 files changed, 19 insertions, 4 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 34a0027..90763a0 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -821,6 +821,7 @@ int HttpNetworkTransaction::DoInitConnection() {
// If the user is refreshing the page, bypass the host cache.
bool disable_resolver_cache = request_->load_flags & LOAD_BYPASS_CACHE ||
+ request_->load_flags & LOAD_VALIDATE_CACHE ||
request_->load_flags & LOAD_DISABLE_CACHE;
int rv;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 6581201..8464442 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -4053,9 +4053,9 @@ TEST_F(HttpNetworkTransactionTest, ResolveMadeWithReferrer) {
EXPECT_TRUE(resolution_observer.did_complete_with_expected_referrer());
}
-// Make sure that when the load flags contain LOAD_BYPASS_CACHE, the resolver's
-// host cache is bypassed.
-TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) {
+// Base test to make sure that when the load flags for a request specify to
+// bypass the cache, the DNS cache is not used.
+void BypassHostCacheOnRefreshHelper(int load_flags) {
SessionDependencies session_deps;
// Select a host resolver that does caching.
@@ -4094,7 +4094,7 @@ TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) {
// Issue a request, asking to bypass the cache(s).
HttpRequestInfo request;
request.method = "GET";
- request.load_flags = LOAD_BYPASS_CACHE;
+ request.load_flags = load_flags;
request.url = GURL("http://www.google.com/");
// Run the request.
@@ -4108,6 +4108,20 @@ TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) {
EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv);
}
+// There are multiple load flags that should trigger the host cache bypass.
+// Test each in isolation:
+TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh1) {
+ BypassHostCacheOnRefreshHelper(LOAD_BYPASS_CACHE);
+}
+
+TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh2) {
+ BypassHostCacheOnRefreshHelper(LOAD_VALIDATE_CACHE);
+}
+
+TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh3) {
+ BypassHostCacheOnRefreshHelper(LOAD_DISABLE_CACHE);
+}
+
// Make sure we can handle an error when writing the request.
TEST_F(HttpNetworkTransactionTest, RequestWriteError) {
SessionDependencies session_deps;