Index: net/socket/ssl_client_socket_openssl.cc |
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc |
index a2e3a1974b31c3d4972db78155ab964e836c90e2..597133b72c4d1c2c71937a3716d14ec273467e0d 100644 |
--- a/net/socket/ssl_client_socket_openssl.cc |
+++ b/net/socket/ssl_client_socket_openssl.cc |
@@ -798,10 +798,24 @@ int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out, |
return SSL_TLSEXT_ERR_OK; |
} |
- int status = SSL_select_next_proto( |
- out, outlen, in, inlen, |
- reinterpret_cast<const unsigned char*>(ssl_config_.next_protos.data()), |
- ssl_config_.next_protos.size()); |
+ int status = OPENSSL_NPN_NO_OVERLAP; |
+ *out = (unsigned char *) in + 1; |
Ryan Sleevi
2011/11/06 02:39:48
BUG? Without checking the implementation of SSL_se
Jing Zhao
2011/11/07 03:42:49
Done.
|
+ *outlen = in[0]; |
+ for (unsigned int i = 0; i < inlen; i += in[i] + 1) { |
+ for (std::vector<std::string>::const_iterator |
+ j = ssl_config_.next_protos.begin(); |
+ j != ssl_config_.next_protos.end(); j++) { |
Ryan Sleevi
2011/11/06 02:39:48
nit: ++j
Jing Zhao
2011/11/07 03:42:49
Done.
|
+ if (in[i] == j->size() && |
+ memcmp(&in[i + 1], j->data(), in[i]) == 0) { |
Ryan Sleevi
2011/11/06 02:39:48
I'm a little nervous, quite possibly unreasonably
Jing Zhao
2011/11/07 03:42:49
Yes, I double checked the implementation from thir
joth
2011/11/08 10:05:23
FWIW, as we have a more expressive class library t
Ryan Sleevi
2011/11/08 15:03:23
+1 to using StringPiece - it would definitely help
|
+ *out = (unsigned char *) in + i + 1; |
+ *outlen = in[i]; |
+ status = OPENSSL_NPN_NEGOTIATED; |
+ break; |
+ } |
+ } |
+ if (status == OPENSSL_NPN_NEGOTIATED) |
+ break; |
+ } |
npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen); |
switch (status) { |