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

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

Issue 859213006: Cancel client auth requests when not promptable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client-auth-cancel-1
Patch Set: worker_common.js was missing a license header (also a rebase) Created 5 years, 9 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 #include "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 if (request_->load_flags() & net::LOAD_PREFETCH) { 305 if (request_->load_flags() & net::LOAD_PREFETCH) {
306 request_->Cancel(); 306 request_->Cancel();
307 return; 307 return;
308 } 308 }
309 309
310 DCHECK(!ssl_client_auth_handler_) 310 DCHECK(!ssl_client_auth_handler_)
311 << "OnCertificateRequested called with ssl_client_auth_handler pending"; 311 << "OnCertificateRequested called with ssl_client_auth_handler pending";
312 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( 312 ssl_client_auth_handler_.reset(new SSLClientAuthHandler(
313 GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(), 313 GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(),
314 cert_info, base::Bind(&ResourceLoader::ContinueWithCertificate, 314 cert_info, this));
315 weak_ptr_factory_.GetWeakPtr())));
316 ssl_client_auth_handler_->SelectCertificate(); 315 ssl_client_auth_handler_->SelectCertificate();
317 } 316 }
318 317
319 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, 318 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request,
320 const net::SSLInfo& ssl_info, 319 const net::SSLInfo& ssl_info,
321 bool fatal) { 320 bool fatal) {
322 ResourceRequestInfoImpl* info = GetRequestInfo(); 321 ResourceRequestInfoImpl* info = GetRequestInfo();
323 322
324 int render_process_id; 323 int render_process_id;
325 int render_frame_id; 324 int render_frame_id;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 495 }
497 496
498 void ResourceLoader::ContinueSSLRequest() { 497 void ResourceLoader::ContinueSSLRequest() {
499 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 498 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
500 499
501 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); 500 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec();
502 501
503 request_->ContinueDespiteLastError(); 502 request_->ContinueDespiteLastError();
504 } 503 }
505 504
505 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) {
506 DCHECK(ssl_client_auth_handler_);
507 ssl_client_auth_handler_.reset();
508 request_->ContinueWithCertificate(cert);
509 }
510
511 void ResourceLoader::CancelCertificateSelection() {
512 DCHECK(ssl_client_auth_handler_);
513 ssl_client_auth_handler_.reset();
514 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
515 }
516
506 void ResourceLoader::Resume() { 517 void ResourceLoader::Resume() {
507 DCHECK(!is_transferring_); 518 DCHECK(!is_transferring_);
508 519
509 DeferredStage stage = deferred_stage_; 520 DeferredStage stage = deferred_stage_;
510 deferred_stage_ = DEFERRED_NONE; 521 deferred_stage_ = DEFERRED_NONE;
511 switch (stage) { 522 switch (stage) {
512 case DEFERRED_NONE: 523 case DEFERRED_NONE:
513 NOTREACHED(); 524 NOTREACHED();
514 break; 525 break;
515 case DEFERRED_START: 526 case DEFERRED_START:
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 case net::URLRequestStatus::IO_PENDING: 855 case net::URLRequestStatus::IO_PENDING:
845 case net::URLRequestStatus::FAILED: 856 case net::URLRequestStatus::FAILED:
846 status = STATUS_UNDEFINED; 857 status = STATUS_UNDEFINED;
847 break; 858 break;
848 } 859 }
849 860
850 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 861 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
851 } 862 }
852 } 863 }
853 864
854 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) {
855 ssl_client_auth_handler_.reset();
856 request_->ContinueWithCertificate(cert);
857 }
858
859 } // namespace content 865 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader.h ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698