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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 794563003: Change next_proto member type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix type in callback. Created 6 years 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_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 4e86c055932ed7517600625db0179d13ee720029..99ffab320597b5f3d64d5627a8a7e37f15a1dee8 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -1782,11 +1782,11 @@ int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out,
// For each protocol in server preference order, see if we support it.
for (unsigned int i = 0; i < inlen; i += in[i] + 1) {
- for (std::vector<std::string>::const_iterator
- j = ssl_config_.next_protos.begin();
+ for (NextProtoVector::const_iterator j = ssl_config_.next_protos.begin();
j != ssl_config_.next_protos.end(); ++j) {
Ryan Hamilton 2014/12/10 20:09:00 for (NextProto next_proto : ssl_config_.next_proto
Bence 2014/12/10 22:01:23 Done.
- if (in[i] == j->size() &&
- memcmp(&in[i + 1], j->data(), in[i]) == 0) {
+ const std::string proto = NextProtoToString(*j);
+ if (in[i] == proto.size() &&
+ memcmp(&in[i + 1], proto.data(), in[i]) == 0) {
// We found a match.
*out = const_cast<unsigned char*>(in) + i + 1;
*outlen = in[i];
@@ -1800,9 +1800,9 @@ int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out,
// If we didn't find a protocol, we select the first one from our list.
if (npn_status_ == kNextProtoNoOverlap) {
- *out = reinterpret_cast<uint8*>(const_cast<char*>(
- ssl_config_.next_protos[0].data()));
- *outlen = ssl_config_.next_protos[0].size();
+ const std::string proto = NextProtoToString(ssl_config_.next_protos[0]);
+ *out = reinterpret_cast<uint8*>(const_cast<char*>(proto.data()));
+ *outlen = proto.size();
}
npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen);

Powered by Google App Engine
This is Rietveld 408576698