Chromium Code Reviews| 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 <openssl/ssl.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "content/child/ftp_directory_listing_response_delegate.h" | 27 #include "content/child/ftp_directory_listing_response_delegate.h" |
| 28 #include "content/child/request_extra_data.h" | 28 #include "content/child/request_extra_data.h" |
| 29 #include "content/child/resource_dispatcher.h" | 29 #include "content/child/resource_dispatcher.h" |
| 30 #include "content/child/shared_memory_data_consumer_handle.h" | 30 #include "content/child/shared_memory_data_consumer_handle.h" |
| 31 #include "content/child/sync_load_response.h" | 31 #include "content/child/sync_load_response.h" |
| 32 #include "content/child/web_url_request_util.h" | 32 #include "content/child/web_url_request_util.h" |
| 33 #include "content/child/weburlresponse_extradata_impl.h" | 33 #include "content/child/weburlresponse_extradata_impl.h" |
| 34 #include "content/common/resource_messages.h" | 34 #include "content/common/resource_messages.h" |
| 35 #include "content/common/resource_request.h" | 35 #include "content/common/resource_request.h" |
| 36 #include "content/common/resource_request_body_impl.h" | 36 #include "content/common/resource_request_body_impl.h" |
| 37 #include "content/common/security_style_util.h" | |
| 38 #include "content/common/service_worker/service_worker_types.h" | 37 #include "content/common/service_worker/service_worker_types.h" |
| 39 #include "content/common/url_loader.mojom.h" | 38 #include "content/common/url_loader.mojom.h" |
| 40 #include "content/public/child/fixed_received_data.h" | 39 #include "content/public/child/fixed_received_data.h" |
| 41 #include "content/public/child/request_peer.h" | 40 #include "content/public/child/request_peer.h" |
| 42 #include "content/public/common/browser_side_navigation_policy.h" | 41 #include "content/public/common/browser_side_navigation_policy.h" |
| 43 #include "net/base/data_url.h" | 42 #include "net/base/data_url.h" |
| 44 #include "net/base/filename_util.h" | 43 #include "net/base/filename_util.h" |
| 45 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
| 46 #include "net/cert/cert_status_flags.h" | 45 #include "net/cert/cert_status_flags.h" |
| 47 #include "net/cert/ct_sct_to_string.h" | 46 #include "net/cert/ct_sct_to_string.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 "content-type", | 90 "content-type", |
| 92 "content-length", | 91 "content-length", |
| 93 "content-disposition", | 92 "content-disposition", |
| 94 "content-range", | 93 "content-range", |
| 95 "range", | 94 "range", |
| 96 "set-cookie" | 95 "set-cookie" |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 using HeadersVector = ResourceDevToolsInfo::HeadersVector; | 98 using HeadersVector = ResourceDevToolsInfo::HeadersVector; |
| 100 | 99 |
| 100 // TODO(estark): Figure out a way for the embedder to provide the | |
| 101 // security style for a resource. Ideally, the logic for assigning | |
| 102 // per-resource security styles should live in the same place as the | |
| 103 // logic for assigning per-page security styles (which lives in the | |
| 104 // embedder). It would also be nice for the embedder to have the chance | |
| 105 // to control the per-resource security style beyond the simple logic | |
| 106 // here. (For example, the embedder might want to mark certain resources | |
| 107 // differently if they use SHA1 signatures.) https://crbug.com/648326 | |
| 108 SecurityStyle GetSecurityStyleForResource(const GURL& url, | |
| 109 net::CertStatus cert_status) { | |
| 110 if (!url.SchemeIsCryptographic()) | |
| 111 return SECURITY_STYLE_UNAUTHENTICATED; | |
| 112 | |
| 113 // Minor errors don't lower the security style to | |
| 114 // SECURITY_STYLE_AUTHENTICATION_BROKEN. | |
| 115 if (net::IsCertStatusError(cert_status) && | |
| 116 !net::IsCertStatusMinorError(cert_status)) { | |
| 117 return SECURITY_STYLE_AUTHENTICATION_BROKEN; | |
| 118 } | |
| 119 | |
| 120 return SECURITY_STYLE_AUTHENTICATED; | |
| 121 } | |
| 122 | |
| 101 // Converts timing data from |load_timing| to the format used by WebKit. | 123 // Converts timing data from |load_timing| to the format used by WebKit. |
| 102 void PopulateURLLoadTiming(const net::LoadTimingInfo& load_timing, | 124 void PopulateURLLoadTiming(const net::LoadTimingInfo& load_timing, |
| 103 WebURLLoadTiming* url_timing) { | 125 WebURLLoadTiming* url_timing) { |
| 104 DCHECK(!load_timing.request_start.is_null()); | 126 DCHECK(!load_timing.request_start.is_null()); |
| 105 | 127 |
| 106 const TimeTicks kNullTicks; | 128 const TimeTicks kNullTicks; |
| 107 url_timing->initialize(); | 129 url_timing->initialize(); |
| 108 url_timing->setRequestTime( | 130 url_timing->setRequestTime( |
| 109 (load_timing.request_start - kNullTicks).InSecondsF()); | 131 (load_timing.request_start - kNullTicks).InSecondsF()); |
| 110 url_timing->setProxyStart( | 132 url_timing->setProxyStart( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 const char* key_exchange_group = ""; | 272 const char* key_exchange_group = ""; |
| 251 if (info.ssl_key_exchange_group != 0) { | 273 if (info.ssl_key_exchange_group != 0) { |
| 252 // Historically the field was named 'curve' rather than 'group'. | 274 // Historically the field was named 'curve' rather than 'group'. |
| 253 key_exchange_group = SSL_get_curve_name(info.ssl_key_exchange_group); | 275 key_exchange_group = SSL_get_curve_name(info.ssl_key_exchange_group); |
| 254 if (!key_exchange_group) { | 276 if (!key_exchange_group) { |
| 255 NOTREACHED(); | 277 NOTREACHED(); |
| 256 key_exchange_group = ""; | 278 key_exchange_group = ""; |
| 257 } | 279 } |
| 258 } | 280 } |
| 259 | 281 |
| 260 SecurityStyle security_style = GetSecurityStyleForResource( | 282 SecurityStyle security_style = |
| 261 url, true, info.cert_status); | 283 GetSecurityStyleForResource(url, info.cert_status); |
|
estark
2016/10/06 22:00:17
note that this is only for devtools (thereby stick
| |
| 262 | 284 |
| 263 blink::WebURLResponse::SecurityStyle security_style_blink = | 285 blink::WebURLResponse::SecurityStyle security_style_blink = |
| 264 WebURLResponse::SecurityStyleUnknown; | 286 WebURLResponse::SecurityStyleUnknown; |
| 265 switch (security_style) { | 287 switch (security_style) { |
| 266 case SECURITY_STYLE_UNKNOWN: | 288 case SECURITY_STYLE_UNKNOWN: |
| 267 security_style_blink = WebURLResponse::SecurityStyleUnknown; | 289 security_style_blink = WebURLResponse::SecurityStyleUnknown; |
| 268 break; | 290 break; |
| 269 case SECURITY_STYLE_UNAUTHENTICATED: | 291 case SECURITY_STYLE_UNAUTHENTICATED: |
| 270 security_style_blink = WebURLResponse::SecurityStyleUnauthenticated; | 292 security_style_blink = WebURLResponse::SecurityStyleUnauthenticated; |
| 271 break; | 293 break; |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1269 response->clearHTTPHeaderField(webStringName); | 1291 response->clearHTTPHeaderField(webStringName); |
| 1270 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1292 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
| 1271 response->addHTTPHeaderField(webStringName, | 1293 response->addHTTPHeaderField(webStringName, |
| 1272 WebString::fromLatin1(value)); | 1294 WebString::fromLatin1(value)); |
| 1273 } | 1295 } |
| 1274 } | 1296 } |
| 1275 return true; | 1297 return true; |
| 1276 } | 1298 } |
| 1277 | 1299 |
| 1278 } // namespace content | 1300 } // namespace content |
| OLD | NEW |