diff options
-rw-r--r-- | net/socket/socket_test_util.cc | 2 | ||||
-rw-r--r-- | net/socket/socket_test_util.h | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket.h | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_mac.cc | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_mac.h | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.cc | 47 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.h | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_win.cc | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_win.h | 2 |
9 files changed, 30 insertions, 33 deletions
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 9e9daba..4285530 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -30,7 +30,7 @@ void MockClientSocket::GetSSLCertRequestInfo( } SSLClientSocket::NextProtoStatus -MockClientSocket::GetNextProtocol(std::string* proto) { +MockClientSocket::GetNextProto(std::string* proto) { NOTREACHED(); proto->clear(); return SSLClientSocket::kNextProtoUnsupported; diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 883b793..90b4019 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -276,7 +276,7 @@ class MockClientSocket : public net::SSLClientSocket { virtual void GetSSLInfo(net::SSLInfo* ssl_info); virtual void GetSSLCertRequestInfo( net::SSLCertRequestInfo* cert_request_info); - virtual NextProtoStatus GetNextProtocol(std::string* proto); + virtual NextProtoStatus GetNextProto(std::string* proto); // Socket methods: virtual int Read(net::IOBuffer* buf, int buf_len, diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index 4ad0320..71184bc 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h @@ -55,7 +55,7 @@ class SSLClientSocket : public ClientSocket { // kNextProtoNegotiated: *proto is set to the negotiated protocol. // kNextProtoNoOverlap: *proto is set to the first protocol in the // supported list. - virtual NextProtoStatus GetNextProtocol(std::string* proto) = 0; + virtual NextProtoStatus GetNextProto(std::string* proto) = 0; static NextProto NextProtoFromString(const std::string& proto_string) { if (proto_string == "http1.1") { diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index cc66554..3aa3591d 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -463,7 +463,7 @@ void SSLClientSocketMac::GetSSLCertRequestInfo( } SSLClientSocket::NextProtoStatus -SSLClientSocketMac::GetNextProtocol(std::string* proto) { +SSLClientSocketMac::GetNextProto(std::string* proto) { proto->clear(); return kNextProtoUnsupported; } diff --git a/net/socket/ssl_client_socket_mac.h b/net/socket/ssl_client_socket_mac.h index 739121c..fbfbdfd 100644 --- a/net/socket/ssl_client_socket_mac.h +++ b/net/socket/ssl_client_socket_mac.h @@ -36,7 +36,7 @@ class SSLClientSocketMac : public SSLClientSocket { // SSLClientSocket methods: virtual void GetSSLInfo(SSLInfo* ssl_info); virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); - virtual NextProtoStatus GetNextProtocol(std::string* proto); + virtual NextProtoStatus GetNextProto(std::string* proto); // ClientSocket methods: virtual int Connect(CompletionCallback* callback, LoadLog* load_log); diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 5c95ee0..c013ed8 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -541,13 +541,9 @@ void SSLClientSocketNSS::GetSSLCertRequestInfo( } SSLClientSocket::NextProtoStatus -SSLClientSocketNSS::GetNextProtocol(std::string* proto) { -#if !defined(SSL_NEXT_PROTO_NEGOTIATED) - // No NPN support in the libssl that we are building with. - proto->clear(); - return kNextProtoUnsupported; -#else - unsigned char buf[256]; +SSLClientSocketNSS::GetNextProto(std::string* proto) { +#if defined(SSL_NEXT_PROTO_NEGOTIATED) + unsigned char buf[255]; int state; unsigned len; SECStatus rv = SSL_GetNextProto(nss_fd_, &state, buf, &len, sizeof(buf)); @@ -556,26 +552,27 @@ SSLClientSocketNSS::GetNextProtocol(std::string* proto) { proto->clear(); return kNextProtoUnsupported; } - if (len == sizeof(buf)) { - // Based on the wire protocol, it should be impossible for the protocol - // string to be > 255 bytes long. - NOTREACHED() << "NPN protocol name truncated"; - } + // We don't check for truncation because sizeof(buf) is large enough to hold + // the maximum protocol size. switch(state) { - case SSL_NEXT_PROTO_NO_SUPPORT: - proto->clear(); - return kNextProtoUnsupported; - case SSL_NEXT_PROTO_NEGOTIATED: - *proto = std::string(reinterpret_cast<char*>(buf), len); - return kNextProtoNegotiated; - case SSL_NEXT_PROTO_NO_OVERLAP: - *proto = std::string(reinterpret_cast<char*>(buf), len); - return kNextProtoNoOverlap; - default: - NOTREACHED() << "Unknown status from SSL_GetNextProto: " << state; - proto->clear(); - return kNextProtoUnsupported; + case SSL_NEXT_PROTO_NO_SUPPORT: + proto->clear(); + return kNextProtoUnsupported; + case SSL_NEXT_PROTO_NEGOTIATED: + *proto = std::string(reinterpret_cast<char*>(buf), len); + return kNextProtoNegotiated; + case SSL_NEXT_PROTO_NO_OVERLAP: + *proto = std::string(reinterpret_cast<char*>(buf), len); + return kNextProtoNoOverlap; + default: + NOTREACHED() << "Unknown status from SSL_GetNextProto: " << state; + proto->clear(); + return kNextProtoUnsupported; } +#else + // No NPN support in the libssl that we are building with. + proto->clear(); + return kNextProtoUnsupported; #endif } diff --git a/net/socket/ssl_client_socket_nss.h b/net/socket/ssl_client_socket_nss.h index 1ef08ff..235f6ad 100644 --- a/net/socket/ssl_client_socket_nss.h +++ b/net/socket/ssl_client_socket_nss.h @@ -41,7 +41,7 @@ class SSLClientSocketNSS : public SSLClientSocket { // SSLClientSocket methods: virtual void GetSSLInfo(SSLInfo* ssl_info); virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); - virtual NextProtoStatus GetNextProtocol(std::string* proto); + virtual NextProtoStatus GetNextProto(std::string* proto); // ClientSocket methods: virtual int Connect(CompletionCallback* callback, LoadLog* load_log); diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc index 8ac4452..642652c 100644 --- a/net/socket/ssl_client_socket_win.cc +++ b/net/socket/ssl_client_socket_win.cc @@ -428,7 +428,7 @@ void SSLClientSocketWin::GetSSLCertRequestInfo( } SSLClientSocket::NextProtoStatus -SSLClientSocketWin::GetNextProtocol(std::string* proto) { +SSLClientSocketWin::GetNextProto(std::string* proto) { proto->clear(); return kNextProtoUnsupported; } diff --git a/net/socket/ssl_client_socket_win.h b/net/socket/ssl_client_socket_win.h index 8b3700b..f0503bd 100644 --- a/net/socket/ssl_client_socket_win.h +++ b/net/socket/ssl_client_socket_win.h @@ -39,7 +39,7 @@ class SSLClientSocketWin : public SSLClientSocket { // SSLClientSocket methods: virtual void GetSSLInfo(SSLInfo* ssl_info); virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); - virtual NextProtoStatus GetNextProtocol(std::string* proto); + virtual NextProtoStatus GetNextProto(std::string* proto); // ClientSocket methods: virtual int Connect(CompletionCallback* callback, LoadLog* load_log); |