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