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

Side by Side Diff: net/cert/internal/cert_issuer_source_aia.cc

Issue 1923433002: Certificate path builder for new certificate verification library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for review comment #20 Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/cert/internal/cert_issuer_source_aia.h" 5 #include "net/cert/internal/cert_issuer_source_aia.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/cert/cert_net_fetcher.h" 8 #include "net/cert/cert_net_fetcher.h"
9 #include "net/cert/internal/parsed_certificate.h"
10 #include "url/gurl.h" 9 #include "url/gurl.h"
11 10
12 namespace net { 11 namespace net {
13 12
14 namespace { 13 namespace {
15 14
16 // TODO(mattm): These are arbitrary choices. Re-evaluate. 15 // TODO(mattm): These are arbitrary choices. Re-evaluate.
17 const int kTimeoutMilliseconds = 10000; 16 const int kTimeoutMilliseconds = 10000;
18 const int kMaxResponseBytes = 65536; 17 const int kMaxResponseBytes = 65536;
19 const int kMaxFetchesPerCert = 5; 18 const int kMaxFetchesPerCert = 5;
(...skipping 10 matching lines...) Expand all
30 std::unique_ptr<CertNetFetcher::Request> cert_fetcher_request); 29 std::unique_ptr<CertNetFetcher::Request> cert_fetcher_request);
31 30
32 void OnFetchCompleted(Error error, const std::vector<uint8_t>& fetched_bytes); 31 void OnFetchCompleted(Error error, const std::vector<uint8_t>& fetched_bytes);
33 32
34 private: 33 private:
35 bool HasNext() const { return current_result_ < results_.size(); } 34 bool HasNext() const { return current_result_ < results_.size(); }
36 35
37 CertIssuerSource::IssuerCallback issuers_callback_; 36 CertIssuerSource::IssuerCallback issuers_callback_;
38 std::vector<std::unique_ptr<CertNetFetcher::Request>> cert_fetcher_requests_; 37 std::vector<std::unique_ptr<CertNetFetcher::Request>> cert_fetcher_requests_;
39 size_t pending_requests_ = 0; 38 size_t pending_requests_ = 0;
40 std::vector<scoped_refptr<ParsedCertificate>> results_; 39 ParsedCertificateList results_;
41 size_t current_result_ = 0; 40 size_t current_result_ = 0;
42 41
43 DISALLOW_COPY_AND_ASSIGN(AiaRequest); 42 DISALLOW_COPY_AND_ASSIGN(AiaRequest);
44 }; 43 };
45 44
46 AiaRequest::AiaRequest(const CertIssuerSource::IssuerCallback& issuers_callback) 45 AiaRequest::AiaRequest(const CertIssuerSource::IssuerCallback& issuers_callback)
47 : issuers_callback_(issuers_callback) {} 46 : issuers_callback_(issuers_callback) {}
48 47
49 AiaRequest::~AiaRequest() = default; 48 AiaRequest::~AiaRequest() = default;
50 49
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 issuers_callback_.Run(this); 101 issuers_callback_.Run(this);
103 } 102 }
104 103
105 } // namespace 104 } // namespace
106 105
107 CertIssuerSourceAia::CertIssuerSourceAia(CertNetFetcher* cert_fetcher) 106 CertIssuerSourceAia::CertIssuerSourceAia(CertNetFetcher* cert_fetcher)
108 : cert_fetcher_(cert_fetcher) {} 107 : cert_fetcher_(cert_fetcher) {}
109 108
110 CertIssuerSourceAia::~CertIssuerSourceAia() = default; 109 CertIssuerSourceAia::~CertIssuerSourceAia() = default;
111 110
112 void CertIssuerSourceAia::SyncGetIssuersOf( 111 void CertIssuerSourceAia::SyncGetIssuersOf(const ParsedCertificate* cert,
113 const ParsedCertificate* cert, 112 ParsedCertificateList* issuers) {
114 std::vector<scoped_refptr<ParsedCertificate>>* issuers) {
115 // CertIssuerSourceAia never returns synchronous results. 113 // CertIssuerSourceAia never returns synchronous results.
116 } 114 }
117 115
118 void CertIssuerSourceAia::AsyncGetIssuersOf( 116 void CertIssuerSourceAia::AsyncGetIssuersOf(
119 const ParsedCertificate* cert, 117 const ParsedCertificate* cert,
120 const IssuerCallback& issuers_callback, 118 const IssuerCallback& issuers_callback,
121 std::unique_ptr<Request>* out_req) { 119 std::unique_ptr<Request>* out_req) {
122 out_req->reset(); 120 out_req->reset();
123 121
124 if (!cert->has_authority_info_access()) 122 if (!cert->has_authority_info_access())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers( 158 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers(
161 url, kTimeoutMilliseconds, kMaxResponseBytes, 159 url, kTimeoutMilliseconds, kMaxResponseBytes,
162 base::Bind(&AiaRequest::OnFetchCompleted, 160 base::Bind(&AiaRequest::OnFetchCompleted,
163 base::Unretained(aia_request.get())))); 161 base::Unretained(aia_request.get()))));
164 } 162 }
165 163
166 *out_req = std::move(aia_request); 164 *out_req = std::move(aia_request);
167 } 165 }
168 166
169 } // namespace net 167 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/cert_issuer_source_aia.h ('k') | net/cert/internal/cert_issuer_source_aia_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698