| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 SSLClientSocket::SSLClientSocket() | 11 SSLClientSocket::SSLClientSocket() |
| 12 : was_npn_negotiated_(false), | 12 : was_npn_negotiated_(false), |
| 13 was_spdy_negotiated_(false), | 13 was_spdy_negotiated_(false), |
| 14 protocol_negotiated_(kProtoUnknown), | 14 protocol_negotiated_(kProtoUnknown), |
| 15 domain_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) { | 15 domain_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 NextProto SSLClientSocket::NextProtoFromString( | 19 NextProto SSLClientSocket::NextProtoFromString( |
| 20 const std::string& proto_string) { | 20 const std::string& proto_string) { |
| 21 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 21 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 22 return kProtoHTTP11; | 22 return kProtoHTTP11; |
| 23 } else if (proto_string == "spdy/1") { | 23 } else if (proto_string == "spdy/1") { |
| 24 return kProtoSPDY1; | 24 return kProtoSPDY1; |
| 25 } else if (proto_string == "spdy/2") { | 25 } else if (proto_string == "spdy/2") { |
| 26 return kProtoSPDY2; | 26 return kProtoSPDY2; |
| 27 } else if (proto_string == "spdy/2.1") { | |
| 28 return kProtoSPDY21; | |
| 29 } else if (proto_string == "spdy/3") { | 27 } else if (proto_string == "spdy/3") { |
| 30 return kProtoSPDY3; | 28 return kProtoSPDY3; |
| 31 } else { | 29 } else { |
| 32 return kProtoUnknown; | 30 return kProtoUnknown; |
| 33 } | 31 } |
| 34 } | 32 } |
| 35 | 33 |
| 36 // static | 34 // static |
| 37 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 35 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
| 38 switch (next_proto) { | 36 switch (next_proto) { |
| 39 case kProtoHTTP11: | 37 case kProtoHTTP11: |
| 40 return "http/1.1"; | 38 return "http/1.1"; |
| 41 case kProtoSPDY1: | 39 case kProtoSPDY1: |
| 42 return "spdy/1"; | 40 return "spdy/1"; |
| 43 case kProtoSPDY2: | 41 case kProtoSPDY2: |
| 44 return "spdy/2"; | 42 return "spdy/2"; |
| 45 case kProtoSPDY21: | |
| 46 return "spdy/2.1"; | |
| 47 case kProtoSPDY3: | 43 case kProtoSPDY3: |
| 48 return "spdy/3"; | 44 return "spdy/3"; |
| 49 default: | 45 default: |
| 50 break; | 46 break; |
| 51 } | 47 } |
| 52 return "unknown"; | 48 return "unknown"; |
| 53 } | 49 } |
| 54 | 50 |
| 55 // static | 51 // static |
| 56 const char* SSLClientSocket::NextProtoStatusToString( | 52 const char* SSLClientSocket::NextProtoStatusToString( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 SSLClientCertType SSLClientSocket::domain_bound_cert_type() const { | 127 SSLClientCertType SSLClientSocket::domain_bound_cert_type() const { |
| 132 return domain_bound_cert_type_; | 128 return domain_bound_cert_type_; |
| 133 } | 129 } |
| 134 | 130 |
| 135 SSLClientCertType SSLClientSocket::set_domain_bound_cert_type( | 131 SSLClientCertType SSLClientSocket::set_domain_bound_cert_type( |
| 136 SSLClientCertType type) { | 132 SSLClientCertType type) { |
| 137 return domain_bound_cert_type_ = type; | 133 return domain_bound_cert_type_ = type; |
| 138 } | 134 } |
| 139 | 135 |
| 140 } // namespace net | 136 } // namespace net |
| OLD | NEW |