Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 X509Certificate* client_cert, | 165 X509Certificate* client_cert, |
| 166 CompletionCallback* callback) { | 166 CompletionCallback* callback) { |
| 167 // In HandleCertificateRequest(), we always tear down existing stream | 167 // In HandleCertificateRequest(), we always tear down existing stream |
| 168 // requests to force a new connection. So we shouldn't have one here. | 168 // requests to force a new connection. So we shouldn't have one here. |
| 169 DCHECK(!stream_request_.get()); | 169 DCHECK(!stream_request_.get()); |
| 170 DCHECK(!stream_.get()); | 170 DCHECK(!stream_.get()); |
| 171 DCHECK_EQ(STATE_NONE, next_state_); | 171 DCHECK_EQ(STATE_NONE, next_state_); |
| 172 | 172 |
| 173 ssl_config_.client_cert = client_cert; | 173 ssl_config_.client_cert = client_cert; |
| 174 if (client_cert) { | 174 if (client_cert) { |
| 175 session_->ssl_client_auth_cache()->Add(GetHostAndPort(request_->url), | 175 session_->ssl_client_auth_cache()->Add( |
|
wtc
2010/11/11 01:11:35
Please DCHECK that response_.cert_request_info->ho
Ryan Hamilton
2010/11/11 18:57:00
I don't think this would be correct. In the case
wtc
2010/11/12 00:12:55
I see. No need to add any DCHECK then.
| |
| 176 client_cert); | 176 response_.cert_request_info->host_and_port, client_cert); |
| 177 } | 177 } |
| 178 ssl_config_.send_client_cert = true; | 178 ssl_config_.send_client_cert = true; |
| 179 // Reset the other member variables. | 179 // Reset the other member variables. |
| 180 // Note: this is necessary only with SSL renegotiation. | 180 // Note: this is necessary only with SSL renegotiation. |
| 181 ResetStateForRestart(); | 181 ResetStateForRestart(); |
| 182 next_state_ = STATE_CREATE_STREAM; | 182 next_state_ = STATE_CREATE_STREAM; |
| 183 int rv = DoLoop(OK); | 183 int rv = DoLoop(OK); |
| 184 if (rv == ERR_IO_PENDING) | 184 if (rv == ERR_IO_PENDING) |
| 185 user_callback_ = callback; | 185 user_callback_ = callback; |
| 186 return rv; | 186 return rv; |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 stream_->Close(true); | 972 stream_->Close(true); |
| 973 stream_.reset(); | 973 stream_.reset(); |
| 974 } | 974 } |
| 975 | 975 |
| 976 // The server is asking for a client certificate during the initial | 976 // The server is asking for a client certificate during the initial |
| 977 // handshake. | 977 // handshake. |
| 978 stream_request_.reset(); | 978 stream_request_.reset(); |
| 979 | 979 |
| 980 // If the user selected one of the certificate in client_certs for this | 980 // If the user selected one of the certificate in client_certs for this |
| 981 // server before, use it automatically. | 981 // server before, use it automatically. |
| 982 X509Certificate* client_cert = session_->ssl_client_auth_cache()-> | 982 X509Certificate* client_cert = session_->ssl_client_auth_cache()->Lookup( |
| 983 Lookup(GetHostAndPort(request_->url)); | 983 response_.cert_request_info->host_and_port); |
| 984 if (client_cert) { | 984 if (client_cert) { |
| 985 const std::vector<scoped_refptr<X509Certificate> >& client_certs = | 985 const std::vector<scoped_refptr<X509Certificate> >& client_certs = |
| 986 response_.cert_request_info->client_certs; | 986 response_.cert_request_info->client_certs; |
| 987 for (size_t i = 0; i < client_certs.size(); ++i) { | 987 for (size_t i = 0; i < client_certs.size(); ++i) { |
| 988 if (client_cert->fingerprint().Equals(client_certs[i]->fingerprint())) { | 988 if (client_cert->fingerprint().Equals(client_certs[i]->fingerprint())) { |
| 989 // TODO(davidben): Add a unit test which covers this path; we need to be | 989 // TODO(davidben): Add a unit test which covers this path; we need to be |
| 990 // able to send a legitimate certificate and also bypass/clear the | 990 // able to send a legitimate certificate and also bypass/clear the |
| 991 // SSL session cache. | 991 // SSL session cache. |
| 992 ssl_config_.client_cert = client_cert; | 992 ssl_config_.client_cert = client_cert; |
| 993 ssl_config_.send_client_cert = true; | 993 ssl_config_.send_client_cert = true; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1166 default: | 1166 default: |
| 1167 return priority; | 1167 return priority; |
| 1168 } | 1168 } |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 | 1171 |
| 1172 | 1172 |
| 1173 #undef STATE_CASE | 1173 #undef STATE_CASE |
| 1174 | 1174 |
| 1175 } // namespace net | 1175 } // namespace net |
| OLD | NEW |