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

Side by Side Diff: net/ssl/server_bound_cert_service.cc

Issue 338093012: Fix SSLClientSocketOpenSSL error-handling for Channel ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wtc comments Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/ssl/server_bound_cert_service.h" 5 #include "net/ssl/server_bound_cert_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 // See if a request for the same domain is currently in flight. 420 // See if a request for the same domain is currently in flight.
421 bool create_if_missing = true; 421 bool create_if_missing = true;
422 if (JoinToInFlightRequest(request_start, domain, private_key, cert, 422 if (JoinToInFlightRequest(request_start, domain, private_key, cert,
423 create_if_missing, callback, out_req)) { 423 create_if_missing, callback, out_req)) {
424 return ERR_IO_PENDING; 424 return ERR_IO_PENDING;
425 } 425 }
426 426
427 int err = LookupDomainBoundCert(request_start, domain, private_key, cert, 427 int err = LookupDomainBoundCert(request_start, domain, private_key, cert,
428 create_if_missing, callback, out_req); 428 create_if_missing, callback, out_req);
429 if (err == ERR_FILE_NOT_FOUND) { 429 if (err == ERR_FILE_NOT_FOUND) {
wtc 2014/06/20 00:21:54 We set create_if_missing to true on line 421 and p
davidben 2014/06/20 20:05:57 Yeah, GetOrCreateDomainBoundCert does a create_if_
430 // Sync lookup did not find a valid cert. Start generating a new one. 430 // Sync lookup did not find a valid cert. Start generating a new one.
431 workers_created_++; 431 workers_created_++;
432 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( 432 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker(
433 domain, 433 domain,
434 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, 434 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert,
435 weak_ptr_factory_.GetWeakPtr())); 435 weak_ptr_factory_.GetWeakPtr()));
436 if (!worker->Start(task_runner_)) { 436 if (!worker->Start(task_runner_)) {
437 // TODO(rkn): Log to the NetLog. 437 // TODO(rkn): Log to the NetLog.
438 LOG(ERROR) << "ServerBoundCertServiceWorker couldn't be started."; 438 LOG(ERROR) << "ServerBoundCertServiceWorker couldn't be started.";
439 RecordGetDomainBoundCertResult(WORKER_FAILURE); 439 RecordGetDomainBoundCertResult(WORKER_FAILURE);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 if (err == OK) { 511 if (err == OK) {
512 // Async DB lookup found a valid cert. 512 // Async DB lookup found a valid cert.
513 DVLOG(1) << "Cert store had valid cert for " << server_identifier; 513 DVLOG(1) << "Cert store had valid cert for " << server_identifier;
514 cert_store_hits_++; 514 cert_store_hits_++;
515 // ServerBoundCertServiceRequest::Post will do the histograms and stuff. 515 // ServerBoundCertServiceRequest::Post will do the histograms and stuff.
516 HandleResult(OK, server_identifier, key, cert); 516 HandleResult(OK, server_identifier, key, cert);
517 return; 517 return;
518 } 518 }
519 // Async lookup did not find a valid cert. If no request asked to create one, 519 // Async lookup failed or was missing. Return the error directly, unless the
wtc 2014/06/20 00:21:54 Nit: add "the certificate" after "or".
davidben 2014/06/20 20:05:57 Done.
520 // return the error directly. 520 // certificate was missing and a request asked to create one.
521 if (!j->second->CreateIfMissing()) { 521 if (err != ERR_FILE_NOT_FOUND || !j->second->CreateIfMissing()) {
522 HandleResult(err, server_identifier, key, cert); 522 HandleResult(err, server_identifier, key, cert);
523 return; 523 return;
524 } 524 }
525 // At least one request asked to create a cert => start generating a new one. 525 // At least one request asked to create a cert => start generating a new one.
526 workers_created_++; 526 workers_created_++;
527 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( 527 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker(
528 server_identifier, 528 server_identifier,
529 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, 529 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert,
530 weak_ptr_factory_.GetWeakPtr())); 530 weak_ptr_factory_.GetWeakPtr()));
531 if (!worker->Start(task_runner_)) { 531 if (!worker->Start(task_runner_)) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 667 }
668 668
669 return err; 669 return err;
670 } 670 }
671 671
672 int ServerBoundCertService::cert_count() { 672 int ServerBoundCertService::cert_count() {
673 return server_bound_cert_store_->GetCertCount(); 673 return server_bound_cert_store_->GetCertCount();
674 } 674 }
675 675
676 } // namespace net 676 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698