summaryrefslogtreecommitdiffstats
path: root/net/http/http_transaction_test_util.cc
diff options
context:
space:
mode:
authorricea <ricea@chromium.org>2014-10-07 20:37:00 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-08 03:37:20 +0000
commit64c07d7959386d30a0e4aa1371e2bdcd3d436476 (patch)
treefae68bfb988c022701b0ca6bc16431cf0e57c2d2 /net/http/http_transaction_test_util.cc
parentb3115e6252af69ca0aca60ed8b1334d46561b2b7 (diff)
downloadchromium_src-64c07d7959386d30a0e4aa1371e2bdcd3d436476.zip
chromium_src-64c07d7959386d30a0e4aa1371e2bdcd3d436476.tar.gz
chromium_src-64c07d7959386d30a0e4aa1371e2bdcd3d436476.tar.bz2
stale-while-revalidate experimental implementation.
Simplistic implementation of stale-while-revalidate. See design doc at https://docs.google.com/document/d/1DMCIMAKjyKeYiu69jlI5OsO2pGyAMb81XflYK4hxsNM/edit?usp=sharing This implementation has known flaws: 1. Set-Cookie, Strict-Transport-Security and Public-Key-Pins headers are lost from the responses of asynchronous revalidations. 2. Conditional requests sent from the Blink cache do not have the stale-while-revalidate logic applied to them. 3. Support for the bandwidth reduction proxy is hacky. It will be replaced with a better implementation if/when the concept is proven. BUG=348877 TEST=net_unittests Review URL: https://codereview.chromium.org/455623003 Cr-Commit-Position: refs/heads/master@{#298649}
Diffstat (limited to 'net/http/http_transaction_test_util.cc')
-rw-r--r--net/http/http_transaction_test_util.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc
index 7d031d8..dbbca6c 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -277,8 +277,13 @@ bool MockNetworkTransaction::IsReadyToRestartForAuth() {
if (!request_)
return false;
- // Only mock auth when the test asks for it.
- return request_->extra_headers.HasHeader("X-Require-Mock-Auth");
+ if (!request_->extra_headers.HasHeader("X-Require-Mock-Auth"))
+ return false;
+
+ // Allow the mock server to decide whether authentication is required or not.
+ std::string status_line = response_.headers->GetStatusLine();
+ return status_line.find(" 401 ") != std::string::npos ||
+ status_line.find(" 407 ") != std::string::npos;
}
int MockNetworkTransaction::Read(net::IOBuffer* buf, int buf_len,