| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/quic/crypto/cert_compressor.h" | 10 #include "net/quic/crypto/cert_compressor.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 void QuicCryptoClientConfig::CachedState::SetProofInvalid() { | 247 void QuicCryptoClientConfig::CachedState::SetProofInvalid() { |
| 248 server_config_valid_ = false; | 248 server_config_valid_ = false; |
| 249 ++generation_counter_; | 249 ++generation_counter_; |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool QuicCryptoClientConfig::CachedState::Initialize( | 252 bool QuicCryptoClientConfig::CachedState::Initialize( |
| 253 StringPiece server_config, | 253 StringPiece server_config, |
| 254 StringPiece source_address_token, | 254 StringPiece source_address_token, |
| 255 const vector<string>& certs, | 255 const vector<string>& certs, |
| 256 const string& cert_sct, | 256 StringPiece cert_sct, |
| 257 StringPiece chlo_hash, | 257 StringPiece chlo_hash, |
| 258 StringPiece signature, | 258 StringPiece signature, |
| 259 QuicWallTime now) { | 259 QuicWallTime now) { |
| 260 DCHECK(server_config_.empty()); | 260 DCHECK(server_config_.empty()); |
| 261 | 261 |
| 262 if (server_config.empty()) { | 262 if (server_config.empty()) { |
| 263 RecordDiskCacheServerConfigState(SERVER_CONFIG_EMPTY); | 263 RecordDiskCacheServerConfigState(SERVER_CONFIG_EMPTY); |
| 264 return false; | 264 return false; |
| 265 } | 265 } |
| 266 | 266 |
| 267 string error_details; | 267 string error_details; |
| 268 ServerConfigState state = SetServerConfig(server_config, now, &error_details); | 268 ServerConfigState state = SetServerConfig(server_config, now, &error_details); |
| 269 RecordDiskCacheServerConfigState(state); | 269 RecordDiskCacheServerConfigState(state); |
| 270 if (state != SERVER_CONFIG_VALID) { | 270 if (state != SERVER_CONFIG_VALID) { |
| 271 DVLOG(1) << "SetServerConfig failed with " << error_details; | 271 DVLOG(1) << "SetServerConfig failed with " << error_details; |
| 272 return false; | 272 return false; |
| 273 } | 273 } |
| 274 | 274 |
| 275 chlo_hash.CopyToString(&chlo_hash_); | |
| 276 signature.CopyToString(&server_config_sig_); | 275 signature.CopyToString(&server_config_sig_); |
| 277 source_address_token.CopyToString(&source_address_token_); | 276 source_address_token.CopyToString(&source_address_token_); |
| 277 cert_sct.CopyToString(&cert_sct_); |
| 278 chlo_hash.CopyToString(&chlo_hash_); |
| 278 certs_ = certs; | 279 certs_ = certs; |
| 279 cert_sct_ = cert_sct; | |
| 280 return true; | 280 return true; |
| 281 } | 281 } |
| 282 | 282 |
| 283 const string& QuicCryptoClientConfig::CachedState::server_config() const { | 283 const string& QuicCryptoClientConfig::CachedState::server_config() const { |
| 284 return server_config_; | 284 return server_config_; |
| 285 } | 285 } |
| 286 | 286 |
| 287 const string& QuicCryptoClientConfig::CachedState::source_address_token() | 287 const string& QuicCryptoClientConfig::CachedState::source_address_token() |
| 288 const { | 288 const { |
| 289 return source_address_token_; | 289 return source_address_token_; |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 } | 984 } |
| 985 | 985 |
| 986 // Update canonical version to point at the "most recent" entry. | 986 // Update canonical version to point at the "most recent" entry. |
| 987 canonical_server_map_[suffix_server_id] = server_id; | 987 canonical_server_map_[suffix_server_id] = server_id; |
| 988 | 988 |
| 989 server_state->InitializeFrom(*canonical_state); | 989 server_state->InitializeFrom(*canonical_state); |
| 990 return true; | 990 return true; |
| 991 } | 991 } |
| 992 | 992 |
| 993 } // namespace net | 993 } // namespace net |
| OLD | NEW |