| OLD | NEW |
| 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 "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // TODO(mattm): propagate error info. | 92 // TODO(mattm): propagate error info. |
| 93 LOG(ERROR) << "Error parsing AIA data"; | 93 LOG(ERROR) << "Error parsing AIA data"; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 // If the client is waiting for results, need to run callback if: | 96 // If the client is waiting for results, need to run callback if: |
| 97 // * Some are available now. | 97 // * Some are available now. |
| 98 // * The last fetch finished, even with no results. (Client needs to know to | 98 // * The last fetch finished, even with no results. (Client needs to know to |
| 99 // stop waiting.) | 99 // stop waiting.) |
| 100 if (client_waiting_for_callback && (HasNext() || pending_requests_ == 0)) | 100 if (client_waiting_for_callback && (HasNext() || pending_requests_ == 0)) |
| 101 issuers_callback_.Run(this); | 101 issuers_callback_.Run(this); |
| 102 // |this| may be deleted here. |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace | 105 } // namespace |
| 105 | 106 |
| 106 CertIssuerSourceAia::CertIssuerSourceAia(CertNetFetcher* cert_fetcher) | 107 CertIssuerSourceAia::CertIssuerSourceAia(CertNetFetcher* cert_fetcher) |
| 107 : cert_fetcher_(cert_fetcher) {} | 108 : cert_fetcher_(cert_fetcher) {} |
| 108 | 109 |
| 109 CertIssuerSourceAia::~CertIssuerSourceAia() = default; | 110 CertIssuerSourceAia::~CertIssuerSourceAia() = default; |
| 110 | 111 |
| 111 void CertIssuerSourceAia::SyncGetIssuersOf(const ParsedCertificate* cert, | 112 void CertIssuerSourceAia::SyncGetIssuersOf(const ParsedCertificate* cert, |
| 112 ParsedCertificateList* issuers) { | 113 ParsedCertificateList* issuers) { |
| 113 // CertIssuerSourceAia never returns synchronous results. | 114 // CertIssuerSourceAia never returns synchronous results. |
| 114 } | 115 } |
| 115 | 116 |
| 116 void CertIssuerSourceAia::AsyncGetIssuersOf( | 117 void CertIssuerSourceAia::AsyncGetIssuersOf( |
| 117 const ParsedCertificate* cert, | 118 scoped_refptr<ParsedCertificate> cert, |
| 118 const IssuerCallback& issuers_callback, | 119 const IssuerCallback& issuers_callback, |
| 119 std::unique_ptr<Request>* out_req) { | 120 std::unique_ptr<Request>* out_req) { |
| 120 out_req->reset(); | 121 out_req->reset(); |
| 121 | 122 |
| 122 if (!cert->has_authority_info_access()) | 123 if (!cert->has_authority_info_access()) |
| 123 return; | 124 return; |
| 124 | 125 |
| 125 // RFC 5280 section 4.2.2.1: | 126 // RFC 5280 section 4.2.2.1: |
| 126 // | 127 // |
| 127 // An authorityInfoAccess extension may include multiple instances of | 128 // An authorityInfoAccess extension may include multiple instances of |
| (...skipping 30 matching lines...) Expand all Loading... |
| 158 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers( | 159 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers( |
| 159 url, kTimeoutMilliseconds, kMaxResponseBytes, | 160 url, kTimeoutMilliseconds, kMaxResponseBytes, |
| 160 base::Bind(&AiaRequest::OnFetchCompleted, | 161 base::Bind(&AiaRequest::OnFetchCompleted, |
| 161 base::Unretained(aia_request.get())))); | 162 base::Unretained(aia_request.get())))); |
| 162 } | 163 } |
| 163 | 164 |
| 164 *out_req = std::move(aia_request); | 165 *out_req = std::move(aia_request); |
| 165 } | 166 } |
| 166 | 167 |
| 167 } // namespace net | 168 } // namespace net |
| OLD | NEW |