| 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/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/ec_private_key.h" | 10 #include "crypto/ec_private_key.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/socket/ssl_client_socket_impl.h" | 12 #include "net/socket/ssl_client_socket_impl.h" |
| 13 #include "net/ssl/channel_id_service.h" | 13 #include "net/ssl/channel_id_service.h" |
| 14 #include "net/ssl/ssl_config_service.h" | 14 #include "net/ssl/ssl_config_service.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 SSLClientSocket::SSLClientSocket() | 18 SSLClientSocket::SSLClientSocket() |
| 19 : signed_cert_timestamps_received_(false), | 19 : signed_cert_timestamps_received_(false), |
| 20 stapled_ocsp_response_received_(false), | 20 stapled_ocsp_response_received_(false), |
| 21 negotiation_extension_(kExtensionUnknown) { | 21 negotiation_extension_(kExtensionUnknown) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 NextProto SSLClientSocket::NextProtoFromString( | 25 NextProto SSLClientSocket::NextProtoFromString( |
| 26 const std::string& proto_string) { | 26 const std::string& proto_string) { |
| 27 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 27 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 28 return kProtoHTTP11; | 28 return kProtoHTTP11; |
| 29 } else if (proto_string == "spdy/3.1") { | |
| 30 return kProtoSPDY31; | |
| 31 } else if (proto_string == "h2") { | 29 } else if (proto_string == "h2") { |
| 32 return kProtoHTTP2; | 30 return kProtoHTTP2; |
| 33 } else if (proto_string == "quic/1+spdy/3") { | 31 } else if (proto_string == "quic/1+spdy/3") { |
| 34 return kProtoQUIC1SPDY3; | 32 return kProtoQUIC1SPDY3; |
| 35 } else { | 33 } else { |
| 36 return kProtoUnknown; | 34 return kProtoUnknown; |
| 37 } | 35 } |
| 38 } | 36 } |
| 39 | 37 |
| 40 // static | 38 // static |
| 41 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 39 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
| 42 switch (next_proto) { | 40 switch (next_proto) { |
| 43 case kProtoHTTP11: | 41 case kProtoHTTP11: |
| 44 return "http/1.1"; | 42 return "http/1.1"; |
| 45 case kProtoSPDY31: | |
| 46 return "spdy/3.1"; | |
| 47 case kProtoHTTP2: | 43 case kProtoHTTP2: |
| 48 return "h2"; | 44 return "h2"; |
| 49 case kProtoQUIC1SPDY3: | 45 case kProtoQUIC1SPDY3: |
| 50 return "quic/1+spdy/3"; | 46 return "quic/1+spdy/3"; |
| 51 case kProtoUnknown: | 47 case kProtoUnknown: |
| 52 break; | 48 break; |
| 53 } | 49 } |
| 54 return "unknown"; | 50 return "unknown"; |
| 55 } | 51 } |
| 56 | 52 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 wire_protos.push_back(proto.size()); | 172 wire_protos.push_back(proto.size()); |
| 177 for (const char ch : proto) { | 173 for (const char ch : proto) { |
| 178 wire_protos.push_back(static_cast<uint8_t>(ch)); | 174 wire_protos.push_back(static_cast<uint8_t>(ch)); |
| 179 } | 175 } |
| 180 } | 176 } |
| 181 | 177 |
| 182 return wire_protos; | 178 return wire_protos; |
| 183 } | 179 } |
| 184 | 180 |
| 185 } // namespace net | 181 } // namespace net |
| OLD | NEW |