diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 15:44:57 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 15:44:57 +0000 |
commit | a70a02d6af0441f7eed5a1c8996a7e505a87aced (patch) | |
tree | 47a531439863943f7cc1a50816323c60f1ca32f3 /net/base | |
parent | 1dc82a0a41a4b88f59fc2ad8a3908ae7ce39ef95 (diff) | |
download | chromium_src-a70a02d6af0441f7eed5a1c8996a7e505a87aced.zip chromium_src-a70a02d6af0441f7eed5a1c8996a7e505a87aced.tar.gz chromium_src-a70a02d6af0441f7eed5a1c8996a7e505a87aced.tar.bz2 |
net: update False Start blacklist for 32-bit indexes.
(Needed for the next list update.)
BUG=none
TEST=net_unittests
http://codereview.chromium.org/4599002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/ssl_false_start_blacklist.cc | 4 | ||||
-rw-r--r-- | net/base/ssl_false_start_blacklist.h | 2 | ||||
-rw-r--r-- | net/base/ssl_false_start_blacklist_process.cc | 21 |
3 files changed, 13 insertions, 14 deletions
diff --git a/net/base/ssl_false_start_blacklist.cc b/net/base/ssl_false_start_blacklist.cc index 9e0f309..b57826b 100644 --- a/net/base/ssl_false_start_blacklist.cc +++ b/net/base/ssl_false_start_blacklist.cc @@ -12,8 +12,8 @@ bool SSLFalseStartBlacklist::IsMember(const char* host) { if (!last_two_labels) return false; const unsigned bucket = Hash(last_two_labels) & (kBuckets - 1); - const uint16 start = kHashTable[bucket]; - const uint16 end = kHashTable[bucket + 1]; + const uint32 start = kHashTable[bucket]; + const uint32 end = kHashTable[bucket + 1]; const size_t len = strlen(host); for (size_t i = start; i < end;) { diff --git a/net/base/ssl_false_start_blacklist.h b/net/base/ssl_false_start_blacklist.h index 1d44d0a..d0b10e2 100644 --- a/net/base/ssl_false_start_blacklist.h +++ b/net/base/ssl_false_start_blacklist.h @@ -81,7 +81,7 @@ class SSLFalseStartBlacklist { // kHashTable contains an offset into |kHashData| for each bucket. The // additional element at the end contains the length of |kHashData|. - static const uint16 kHashTable[kBuckets + 1]; + static const uint32 kHashTable[kBuckets + 1]; // kHashData contains the contents of the hash table. |kHashTable| indexes // into this array. Each bucket consists of zero or more, 8-bit length // prefixed strings. Each string is a DNS name in dotted form. For a given diff --git a/net/base/ssl_false_start_blacklist_process.cc b/net/base/ssl_false_start_blacklist_process.cc index 46b99af..a20dd1e 100644 --- a/net/base/ssl_false_start_blacklist_process.cc +++ b/net/base/ssl_false_start_blacklist_process.cc @@ -19,6 +19,8 @@ using net::SSLFalseStartBlacklist; static const unsigned kBuckets = SSLFalseStartBlacklist::kBuckets; +static bool verbose = false; + static int usage(const char* argv0) { fprintf(stderr, "Usage: %s <blacklist file> <output .c file>\n", argv0); @@ -48,7 +50,8 @@ static void RemoveDuplicateEntries(std::vector<std::string>* hosts) { for (std::vector<std::string>::const_iterator i = hosts->begin(); i != hosts->end(); i++) { if (hosts_set.count(*i)) { - fprintf(stderr, "Removing duplicate entry for %s\n", i->c_str()); + if (verbose) + fprintf(stderr, "Removing duplicate entry for %s\n", i->c_str()); continue; } hosts_set.insert(*i); @@ -93,7 +96,8 @@ static void RemoveRedundantEntries(std::vector<std::string>* hosts) { if (parent.empty()) { ret.push_back(*i); } else { - fprintf(stderr, "Removing %s as redundant\n", i->c_str()); + if (verbose) + fprintf(stderr, "Removing %s as redundant\n", i->c_str()); } } @@ -185,7 +189,7 @@ int main(int argc, char** argv) { } fprintf(stderr, "Using %d entry hash table\n", kBuckets); - uint16 table[kBuckets]; + uint32 table[kBuckets]; std::vector<std::string> buckets[kBuckets]; for (std::vector<std::string>::const_iterator @@ -199,11 +203,6 @@ int main(int argc, char** argv) { std::string table_data; unsigned max_bucket_size = 0; for (unsigned i = 0; i < kBuckets; i++) { - if (table_data.size() > 65535) { - fprintf(stderr, "Hash table overflowed a uint16_t index\n"); - return 3; - } - if (buckets[i].size() > max_bucket_size) max_bucket_size = buckets[i].size(); @@ -231,12 +230,12 @@ int main(int argc, char** argv) { fprintf(out, "#include \"base/basictypes.h\"\n\n"); fprintf(out, "#include \"net/base/ssl_false_start_blacklist.h\"\n\n"); fprintf(out, "namespace net {\n\n"); - fprintf(out, "const uint16 SSLFalseStartBlacklist::kHashTable[%d + 1] = {\n", + fprintf(out, "const uint32 SSLFalseStartBlacklist::kHashTable[%d + 1] = {\n", kBuckets); for (unsigned i = 0; i < kBuckets; i++) { - fprintf(out, " %d,\n", (int) table[i]); + fprintf(out, " %u,\n", (unsigned) table[i]); } - fprintf(out, " %d,\n", (int) table_data.size()); + fprintf(out, " %u,\n", (unsigned) table_data.size()); fprintf(out, "};\n\n"); fprintf(out, "const char SSLFalseStartBlacklist::kHashData[] = \n"); |