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/ssl/server_bound_cert_service.h" | 10 #include "net/ssl/server_bound_cert_service.h" |
11 #include "net/ssl/ssl_config_service.h" | 11 #include "net/ssl/ssl_config_service.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 SSLClientSocket::SSLClientSocket() | 15 SSLClientSocket::SSLClientSocket() |
16 : was_npn_negotiated_(false), | 16 : was_npn_negotiated_(false), |
17 was_spdy_negotiated_(false), | 17 was_spdy_negotiated_(false), |
18 protocol_negotiated_(kProtoUnknown), | 18 protocol_negotiated_(kProtoUnknown), |
19 channel_id_sent_(false), | 19 channel_id_sent_(false), |
20 signed_cert_timestamps_received_(false), | 20 signed_cert_timestamps_received_(false) { |
21 stapled_ocsp_response_received_(false) { | |
22 } | 21 } |
23 | 22 |
24 // static | 23 // static |
25 NextProto SSLClientSocket::NextProtoFromString( | 24 NextProto SSLClientSocket::NextProtoFromString( |
26 const std::string& proto_string) { | 25 const std::string& proto_string) { |
27 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 26 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
28 return kProtoHTTP11; | 27 return kProtoHTTP11; |
29 } else if (proto_string == "spdy/2") { | 28 } else if (proto_string == "spdy/2") { |
30 return kProtoDeprecatedSPDY2; | 29 return kProtoDeprecatedSPDY2; |
31 } else if (proto_string == "spdy/3") { | 30 } else if (proto_string == "spdy/3") { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 138 } |
140 | 139 |
141 bool SSLClientSocket::WasChannelIDSent() const { | 140 bool SSLClientSocket::WasChannelIDSent() const { |
142 return channel_id_sent_; | 141 return channel_id_sent_; |
143 } | 142 } |
144 | 143 |
145 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { | 144 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { |
146 channel_id_sent_ = channel_id_sent; | 145 channel_id_sent_ = channel_id_sent; |
147 } | 146 } |
148 | 147 |
| 148 bool SSLClientSocket::WereSignedCertTimestampsReceived() const { |
| 149 return signed_cert_timestamps_received_; |
| 150 } |
| 151 |
149 void SSLClientSocket::set_signed_cert_timestamps_received( | 152 void SSLClientSocket::set_signed_cert_timestamps_received( |
150 bool signed_cert_timestamps_received) { | 153 bool signed_cert_timestamps_received) { |
151 signed_cert_timestamps_received_ = signed_cert_timestamps_received; | 154 signed_cert_timestamps_received_ = signed_cert_timestamps_received; |
152 } | 155 } |
153 | 156 |
154 void SSLClientSocket::set_stapled_ocsp_response_received( | |
155 bool stapled_ocsp_response_received) { | |
156 stapled_ocsp_response_received_ = stapled_ocsp_response_received; | |
157 } | |
158 | |
159 // static | 157 // static |
160 void SSLClientSocket::RecordChannelIDSupport( | 158 void SSLClientSocket::RecordChannelIDSupport( |
161 ServerBoundCertService* server_bound_cert_service, | 159 ServerBoundCertService* server_bound_cert_service, |
162 bool negotiated_channel_id, | 160 bool negotiated_channel_id, |
163 bool channel_id_enabled, | 161 bool channel_id_enabled, |
164 bool supports_ecc) { | 162 bool supports_ecc) { |
165 // Since this enum is used for a histogram, do not change or re-use values. | 163 // Since this enum is used for a histogram, do not change or re-use values. |
166 enum { | 164 enum { |
167 DISABLED = 0, | 165 DISABLED = 0, |
168 CLIENT_ONLY = 1, | 166 CLIENT_ONLY = 1, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 202 } |
205 if (!server_bound_cert_service->IsSystemTimeValid()) { | 203 if (!server_bound_cert_service->IsSystemTimeValid()) { |
206 DVLOG(1) << "System time is not within the supported range for certificate " | 204 DVLOG(1) << "System time is not within the supported range for certificate " |
207 "generation, not enabling channel ID."; | 205 "generation, not enabling channel ID."; |
208 return false; | 206 return false; |
209 } | 207 } |
210 return true; | 208 return true; |
211 } | 209 } |
212 | 210 |
213 } // namespace net | 211 } // namespace net |
OLD | NEW |