OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_BASE_SSL_FALSE_START_BLACKLIST_H_ | 5 #ifndef NET_BASE_SSL_FALSE_START_BLACKLIST_H_ |
6 #define NET_BASE_SSL_FALSE_START_BLACKLIST_H_ | 6 #define NET_BASE_SSL_FALSE_START_BLACKLIST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "net/base/net_api.h" |
9 | 10 |
10 namespace net { | 11 namespace net { |
11 | 12 |
12 // SSLFalseStartBlacklist is a set of domains which we believe to be intolerant | 13 // SSLFalseStartBlacklist is a set of domains which we believe to be intolerant |
13 // to TLS False Start. Because this set is several hundred long, it's | 14 // to TLS False Start. Because this set is several hundred long, it's |
14 // precompiled by the code in ssl_false_start_blacklist_process.cc into a hash | 15 // precompiled by the code in ssl_false_start_blacklist_process.cc into a hash |
15 // table for fast lookups. | 16 // table for fast lookups. |
16 class SSLFalseStartBlacklist { | 17 class NET_TEST SSLFalseStartBlacklist { |
17 public: | 18 public: |
18 // IsMember returns true if the given host is in the blacklist. | 19 // IsMember returns true if the given host is in the blacklist. |
19 // host: a DNS name in dotted form (i.e. "www.example.com") | 20 // host: a DNS name in dotted form (i.e. "www.example.com") |
20 static bool IsMember(const char* host); | 21 static bool IsMember(const char* host); |
21 | 22 |
22 // Hash returns the modified djb2 hash of the given string. | 23 // Hash returns the modified djb2 hash of the given string. |
23 static unsigned Hash(const char* str) { | 24 static unsigned Hash(const char* str) { |
24 // This is inline because the code which generates the hash table needs to | 25 // This is inline because the code which generates the hash table needs to |
25 // use it. However, the generating code cannot link against | 26 // use it. However, the generating code cannot link against |
26 // ssl_false_start_blacklist.cc because that needs the tables which it | 27 // ssl_false_start_blacklist.cc because that needs the tables which it |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // assign a string to a hash bucket, the last two labels (not including the | 90 // assign a string to a hash bucket, the last two labels (not including the |
90 // root label) are hashed. Thus, the bucket for "www.example.com" is | 91 // root label) are hashed. Thus, the bucket for "www.example.com" is |
91 // Hash("example.com"). No names that are less than two labels long are | 92 // Hash("example.com"). No names that are less than two labels long are |
92 // included in the blacklist. | 93 // included in the blacklist. |
93 static const char kHashData[]; | 94 static const char kHashData[]; |
94 }; | 95 }; |
95 | 96 |
96 } // namespace net | 97 } // namespace net |
97 | 98 |
98 #endif // NET_BASE_SSL_FALSE_START_BLACKLIST_H_ | 99 #endif // NET_BASE_SSL_FALSE_START_BLACKLIST_H_ |
OLD | NEW |