| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 bool is_aead; | 241 bool is_aead; |
| 241 uint16_t cipher_suite = | 242 uint16_t cipher_suite = |
| 242 net::SSLConnectionStatusToCipherSuite(info.ssl_connection_status); | 243 net::SSLConnectionStatusToCipherSuite(info.ssl_connection_status); |
| 243 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 244 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
| 244 cipher_suite); | 245 cipher_suite); |
| 245 if (mac == NULL) { | 246 if (mac == NULL) { |
| 246 DCHECK(is_aead); | 247 DCHECK(is_aead); |
| 247 mac = ""; | 248 mac = ""; |
| 248 } | 249 } |
| 249 | 250 |
| 251 const char* key_exchange_group = ""; |
| 252 if (info.ssl_key_exchange_group != 0) { |
| 253 // Historically the field was named 'curve' rather than 'group'. |
| 254 key_exchange_group = SSL_get_curve_name(info.ssl_key_exchange_group); |
| 255 if (!key_exchange_group) { |
| 256 NOTREACHED(); |
| 257 key_exchange_group = ""; |
| 258 } |
| 259 } |
| 260 |
| 250 SecurityStyle security_style = GetSecurityStyleForResource( | 261 SecurityStyle security_style = GetSecurityStyleForResource( |
| 251 url, true, info.cert_status); | 262 url, true, info.cert_status); |
| 252 | 263 |
| 253 blink::WebURLResponse::SecurityStyle security_style_blink = | 264 blink::WebURLResponse::SecurityStyle security_style_blink = |
| 254 WebURLResponse::SecurityStyleUnknown; | 265 WebURLResponse::SecurityStyleUnknown; |
| 255 switch (security_style) { | 266 switch (security_style) { |
| 256 case SECURITY_STYLE_UNKNOWN: | 267 case SECURITY_STYLE_UNKNOWN: |
| 257 security_style_blink = WebURLResponse::SecurityStyleUnknown; | 268 security_style_blink = WebURLResponse::SecurityStyleUnknown; |
| 258 break; | 269 break; |
| 259 case SECURITY_STYLE_UNAUTHENTICATED: | 270 case SECURITY_STYLE_UNAUTHENTICATED: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 [](const std::string& h) { return blink::WebString::fromLatin1(h); }); | 308 [](const std::string& h) { return blink::WebString::fromLatin1(h); }); |
| 298 | 309 |
| 299 blink::WebVector<blink::WebString> web_cert(info.certificate.size()); | 310 blink::WebVector<blink::WebString> web_cert(info.certificate.size()); |
| 300 std::transform( | 311 std::transform( |
| 301 info.certificate.begin(), | 312 info.certificate.begin(), |
| 302 info.certificate.end(), web_cert.begin(), | 313 info.certificate.end(), web_cert.begin(), |
| 303 [](const std::string& h) { return blink::WebString::fromLatin1(h); }); | 314 [](const std::string& h) { return blink::WebString::fromLatin1(h); }); |
| 304 | 315 |
| 305 blink::WebURLResponse::WebSecurityDetails webSecurityDetails( | 316 blink::WebURLResponse::WebSecurityDetails webSecurityDetails( |
| 306 WebString::fromUTF8(protocol), WebString::fromUTF8(key_exchange), | 317 WebString::fromUTF8(protocol), WebString::fromUTF8(key_exchange), |
| 318 WebString::fromUTF8(key_exchange_group), |
| 307 WebString::fromUTF8(cipher), WebString::fromUTF8(mac), | 319 WebString::fromUTF8(cipher), WebString::fromUTF8(mac), |
| 308 WebString::fromUTF8(subject), | 320 WebString::fromUTF8(subject), |
| 309 web_san, | 321 web_san, |
| 310 WebString::fromUTF8(issuer), | 322 WebString::fromUTF8(issuer), |
| 311 valid_start.ToDoubleT(), | 323 valid_start.ToDoubleT(), |
| 312 valid_expiry.ToDoubleT(), | 324 valid_expiry.ToDoubleT(), |
| 313 web_cert, | 325 web_cert, |
| 314 sct_list); | 326 sct_list); |
| 315 | 327 |
| 316 response->setSecurityDetails(webSecurityDetails); | 328 response->setSecurityDetails(webSecurityDetails); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 response->clearHTTPHeaderField(webStringName); | 1243 response->clearHTTPHeaderField(webStringName); |
| 1232 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1244 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
| 1233 response->addHTTPHeaderField(webStringName, | 1245 response->addHTTPHeaderField(webStringName, |
| 1234 WebString::fromLatin1(value)); | 1246 WebString::fromLatin1(value)); |
| 1235 } | 1247 } |
| 1236 } | 1248 } |
| 1237 return true; | 1249 return true; |
| 1238 } | 1250 } |
| 1239 | 1251 |
| 1240 } // namespace content | 1252 } // namespace content |
| OLD | NEW |