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/core/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | |
14 #include "net/quic/core/crypto/cert_compressor.h" | 13 #include "net/quic/core/crypto/cert_compressor.h" |
15 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h" | 14 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h" |
16 #include "net/quic/core/crypto/channel_id.h" | 15 #include "net/quic/core/crypto/channel_id.h" |
17 #include "net/quic/core/crypto/common_cert_set.h" | 16 #include "net/quic/core/crypto/common_cert_set.h" |
18 #include "net/quic/core/crypto/crypto_framer.h" | 17 #include "net/quic/core/crypto/crypto_framer.h" |
19 #include "net/quic/core/crypto/crypto_utils.h" | 18 #include "net/quic/core/crypto/crypto_utils.h" |
20 #include "net/quic/core/crypto/curve25519_key_exchange.h" | 19 #include "net/quic/core/crypto/curve25519_key_exchange.h" |
21 #include "net/quic/core/crypto/key_exchange.h" | 20 #include "net/quic/core/crypto/key_exchange.h" |
22 #include "net/quic/core/crypto/p256_key_exchange.h" | 21 #include "net/quic/core/crypto/p256_key_exchange.h" |
23 #include "net/quic/core/crypto/proof_verifier.h" | 22 #include "net/quic/core/crypto/proof_verifier.h" |
24 #include "net/quic/core/crypto/quic_encrypter.h" | 23 #include "net/quic/core/crypto/quic_encrypter.h" |
25 #include "net/quic/core/crypto/quic_random.h" | 24 #include "net/quic/core/crypto/quic_random.h" |
26 #include "net/quic/core/quic_bug_tracker.h" | 25 #include "net/quic/core/quic_bug_tracker.h" |
27 #include "net/quic/core/quic_utils.h" | 26 #include "net/quic/core/quic_utils.h" |
| 27 #include "net/quic/platform/api/quic_text_utils.h" |
28 | 28 |
29 using base::ContainsKey; | 29 using base::ContainsKey; |
30 using base::StringPiece; | 30 using base::StringPiece; |
31 using std::string; | 31 using std::string; |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 // Tracks the reason (the state of the server config) for sending inchoate | 37 // Tracks the reason (the state of the server config) for sending inchoate |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 aead.insert(aead.begin(), kAESG); | 944 aead.insert(aead.begin(), kAESG); |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
948 bool QuicCryptoClientConfig::PopulateFromCanonicalConfig( | 948 bool QuicCryptoClientConfig::PopulateFromCanonicalConfig( |
949 const QuicServerId& server_id, | 949 const QuicServerId& server_id, |
950 CachedState* server_state) { | 950 CachedState* server_state) { |
951 DCHECK(server_state->IsEmpty()); | 951 DCHECK(server_state->IsEmpty()); |
952 size_t i = 0; | 952 size_t i = 0; |
953 for (; i < canonical_suffixes_.size(); ++i) { | 953 for (; i < canonical_suffixes_.size(); ++i) { |
954 if (base::EndsWith(server_id.host(), canonical_suffixes_[i], | 954 if (QuicTextUtils::EndsWithIgnoreCase(server_id.host(), |
955 base::CompareCase::INSENSITIVE_ASCII)) { | 955 canonical_suffixes_[i])) { |
956 break; | 956 break; |
957 } | 957 } |
958 } | 958 } |
959 if (i == canonical_suffixes_.size()) { | 959 if (i == canonical_suffixes_.size()) { |
960 return false; | 960 return false; |
961 } | 961 } |
962 | 962 |
963 QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), | 963 QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), |
964 server_id.privacy_mode()); | 964 server_id.privacy_mode()); |
965 if (!ContainsKey(canonical_server_map_, suffix_server_id)) { | 965 if (!ContainsKey(canonical_server_map_, suffix_server_id)) { |
(...skipping 11 matching lines...) Expand all Loading... |
977 } | 977 } |
978 | 978 |
979 // Update canonical version to point at the "most recent" entry. | 979 // Update canonical version to point at the "most recent" entry. |
980 canonical_server_map_[suffix_server_id] = server_id; | 980 canonical_server_map_[suffix_server_id] = server_id; |
981 | 981 |
982 server_state->InitializeFrom(*canonical_state); | 982 server_state->InitializeFrom(*canonical_state); |
983 return true; | 983 return true; |
984 } | 984 } |
985 | 985 |
986 } // namespace net | 986 } // namespace net |
OLD | NEW |