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

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

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

Powered by Google App Engine
This is Rietveld 408576698