OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/base/ssl_false_start_blacklist.h" | |
6 | |
7 namespace net { | |
8 | |
9 // static | |
10 bool SSLFalseStartBlacklist::IsMember(const std::string& host) { | |
11 const std::string last_two_components(LastTwoComponents(host)); | |
12 if (last_two_components.empty()) | |
13 return false; | |
14 | |
15 const size_t bucket = Hash(last_two_components) & (kBuckets - 1); | |
16 for (size_t i = kHashTable[bucket]; i < kHashTable[bucket + 1]; ) { | |
17 const size_t blacklist_entry_len = static_cast<uint8>(kHashData[i]); | |
18 if (host.length() >= blacklist_entry_len && | |
19 !host.compare(host.length() - blacklist_entry_len, blacklist_entry_len, | |
20 &kHashData[i + 1], blacklist_entry_len) && | |
21 (host.length() == blacklist_entry_len || | |
22 host[host.length() - blacklist_entry_len - 1] == '.')) { | |
23 return true; | |
24 } | |
25 i += blacklist_entry_len + 1; | |
26 } | |
27 | |
28 return false; | |
29 } | |
30 | |
31 } // namespace net | |
OLD | NEW |