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

Unified Diff: chrome/browser/net/websocket_browsertest.cc

Issue 1059303002: Don't process HSTS/HPKP headers when host is an IP address (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ugly workaround for mac 10.6 getaddrinfo bug Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/data/ssl/certificates/localhost_cert.pem » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/websocket_browsertest.cc
diff --git a/chrome/browser/net/websocket_browsertest.cc b/chrome/browser/net/websocket_browsertest.cc
index c96e38b3252c81dcd416205159a7588446999b7c..ed1fa0b9e3ac121467afb107fa09c904fb300cec 100644
--- a/chrome/browser/net/websocket_browsertest.cc
+++ b/chrome/browser/net/websocket_browsertest.cc
@@ -300,20 +300,25 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, SSLConnectionLimit) {
IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, WebSocketAppliesHSTS) {
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS,
- net::SpawnedTestServer::SSLOptions(),
+ net::SpawnedTestServer::SSLOptions(
+ net::SpawnedTestServer::SSLOptions::CERT_COMMON_NAME_IS_DOMAIN),
base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
- // This test sets HSTS on 127.0.0.1. To avoid being redirected to https, start
- // the http server on "localhost" instead.
+ net::SpawnedTestServer wss_server(
+ net::SpawnedTestServer::TYPE_WSS,
+ net::SpawnedTestServer::SSLOptions(
+ net::SpawnedTestServer::SSLOptions::CERT_COMMON_NAME_IS_DOMAIN),
+ net::GetWebSocketTestDataDirectory());
+ // This test sets HSTS on localhost. To avoid being redirected to https, start
+ // the http server on 127.0.0.1 instead.
net::SpawnedTestServer http_server(
- net::SpawnedTestServer::TYPE_HTTP,
- "localhost",
+ net::SpawnedTestServer::TYPE_HTTP, net::SpawnedTestServer::kLocalhost,
base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
ASSERT_TRUE(https_server.StartInBackground());
ASSERT_TRUE(http_server.StartInBackground());
- ASSERT_TRUE(wss_server_.StartInBackground());
+ ASSERT_TRUE(wss_server.StartInBackground());
ASSERT_TRUE(https_server.BlockUntilStarted());
- // Set HSTS on 127.0.0.1.
+ // Set HSTS on localhost.
content::TitleWatcher title_watcher(
browser()->tab_strip_model()->GetActiveWebContents(),
base::ASCIIToUTF16("SET"));
@@ -323,8 +328,8 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, WebSocketAppliesHSTS) {
EXPECT_TRUE(EqualsASCII(result, "SET"));
// Verify that it applies to WebSockets.
- ASSERT_TRUE(wss_server_.BlockUntilStarted());
- GURL wss_url = wss_server_.GetURL("echo-with-no-extension");
+ ASSERT_TRUE(wss_server.BlockUntilStarted());
+ GURL wss_url = wss_server.GetURL("echo-with-no-extension");
std::string scheme("ws");
GURL::Replacements scheme_replacement;
scheme_replacement.SetSchemeStr(scheme);
« no previous file with comments | « no previous file | net/data/ssl/certificates/localhost_cert.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698