OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
6 | 6 |
| 7 #include <openssl/ssl.h> |
7 #include <stdint.h> | 8 #include <stdint.h> |
8 | 9 |
9 #include <algorithm> | 10 #include <algorithm> |
10 #include <memory> | 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/bind.h" | 16 #include "base/bind.h" |
16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 bool is_aead; | 250 bool is_aead; |
250 uint16_t cipher_suite = | 251 uint16_t cipher_suite = |
251 net::SSLConnectionStatusToCipherSuite(ssl_status.connection_status); | 252 net::SSLConnectionStatusToCipherSuite(ssl_status.connection_status); |
252 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 253 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
253 cipher_suite); | 254 cipher_suite); |
254 if (mac == NULL) { | 255 if (mac == NULL) { |
255 DCHECK(is_aead); | 256 DCHECK(is_aead); |
256 mac = ""; | 257 mac = ""; |
257 } | 258 } |
258 | 259 |
| 260 const char* key_exchange_group = ""; |
| 261 if (ssl_status.key_exchange_group != 0) { |
| 262 // Historically the field was named 'curve' rather than 'group'. |
| 263 key_exchange_group = SSL_get_curve_name(ssl_status.key_exchange_group); |
| 264 if (!key_exchange_group) { |
| 265 NOTREACHED(); |
| 266 key_exchange_group = ""; |
| 267 } |
| 268 } |
| 269 |
259 blink::WebURLResponse::SecurityStyle securityStyle = | 270 blink::WebURLResponse::SecurityStyle securityStyle = |
260 WebURLResponse::SecurityStyleUnknown; | 271 WebURLResponse::SecurityStyleUnknown; |
261 switch (ssl_status.security_style) { | 272 switch (ssl_status.security_style) { |
262 case SECURITY_STYLE_UNKNOWN: | 273 case SECURITY_STYLE_UNKNOWN: |
263 securityStyle = WebURLResponse::SecurityStyleUnknown; | 274 securityStyle = WebURLResponse::SecurityStyleUnknown; |
264 break; | 275 break; |
265 case SECURITY_STYLE_UNAUTHENTICATED: | 276 case SECURITY_STYLE_UNAUTHENTICATED: |
266 securityStyle = WebURLResponse::SecurityStyleUnauthenticated; | 277 securityStyle = WebURLResponse::SecurityStyleUnauthenticated; |
267 break; | 278 break; |
268 case SECURITY_STYLE_AUTHENTICATION_BROKEN: | 279 case SECURITY_STYLE_AUTHENTICATION_BROKEN: |
(...skipping 10 matching lines...) Expand all Loading... |
279 response->setSecurityStyle(securityStyle); | 290 response->setSecurityStyle(securityStyle); |
280 | 291 |
281 blink::WebURLResponse::SignedCertificateTimestampList sct_list( | 292 blink::WebURLResponse::SignedCertificateTimestampList sct_list( |
282 info.signed_certificate_timestamps.size()); | 293 info.signed_certificate_timestamps.size()); |
283 | 294 |
284 for (size_t i = 0; i < sct_list.size(); ++i) | 295 for (size_t i = 0; i < sct_list.size(); ++i) |
285 sct_list[i] = NetSCTToBlinkSCT(info.signed_certificate_timestamps[i]); | 296 sct_list[i] = NetSCTToBlinkSCT(info.signed_certificate_timestamps[i]); |
286 | 297 |
287 blink::WebURLResponse::WebSecurityDetails webSecurityDetails( | 298 blink::WebURLResponse::WebSecurityDetails webSecurityDetails( |
288 WebString::fromUTF8(protocol), WebString::fromUTF8(key_exchange), | 299 WebString::fromUTF8(protocol), WebString::fromUTF8(key_exchange), |
289 WebString::fromUTF8(cipher), WebString::fromUTF8(mac), ssl_status.cert_id, | 300 WebString::fromUTF8(key_exchange_group), WebString::fromUTF8(cipher), |
290 sct_list); | 301 WebString::fromUTF8(mac), ssl_status.cert_id, sct_list); |
291 | 302 |
292 response->setSecurityDetails(webSecurityDetails); | 303 response->setSecurityDetails(webSecurityDetails); |
293 } | 304 } |
294 | 305 |
295 } // namespace | 306 } // namespace |
296 | 307 |
297 // This inner class exists since the WebURLLoader may be deleted while inside a | 308 // This inner class exists since the WebURLLoader may be deleted while inside a |
298 // call to WebURLLoaderClient. Refcounting is to keep the context from being | 309 // call to WebURLLoaderClient. Refcounting is to keep the context from being |
299 // deleted if it may have work to do after calling into the client. | 310 // deleted if it may have work to do after calling into the client. |
300 class WebURLLoaderImpl::Context : public base::RefCounted<Context> { | 311 class WebURLLoaderImpl::Context : public base::RefCounted<Context> { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 response->clearHTTPHeaderField(webStringName); | 1224 response->clearHTTPHeaderField(webStringName); |
1214 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1225 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
1215 response->addHTTPHeaderField(webStringName, | 1226 response->addHTTPHeaderField(webStringName, |
1216 WebString::fromLatin1(value)); | 1227 WebString::fromLatin1(value)); |
1217 } | 1228 } |
1218 } | 1229 } |
1219 return true; | 1230 return true; |
1220 } | 1231 } |
1221 | 1232 |
1222 } // namespace content | 1233 } // namespace content |
OLD | NEW |