Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(757)

Unified Diff: net/base/ssl_false_start_blacklist.cc

Issue 7903016: Fourth attempt at the following. Unreviewed, this was originally reviewed in http://codereview.c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/ssl_false_start_blacklist.h ('k') | net/base/ssl_false_start_blacklist_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/ssl_false_start_blacklist.cc
===================================================================
--- net/base/ssl_false_start_blacklist.cc (revision 101373)
+++ net/base/ssl_false_start_blacklist.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,22 +7,19 @@
namespace net {
// static
-bool SSLFalseStartBlacklist::IsMember(const char* host) {
- const char* last_two_labels = LastTwoLabels(host);
- if (!last_two_labels)
+bool SSLFalseStartBlacklist::IsMember(const std::string& host) {
+ const std::string last_two_components(LastTwoComponents(host));
+ if (last_two_components.empty())
return false;
- const unsigned bucket = Hash(last_two_labels) & (kBuckets - 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;) {
+ const size_t bucket = Hash(last_two_components) & (kBuckets - 1);
+ for (size_t i = kHashTable[bucket]; i < kHashTable[bucket + 1]; ) {
const size_t blacklist_entry_len = static_cast<uint8>(kHashData[i]);
- if (len >= blacklist_entry_len &&
- memcmp(&host[len - blacklist_entry_len], &kHashData[i + 1],
- blacklist_entry_len) == 0 &&
- (len == blacklist_entry_len ||
- host[len - blacklist_entry_len - 1] == '.')) {
+ if (host.length() >= blacklist_entry_len &&
+ !host.compare(host.length() - blacklist_entry_len, blacklist_entry_len,
+ &kHashData[i + 1], blacklist_entry_len) &&
+ (host.length() == blacklist_entry_len ||
+ host[host.length() - blacklist_entry_len - 1] == '.')) {
return true;
}
i += blacklist_entry_len + 1;
« no previous file with comments | « net/base/ssl_false_start_blacklist.h ('k') | net/base/ssl_false_start_blacklist_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698