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

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

Issue 2327973002: Add CertErrors* parameter to the main Certificate parsing functions. (Closed)
Patch Set: StringPiece is kind of dangerous... Created 4 years, 3 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/cert_errors.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 namespace net { 12 namespace net {
12 13
13 namespace { 14 namespace {
14 15
15 // TODO(mattm): These are arbitrary choices. Re-evaluate. 16 // TODO(mattm): These are arbitrary choices. Re-evaluate.
16 const int kTimeoutMilliseconds = 10000; 17 const int kTimeoutMilliseconds = 10000;
17 const int kMaxResponseBytes = 65536; 18 const int kMaxResponseBytes = 65536;
18 const int kMaxFetchesPerCert = 5; 19 const int kMaxFetchesPerCert = 5;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // 80 //
80 // Conforming applications that support HTTP or FTP for accessing 81 // Conforming applications that support HTTP or FTP for accessing
81 // certificates MUST be able to accept individual DER encoded 82 // certificates MUST be able to accept individual DER encoded
82 // certificates and SHOULD be able to accept "certs-only" CMS messages. 83 // certificates and SHOULD be able to accept "certs-only" CMS messages.
83 // 84 //
84 // TODO(mattm): Is supporting CMS message format important? 85 // TODO(mattm): Is supporting CMS message format important?
85 // 86 //
86 // TODO(mattm): Avoid copying bytes. Change the CertNetFetcher and 87 // TODO(mattm): Avoid copying bytes. Change the CertNetFetcher and
87 // ParsedCertificate interface to allow passing through ownership of the 88 // ParsedCertificate interface to allow passing through ownership of the
88 // bytes. 89 // bytes.
89 if (!ParsedCertificate::CreateAndAddToVector( 90 CertErrors errors;
90 fetched_bytes.data(), fetched_bytes.size(), 91 if (!ParsedCertificate::CreateAndAddToVector(fetched_bytes.data(),
91 ParsedCertificate::DataSource::INTERNAL_COPY, {}, &results_)) { 92 fetched_bytes.size(), {},
92 // TODO(mattm): propagate error info. 93 &results_, &errors)) {
93 LOG(ERROR) << "Error parsing AIA data"; 94 // TODO(crbug.com/634443): propagate error info.
95 LOG(ERROR) << "Error parsing cert retrieved from AIA:\n"
96 << errors.ToDebugString();
94 } 97 }
95 } 98 }
96 // If the client is waiting for results, need to run callback if: 99 // If the client is waiting for results, need to run callback if:
97 // * Some are available now. 100 // * Some are available now.
98 // * The last fetch finished, even with no results. (Client needs to know to 101 // * The last fetch finished, even with no results. (Client needs to know to
99 // stop waiting.) 102 // stop waiting.)
100 if (client_waiting_for_callback && (HasNext() || pending_requests_ == 0)) 103 if (client_waiting_for_callback && (HasNext() || pending_requests_ == 0))
101 issuers_callback_.Run(this); 104 issuers_callback_.Run(this);
102 } 105 }
103 106
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers( 161 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers(
159 url, kTimeoutMilliseconds, kMaxResponseBytes, 162 url, kTimeoutMilliseconds, kMaxResponseBytes,
160 base::Bind(&AiaRequest::OnFetchCompleted, 163 base::Bind(&AiaRequest::OnFetchCompleted,
161 base::Unretained(aia_request.get())))); 164 base::Unretained(aia_request.get()))));
162 } 165 }
163 166
164 *out_req = std::move(aia_request); 167 *out_req = std::move(aia_request);
165 } 168 }
166 169
167 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « components/cast_certificate/cast_crl_unittest.cc ('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