summaryrefslogtreecommitdiffstats
path: root/net/socket/ssl_client_socket_nss.cc
diff options
context:
space:
mode:
authorbnc <bnc@chromium.org>2015-09-28 17:03:44 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-29 00:04:34 +0000
commitf76254d62e10ebd2fc9185609fde431e3232bc1f (patch)
tree19ed80e3ba8e777246f21e3f0ef0f7c1b4eb7241 /net/socket/ssl_client_socket_nss.cc
parentcf0aab068e9e8d22f9dae6d1242a66649a34d06c (diff)
downloadchromium_src-f76254d62e10ebd2fc9185609fde431e3232bc1f.zip
chromium_src-f76254d62e10ebd2fc9185609fde431e3232bc1f.tar.gz
chromium_src-f76254d62e10ebd2fc9185609fde431e3232bc1f.tar.bz2
Refactor SSLClientSocket::SerializeNextProtos().
Break out HTTP/2 protocol removal from SSLClientSocket::SerializeNextProtos() to SSLClientSocket::DisableHTTP2() method. DisableHTTP2() will be used for NPN to create a NextProtoVector that can be used by the callback function (no serialization is necessary for this.) BUG=527066 Review URL: https://codereview.chromium.org/1371263002 Cr-Commit-Position: refs/heads/master@{#351210}
Diffstat (limited to 'net/socket/ssl_client_socket_nss.cc')
-rw-r--r--net/socket/ssl_client_socket_nss.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index f558e71..f8a56d7 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -858,10 +858,12 @@ bool SSLClientSocketNSS::Core::Init(PRFileDesc* socket,
PK11_TokenExists(CKM_NSS_CHACHA20_POLY1305);
const bool adequate_key_agreement = PK11_TokenExists(CKM_DH_PKCS_DERIVE) ||
PK11_TokenExists(CKM_ECDH1_DERIVE);
- std::vector<uint8_t> wire_protos =
- SerializeNextProtos(ssl_config_.next_protos,
- adequate_encryption && adequate_key_agreement &&
- IsTLSVersionAdequateForHTTP2(ssl_config_));
+ NextProtoVector next_protos = ssl_config_.next_protos;
+ if (!adequate_encryption || !adequate_key_agreement ||
+ !IsTLSVersionAdequateForHTTP2(ssl_config_)) {
+ DisableHTTP2(&next_protos);
+ }
+ std::vector<uint8_t> wire_protos = SerializeNextProtos(next_protos);
rv = SSL_SetNextProtoNego(
nss_fd_, wire_protos.empty() ? NULL : &wire_protos[0],
wire_protos.size());