diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 00:19:38 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 00:19:38 +0000 |
commit | 88e7d5688f95703ac9a6ddac4752098c407223e5 (patch) | |
tree | 9e10232d9348bf1e3c2f739cacfb06669dfdef64 /chrome/browser/renderer_host/resource_dispatcher_host.cc | |
parent | a5ded246b87ab09ebcf770ffc5c157fb4efaddac (diff) | |
download | chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.zip chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.tar.gz chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.tar.bz2 |
This CL adds a way to specify the security info when canceling a URLRequest.
This allows to tag a request on the renderer side with its security info. It is useful for the "frame info" dialog.
When showing that dialog for blocked frames, the security info can be retrieved and users can see the cert details for the blocked frame.
TEST=Open a page containing a frame served over bad HTTPS. The frame is blocked (replaced with a warning message). Right-click, select "Frame info". The dialog should have a "show cert" button which when pressed should show the frame's bad cert.
BUG=2853
Review URL: http://codereview.chromium.org/7276
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/resource_dispatcher_host.cc')
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index ba161e4..4245054 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -205,7 +205,8 @@ bool ResourceDispatcherHost::HandleExternalProtocol(int request_id, handler->OnResponseCompleted(request_id, URLRequestStatus( URLRequestStatus::FAILED, - net::ERR_ABORTED)); + net::ERR_ABORTED), + std::string()); // No security info necessary. return true; } @@ -224,7 +225,9 @@ void ResourceDispatcherHost::BeginRequest( receiver->Send(new ViewMsg_Resource_RequestComplete( render_view_id, request_id, - URLRequestStatus(URLRequestStatus::FAILED, net::ERR_ABORTED))); + URLRequestStatus(URLRequestStatus::FAILED, net::ERR_ABORTED), + std::string())); // No security info needed, connection was not + // established. return; } @@ -232,7 +235,7 @@ void ResourceDispatcherHost::BeginRequest( // requests. Does nothing if they are already loaded. // TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by // starting the load earlier in a BG thread. - plugin_service_->LoadChromePlugins(this); + // plugin_service_->LoadChromePlugins(this); // Construct the event handler. scoped_refptr<ResourceHandler> handler; @@ -919,7 +922,7 @@ void ResourceDispatcherHost::BeginRequestInternal(URLRequest* request, if (memory_cost > max_outstanding_requests_cost_per_process_) { // We call "CancelWithError()" as a way of setting the URLRequest's // status -- it has no effect beyond this, since the request hasn't started. - request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); + request->SimulateError(net::ERR_INSUFFICIENT_RESOURCES); // TODO(eroman): this is kinda funky -- we insert the unstarted request into // |pending_requests_| simply to please OnResponseCompleted(). @@ -1121,8 +1124,19 @@ void ResourceDispatcherHost::OnResponseCompleted(URLRequest* request) { RESOURCE_LOG("OnResponseCompleted: " << request->url().spec()); ExtraRequestInfo* info = ExtraInfoForRequest(request); + std::string security_info; + const net::SSLInfo& ssl_info = request->ssl_info(); + if (ssl_info.cert != NULL) { + int cert_id = CertStore::GetSharedInstance()-> + StoreCert(ssl_info.cert, info->render_process_host_id); + security_info = SSLManager::SerializeSecurityInfo(cert_id, + ssl_info.cert_status, + ssl_info.security_bits); + } + if (info->resource_handler->OnResponseCompleted(info->request_id, - request->status())) { + request->status(), + security_info)) { NotifyResponseCompleted(request, info->render_process_host_id); // The request is complete so we can remove it. |