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

Unified Diff: net/socket/ssl_client_socket_unittest.cc

Issue 1387363004: Disable HTTP/2 over NPN (with OpenSSL). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable NPN in NSS if npn_protos.empty(). Created 5 years, 2 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
Index: net/socket/ssl_client_socket_unittest.cc
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index d151cfbf18b25939085a2a0bf2f1f0f3ad179724..f93c865272b2fea0880308564a560827b2b65d77 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -3140,7 +3140,8 @@ TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) {
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
server_options.npn_protocols.push_back(std::string("http/1.1"));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
ASSERT_NO_FATAL_FAILURE(
TestFalseStart(server_options, client_config, true));
}
@@ -3153,7 +3154,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoNPN) {
server_options.bulk_ciphers =
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
SSLConfig client_config;
- client_config.next_protos.clear();
+ client_config.alpn_protos.clear();
+ client_config.npn_protos.clear();
ASSERT_NO_FATAL_FAILURE(
TestFalseStart(server_options, client_config, false));
}
@@ -3167,7 +3169,8 @@ TEST_F(SSLClientSocketFalseStartTest, RSA) {
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
server_options.npn_protocols.push_back(std::string("http/1.1"));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
ASSERT_NO_FATAL_FAILURE(
TestFalseStart(server_options, client_config, false));
}
@@ -3181,7 +3184,8 @@ TEST_F(SSLClientSocketFalseStartTest, DHE_RSA) {
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
server_options.npn_protocols.push_back(std::string("http/1.1"));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
}
@@ -3194,7 +3198,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoAEAD) {
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128;
server_options.npn_protocols.push_back(std::string("http/1.1"));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
}
@@ -3208,7 +3213,8 @@ TEST_F(SSLClientSocketFalseStartTest, SessionResumption) {
SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
server_options.npn_protocols.push_back(std::string("http/1.1"));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
// Let a full handshake complete with False Start.
ASSERT_NO_FATAL_FAILURE(
@@ -3243,7 +3249,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBeforeFinished) {
ASSERT_TRUE(StartTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
// Start a handshake up to the server Finished message.
TestCompletionCallback callback;
@@ -3301,7 +3308,8 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBadFinished) {
ASSERT_TRUE(StartTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
// Start a handshake up to the server Finished message.
TestCompletionCallback callback;
@@ -3418,6 +3426,11 @@ TEST_F(SSLClientSocketChannelIDTest, FailingChannelIDAsync) {
EXPECT_FALSE(sock_->IsConnected());
}
+// Because of quirks of the NSS implementation, in the following NPN tests,
+// client_config.alpn_protos needs to be set, because NSS uses it for NPN (it
+// has to use the same string as for ALPN), and client_config.npn_protos needs
+// to be non-empty, otherwise NSS disables NPN.
davidben 2015/10/13 20:55:59 Optional: Wrap the alpn_protos bits under #ifdef t
Bence 2015/10/14 14:55:59 Done.
+
TEST_F(SSLClientSocketTest, NPN) {
SpawnedTestServer::SSLOptions server_options;
server_options.npn_protocols.push_back(std::string("spdy/3.1"));
@@ -3425,8 +3438,10 @@ TEST_F(SSLClientSocketTest, NPN) {
ASSERT_TRUE(ConnectToTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP2);
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP2);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP2);
+ client_config.npn_protos.push_back(kProtoHTTP11);
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
@@ -3445,8 +3460,10 @@ TEST_F(SSLClientSocketTest, NPNNoOverlap) {
ASSERT_TRUE(ConnectToTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoSPDY31);
- client_config.next_protos.push_back(kProtoHTTP2);
+ client_config.alpn_protos.push_back(kProtoSPDY31);
+ client_config.alpn_protos.push_back(kProtoHTTP2);
+ client_config.npn_protos.push_back(kProtoSPDY31);
+ client_config.npn_protos.push_back(kProtoHTTP2);
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
@@ -3466,8 +3483,10 @@ TEST_F(SSLClientSocketTest, NPNServerPreference) {
ASSERT_TRUE(ConnectToTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP2);
- client_config.next_protos.push_back(kProtoSPDY31);
+ client_config.alpn_protos.push_back(kProtoHTTP2);
+ client_config.alpn_protos.push_back(kProtoSPDY31);
+ client_config.npn_protos.push_back(kProtoHTTP2);
+ client_config.npn_protos.push_back(kProtoSPDY31);
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
@@ -3499,7 +3518,8 @@ TEST_F(SSLClientSocketTest, NPNServerDisabled) {
ASSERT_TRUE(ConnectToTestServer(server_options));
SSLConfig client_config;
- client_config.next_protos.push_back(kProtoHTTP11);
+ client_config.alpn_protos.push_back(kProtoHTTP11);
+ client_config.npn_protos.push_back(kProtoHTTP11);
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));

Powered by Google App Engine
This is Rietveld 408576698