| 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 origin_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) { | 15 origin_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( | 18 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( |
| 19 const std::string& proto_string) { | 19 const std::string& proto_string) { |
| 20 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 20 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 21 return kProtoHTTP11; | 21 return kProtoHTTP11; |
| 22 } else if (proto_string == "spdy/1") { | 22 } else if (proto_string == "spdy/1") { |
| 23 return kProtoSPDY1; | 23 return kProtoSPDY1; |
| 24 } else if (proto_string == "spdy/2") { | 24 } else if (proto_string == "spdy/2") { |
| 25 return kProtoSPDY2; | 25 return kProtoSPDY2; |
| 26 } else if (proto_string == "spdy/2.1") { | 26 } else if (proto_string == "spdy/2.1") { |
| 27 return kProtoSPDY21; | 27 return kProtoSPDY21; |
| 28 } else if (proto_string == "spdy/3") { |
| 29 return kProtoSPDY3; |
| 28 } else { | 30 } else { |
| 29 return kProtoUnknown; | 31 return kProtoUnknown; |
| 30 } | 32 } |
| 31 } | 33 } |
| 32 | 34 |
| 33 const char* SSLClientSocket::NextProtoToString( | 35 const char* SSLClientSocket::NextProtoToString( |
| 34 SSLClientSocket::NextProto next_proto) { | 36 SSLClientSocket::NextProto next_proto) { |
| 35 switch (next_proto) { | 37 switch (next_proto) { |
| 36 case kProtoHTTP11: | 38 case kProtoHTTP11: |
| 37 return "http/1.1"; | 39 return "http/1.1"; |
| 38 case kProtoSPDY1: | 40 case kProtoSPDY1: |
| 39 return "spdy/1"; | 41 return "spdy/1"; |
| 40 case kProtoSPDY2: | 42 case kProtoSPDY2: |
| 41 return "spdy/2"; | 43 return "spdy/2"; |
| 42 case kProtoSPDY21: | 44 case kProtoSPDY21: |
| 43 return "spdy/2.1"; | 45 return "spdy/2.1"; |
| 46 case kProtoSPDY3: |
| 47 return "spdy/3"; |
| 44 default: | 48 default: |
| 45 break; | 49 break; |
| 46 } | 50 } |
| 47 return "unknown"; | 51 return "unknown"; |
| 48 } | 52 } |
| 49 | 53 |
| 50 // static | 54 // static |
| 51 const char* SSLClientSocket::NextProtoStatusToString( | 55 const char* SSLClientSocket::NextProtoStatusToString( |
| 52 const SSLClientSocket::NextProtoStatus status) { | 56 const SSLClientSocket::NextProtoStatus status) { |
| 53 switch (status) { | 57 switch (status) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 SSLClientCertType SSLClientSocket::origin_bound_cert_type() const { | 131 SSLClientCertType SSLClientSocket::origin_bound_cert_type() const { |
| 128 return origin_bound_cert_type_; | 132 return origin_bound_cert_type_; |
| 129 } | 133 } |
| 130 | 134 |
| 131 SSLClientCertType SSLClientSocket::set_origin_bound_cert_type( | 135 SSLClientCertType SSLClientSocket::set_origin_bound_cert_type( |
| 132 SSLClientCertType type) { | 136 SSLClientCertType type) { |
| 133 return origin_bound_cert_type_ = type; | 137 return origin_bound_cert_type_ = type; |
| 134 } | 138 } |
| 135 | 139 |
| 136 } // namespace net | 140 } // namespace net |
| OLD | NEW |