| 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.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
| 10 #include "net/base/host_port_pair.h" |
| 10 #include "net/ssl/server_bound_cert_service.h" | 11 #include "net/ssl/server_bound_cert_service.h" |
| 11 #include "net/ssl/ssl_config_service.h" | 12 #include "net/ssl/ssl_config_service.h" |
| 12 | 13 |
| 13 namespace net { | 14 namespace net { |
| 14 | 15 |
| 15 SSLClientSocket::SSLClientSocket() | 16 SSLClientSocket::SSLClientSocket() |
| 16 : was_npn_negotiated_(false), | 17 : was_npn_negotiated_(false), |
| 17 was_spdy_negotiated_(false), | 18 was_spdy_negotiated_(false), |
| 18 protocol_negotiated_(kProtoUnknown), | 19 protocol_negotiated_(kProtoUnknown), |
| 19 channel_id_sent_(false), | 20 channel_id_sent_(false), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool SSLClientSocket::WasNpnNegotiated() const { | 99 bool SSLClientSocket::WasNpnNegotiated() const { |
| 99 return was_npn_negotiated_; | 100 return was_npn_negotiated_; |
| 100 } | 101 } |
| 101 | 102 |
| 102 NextProto SSLClientSocket::GetNegotiatedProtocol() const { | 103 NextProto SSLClientSocket::GetNegotiatedProtocol() const { |
| 103 return protocol_negotiated_; | 104 return protocol_negotiated_; |
| 104 } | 105 } |
| 105 | 106 |
| 107 // static |
| 108 std::string SSLClientSocket::GetSessionCacheKey( |
| 109 const HostPortPair& host_and_port, |
| 110 const std::string& ssl_session_cache_shard) { |
| 111 std::string result = host_and_port.ToString(); |
| 112 result.append("/"); |
| 113 result.append(ssl_session_cache_shard); |
| 114 return result; |
| 115 } |
| 116 |
| 106 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { | 117 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
| 107 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) | 118 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
| 108 return true; | 119 return true; |
| 109 | 120 |
| 110 if (error == ERR_CERT_COMMON_NAME_INVALID && | 121 if (error == ERR_CERT_COMMON_NAME_INVALID && |
| 111 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) | 122 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) |
| 112 return true; | 123 return true; |
| 113 | 124 |
| 114 if (error == ERR_CERT_DATE_INVALID && | 125 if (error == ERR_CERT_DATE_INVALID && |
| 115 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) | 126 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 215 } |
| 205 if (!server_bound_cert_service->IsSystemTimeValid()) { | 216 if (!server_bound_cert_service->IsSystemTimeValid()) { |
| 206 DVLOG(1) << "System time is not within the supported range for certificate " | 217 DVLOG(1) << "System time is not within the supported range for certificate " |
| 207 "generation, not enabling channel ID."; | 218 "generation, not enabling channel ID."; |
| 208 return false; | 219 return false; |
| 209 } | 220 } |
| 210 return true; | 221 return true; |
| 211 } | 222 } |
| 212 | 223 |
| 213 } // namespace net | 224 } // namespace net |
| OLD | NEW |