Chromium Code Reviews| Index: net/socket/ssl_client_socket.cc |
| =================================================================== |
| --- net/socket/ssl_client_socket.cc (revision 112817) |
| +++ net/socket/ssl_client_socket.cc (working copy) |
| @@ -1,9 +1,11 @@ |
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "net/socket/ssl_client_socket.h" |
| +#include "base/string_util.h" |
| + |
| namespace net { |
| SSLClientSocket::SSLClientSocket() |
| @@ -24,6 +26,35 @@ |
| } |
| } |
| +// static |
| +const char* SSLClientSocket::NextProtoStatusToString( |
| + const SSLClientSocket::NextProtoStatus status) { |
| + switch (status) { |
| + case kNextProtoUnsupported: |
| + return "Unsupported"; |
|
agl
2011/12/05 16:38:10
"unsupported"
ramant (doing other things)
2011/12/05 19:03:28
Done.
|
| + case kNextProtoNegotiated: |
| + return "Negotiated"; |
|
agl
2011/12/05 16:38:10
"negotiated"
ramant (doing other things)
2011/12/05 19:03:28
Done.
|
| + case kNextProtoNoOverlap: |
| + return "No overlap"; |
|
agl
2011/12/05 16:38:10
"no-overlap"
ramant (doing other things)
2011/12/05 19:03:28
Done.
|
| + } |
| + return NULL; |
| +} |
| + |
| +// static |
| +std::string SSLClientSocket::ServerProtoToString( |
| + const std::string& server_proto) { |
|
agl
2011/12/05 16:38:10
s
ramant (doing other things)
2011/12/05 19:03:28
Done.
|
| + const char* protos = server_proto.c_str(); |
| + size_t protos_len = server_proto.length(); |
| + std::vector<std::string> server_protos; |
| + for (size_t i = 0; i < protos_len; ) { |
| + const size_t len = protos[i]; |
| + std::string proto_str(&protos[i + 1], len); |
| + server_protos.push_back(proto_str); |
| + i += len + 1; |
| + } |
| + return JoinString(server_protos, ','); |
| +} |
| + |
| bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
| if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
| return true; |