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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 1387363004: Disable HTTP/2 over NPN (with OpenSSL). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #7. 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
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 6d9760fae40cb0c82c1d02fb90e0b32f3f7cc212..b0dd52425e63f31551c87aa1049f182c6fb4e3ac 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -843,15 +843,18 @@ bool SSLClientSocketNSS::Core::Init(PRFileDesc* socket,
SECStatus rv = SECSuccess;
- if (!ssl_config_.next_protos.empty()) {
- NextProtoVector next_protos = ssl_config_.next_protos;
+ if (!ssl_config_.alpn_protos.empty()) {
+ NextProtoVector alpn_protos = ssl_config_.alpn_protos;
// TODO(bnc): Check ssl_config_.disabled_cipher_suites.
if (!IsTLSVersionAdequateForHTTP2(ssl_config_))
- DisableHTTP2(&next_protos);
+ DisableHTTP2(&alpn_protos);
// |ssl_config_| has fallback protocol at the end of the list, but NSS
// expects fallback at the first place, thus protocols need to be reordered.
- ReorderNextProtos(&next_protos);
- std::vector<uint8_t> wire_protos = SerializeNextProtos(next_protos);
+ ReorderNextProtos(&alpn_protos);
+ // NSS only supports a single protocol vector to be used with ALPN and NPN.
+ // Because of this limitation, |alpn_prototos| will be used for both.
+ // However, it is possible to enable ALPN and NPN separately.
+ std::vector<uint8_t> wire_protos = SerializeNextProtos(alpn_protos);
rv = SSL_SetNextProtoNego(
nss_fd_, wire_protos.empty() ? NULL : &wire_protos[0],
wire_protos.size());
@@ -860,9 +863,11 @@ bool SSLClientSocketNSS::Core::Init(PRFileDesc* socket,
rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_ALPN, PR_TRUE);
if (rv != SECSuccess)
LogFailedNSSFunction(*weak_net_log_, "SSL_OptionSet", "SSL_ENABLE_ALPN");
- rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_NPN, PR_TRUE);
- if (rv != SECSuccess)
- LogFailedNSSFunction(*weak_net_log_, "SSL_OptionSet", "SSL_ENABLE_NPN");
+ if (!ssl_config_.npn_protos.empty()) {
+ rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_NPN, PR_TRUE);
+ if (rv != SECSuccess)
+ LogFailedNSSFunction(*weak_net_log_, "SSL_OptionSet", "SSL_ENABLE_NPN");
+ }
}
rv = SSL_AuthCertificateHook(
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698