| 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/channel_id_service.h" | 11 #include "net/ssl/channel_id_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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 82 } |
| 82 | 83 |
| 83 bool SSLClientSocket::WasNpnNegotiated() const { | 84 bool SSLClientSocket::WasNpnNegotiated() const { |
| 84 return was_npn_negotiated_; | 85 return was_npn_negotiated_; |
| 85 } | 86 } |
| 86 | 87 |
| 87 NextProto SSLClientSocket::GetNegotiatedProtocol() const { | 88 NextProto SSLClientSocket::GetNegotiatedProtocol() const { |
| 88 return protocol_negotiated_; | 89 return protocol_negotiated_; |
| 89 } | 90 } |
| 90 | 91 |
| 92 // static |
| 93 std::string SSLClientSocket::CreateSessionCacheKey( |
| 94 const HostPortPair& host_and_port, |
| 95 const std::string& ssl_session_cache_shard) { |
| 96 std::string result = host_and_port.ToString(); |
| 97 result.append("/"); |
| 98 result.append(ssl_session_cache_shard); |
| 99 return result; |
| 100 } |
| 101 |
| 91 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { | 102 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
| 92 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) | 103 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
| 93 return true; | 104 return true; |
| 94 | 105 |
| 95 if (error == ERR_CERT_COMMON_NAME_INVALID && | 106 if (error == ERR_CERT_COMMON_NAME_INVALID && |
| 96 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) | 107 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) |
| 97 return true; | 108 return true; |
| 98 | 109 |
| 99 if (error == ERR_CERT_DATE_INVALID && | 110 if (error == ERR_CERT_DATE_INVALID && |
| 100 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) | 111 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 wire_protos.resize(wire_protos.size() + i->size()); | 236 wire_protos.resize(wire_protos.size() + i->size()); |
| 226 memcpy(&wire_protos[wire_protos.size() - i->size()], | 237 memcpy(&wire_protos[wire_protos.size() - i->size()], |
| 227 i->data(), i->size()); | 238 i->data(), i->size()); |
| 228 } | 239 } |
| 229 DCHECK_EQ(wire_protos.size(), wire_length); | 240 DCHECK_EQ(wire_protos.size(), wire_length); |
| 230 | 241 |
| 231 return wire_protos; | 242 return wire_protos; |
| 232 } | 243 } |
| 233 | 244 |
| 234 } // namespace net | 245 } // namespace net |
| OLD | NEW |