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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: removed no longer needed forward declaration Created 3 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
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_transaction.h » ('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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 next_state_ = STATE_CREATE_STREAM; 144 next_state_ = STATE_CREATE_STREAM;
145 145
146 int rv = DoLoop(OK); 146 int rv = DoLoop(OK);
147 if (rv == ERR_IO_PENDING) 147 if (rv == ERR_IO_PENDING)
148 callback_ = callback; 148 callback_ = callback;
149 return rv; 149 return rv;
150 } 150 }
151 151
152 int HttpNetworkTransaction::RestartWithCertificate( 152 int HttpNetworkTransaction::RestartWithCertificate(
153 X509Certificate* client_cert, 153 scoped_refptr<X509Certificate> client_cert,
154 SSLPrivateKey* client_private_key, 154 scoped_refptr<SSLPrivateKey> client_private_key,
155 const CompletionCallback& callback) { 155 const CompletionCallback& callback) {
156 // In HandleCertificateRequest(), we always tear down existing stream 156 // In HandleCertificateRequest(), we always tear down existing stream
157 // requests to force a new connection. So we shouldn't have one here. 157 // requests to force a new connection. So we shouldn't have one here.
158 DCHECK(!stream_request_.get()); 158 DCHECK(!stream_request_.get());
159 DCHECK(!stream_.get()); 159 DCHECK(!stream_.get());
160 DCHECK_EQ(STATE_NONE, next_state_); 160 DCHECK_EQ(STATE_NONE, next_state_);
161 161
162 SSLConfig* ssl_config = response_.cert_request_info->is_proxy ? 162 SSLConfig* ssl_config = response_.cert_request_info->is_proxy ?
163 &proxy_ssl_config_ : &server_ssl_config_; 163 &proxy_ssl_config_ : &server_ssl_config_;
164 ssl_config->send_client_cert = true; 164 ssl_config->send_client_cert = true;
165 ssl_config->client_cert = client_cert; 165 ssl_config->client_cert = client_cert;
166 ssl_config->client_private_key = client_private_key; 166 ssl_config->client_private_key = client_private_key;
167 session_->ssl_client_auth_cache()->Add( 167 session_->ssl_client_auth_cache()->Add(
168 response_.cert_request_info->host_and_port, client_cert, 168 response_.cert_request_info->host_and_port, std::move(client_cert),
169 client_private_key); 169 std::move(client_private_key));
170 // Reset the other member variables. 170 // Reset the other member variables.
171 // Note: this is necessary only with SSL renegotiation. 171 // Note: this is necessary only with SSL renegotiation.
172 ResetStateForRestart(); 172 ResetStateForRestart();
173 next_state_ = STATE_CREATE_STREAM; 173 next_state_ = STATE_CREATE_STREAM;
174 int rv = DoLoop(OK); 174 int rv = DoLoop(OK);
175 if (rv == ERR_IO_PENDING) 175 if (rv == ERR_IO_PENDING)
176 callback_ = callback; 176 callback_ = callback;
177 return rv; 177 return rv;
178 } 178 }
179 179
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 if (headers->IsRedirect(nullptr)) { 1772 if (headers->IsRedirect(nullptr)) {
1773 UMA_HISTOGRAM_BOOLEAN("Net.RedirectWithUnadvertisedContentEncoding", 1773 UMA_HISTOGRAM_BOOLEAN("Net.RedirectWithUnadvertisedContentEncoding",
1774 !result); 1774 !result);
1775 return true; 1775 return true;
1776 } 1776 }
1777 1777
1778 return result; 1778 return result;
1779 } 1779 }
1780 1780
1781 } // namespace net 1781 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698