Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2239273002: Don't use SSLStatus from FrameHostMsg_DidCommitProvisionalLoad and instead cache it on the browser … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (frame_host) 415 if (frame_host)
416 routing_ids->insert(frame_host->GetGlobalFrameRoutingId()); 416 routing_ids->insert(frame_host->GetGlobalFrameRoutingId());
417 if (pending_frame_host) 417 if (pending_frame_host)
418 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); 418 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId());
419 } 419 }
420 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 420 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
421 base::Bind(&NotifyForRouteSetOnIO, frame_callback, 421 base::Bind(&NotifyForRouteSetOnIO, frame_callback,
422 base::Passed(std::move(routing_ids)))); 422 base::Passed(std::move(routing_ids))));
423 } 423 }
424 424
425 void SetTransferredRFHSSLStatus(int render_process_id,
426 int render_frame_id,
427 const GURL& url,
428 const SSLStatus& ssl_status) {
429 RenderFrameHostImpl* rfh =
430 RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
431 if (rfh)
432 rfh->SetSSLStatusForPendingNavigate(url, ssl_status);
433 }
434
425 } // namespace 435 } // namespace
426 436
427 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} 437 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {}
428 438
429 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} 439 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {}
430 440
431 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( 441 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo(
432 const HeaderInterceptorInfo& other) {} 442 const HeaderInterceptorInfo& other) {}
433 443
434 // static 444 // static
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 // ResourceRequestInfo rather than caching it locally. This lets us update 1211 // ResourceRequestInfo rather than caching it locally. This lets us update
1202 // the info object when a transfer occurs. 1212 // the info object when a transfer occurs.
1203 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id, 1213 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id,
1204 request_data.origin_pid, request_id, 1214 request_data.origin_pid, request_id,
1205 filter_->GetWeakPtr()); 1215 filter_->GetWeakPtr());
1206 1216
1207 // If a certificate is stored with the ResourceResponse, it has to be 1217 // If a certificate is stored with the ResourceResponse, it has to be
1208 // updated to be associated with the new process. 1218 // updated to be associated with the new process.
1209 if (loader->transferring_response()) { 1219 if (loader->transferring_response()) {
1210 UpdateResponseCertificateForTransfer(loader->transferring_response(), 1220 UpdateResponseCertificateForTransfer(loader->transferring_response(),
1211 loader->request()->ssl_info(), 1221 loader->request(),
1212 child_id); 1222 info);
1213 } 1223 }
1214 1224
1215 // Update maps that used the old IDs, if necessary. Some transfers in tests 1225 // Update maps that used the old IDs, if necessary. Some transfers in tests
1216 // do not actually use a different ID, so not all maps need to be updated. 1226 // do not actually use a different ID, so not all maps need to be updated.
1217 pending_loaders_[new_request_id] = std::move(loader); 1227 pending_loaders_[new_request_id] = std::move(loader);
1218 IncrementOutstandingRequestsMemory(1, *info); 1228 IncrementOutstandingRequestsMemory(1, *info);
1219 if (should_update_count) 1229 if (should_update_count)
1220 IncrementOutstandingRequestsCount(1, info); 1230 IncrementOutstandingRequestsCount(1, info);
1221 if (old_routing_id != new_routing_id) { 1231 if (old_routing_id != new_routing_id) {
1222 if (blocked_loaders_map_.find(old_routing_id) != 1232 if (blocked_loaders_map_.find(old_routing_id) !=
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 } 2651 }
2642 2652
2643 if (is_sync_load) 2653 if (is_sync_load)
2644 load_flags |= net::LOAD_IGNORE_LIMITS; 2654 load_flags |= net::LOAD_IGNORE_LIMITS;
2645 2655
2646 return load_flags; 2656 return load_flags;
2647 } 2657 }
2648 2658
2649 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( 2659 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer(
2650 ResourceResponse* response, 2660 ResourceResponse* response,
2651 const net::SSLInfo& ssl_info, 2661 net::URLRequest* request,
2652 int child_id) { 2662 ResourceRequestInfoImpl* info) {
2663 const net::SSLInfo& ssl_info = request->ssl_info();
2653 if (!ssl_info.cert) 2664 if (!ssl_info.cert)
2654 return; 2665 return;
2655 SSLStatus ssl; 2666 SSLStatus ssl;
2656 // DeserializeSecurityInfo() often takes security info sent by a 2667 // DeserializeSecurityInfo() often takes security info sent by a
2657 // renderer as input, in which case it's important to check that the 2668 // renderer as input, in which case it's important to check that the
2658 // security info deserializes properly and kill the renderer if 2669 // security info deserializes properly and kill the renderer if
2659 // not. In this case, however, the security info has been provided by 2670 // not. In this case, however, the security info has been provided by
2660 // the ResourceLoader, so it does not need to be treated as untrusted 2671 // the ResourceLoader, so it does not need to be treated as untrusted
2661 // data. 2672 // data.
2662 bool deserialized = 2673 bool deserialized =
2663 DeserializeSecurityInfo(response->head.security_info, &ssl); 2674 DeserializeSecurityInfo(response->head.security_info, &ssl);
2664 DCHECK(deserialized); 2675 DCHECK(deserialized);
2665 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2676 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(),
2677 info->GetChildID());
2666 response->head.security_info = SerializeSecurityInfo(ssl); 2678 response->head.security_info = SerializeSecurityInfo(ssl);
2679
2680 if (info->GetResourceType() != RESOURCE_TYPE_MAIN_FRAME)
2681 return;
2682
2683 // TODO(jam): eventually we'll get rid of this serialized SSLStatus in the
2684 // response and won't send it to the child process. So for preparation, don't
2685 // use it below.
2686 SSLStatus ssl_status;
2687 ResourceLoader::GetSSLStatusForRequest(
2688 request->url(), ssl_info, info->GetChildID(),
2689 ResourceDispatcherHostImpl::Get()->GetCertStore(), &ssl_status);
2690
2691 BrowserThread::PostTask(BrowserThread::UI,
2692 FROM_HERE,
2693 base::Bind(SetTransferredRFHSSLStatus,
2694 info->GetChildID(),
2695 info->GetRenderFrameID(),
2696 request->url(),
2697 ssl_status));
2667 } 2698 }
2668 2699
2669 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2700 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2670 return cert_store_for_testing_ ? cert_store_for_testing_ 2701 return cert_store_for_testing_ ? cert_store_for_testing_
2671 : CertStore::GetInstance(); 2702 : CertStore::GetInstance();
2672 } 2703 }
2673 2704
2674 bool ResourceDispatcherHostImpl::ShouldServiceRequest( 2705 bool ResourceDispatcherHostImpl::ShouldServiceRequest(
2675 int process_type, 2706 int process_type,
2676 int child_id, 2707 int child_id,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 << iter->filesystem_url().spec(); 2753 << iter->filesystem_url().spec();
2723 return false; 2754 return false;
2724 } 2755 }
2725 } 2756 }
2726 } 2757 }
2727 } 2758 }
2728 return true; 2759 return true;
2729 } 2760 }
2730 2761
2731 } // namespace content 2762 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698