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

Side by Side Diff: net/base/ssl_false_start_blacklist.cc

Issue 7778035: Revert 98885 - Third attempt at the following. Unreviewed, this was originally reviewed in http:... (Closed) Base URL: svn://svn.chromium.org/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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:eol-style
- LF
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base/ssl_false_start_blacklist.h" 5 #include "net/base/ssl_false_start_blacklist.h"
6 6
7 namespace net { 7 namespace net {
8 8
9 // static 9 // static
10 bool SSLFalseStartBlacklist::IsMember(const std::string& host) { 10 bool SSLFalseStartBlacklist::IsMember(const char* host) {
11 const std::string last_two_components(LastTwoComponents(host)); 11 const char* last_two_labels = LastTwoLabels(host);
12 if (last_two_components.empty()) 12 if (!last_two_labels)
13 return false; 13 return false;
14 const unsigned bucket = Hash(last_two_labels) & (kBuckets - 1);
15 const uint32 start = kHashTable[bucket];
16 const uint32 end = kHashTable[bucket + 1];
17 const size_t len = strlen(host);
14 18
15 const size_t bucket = Hash(last_two_components) & (kBuckets - 1); 19 for (size_t i = start; i < end;) {
16 for (size_t i = kHashTable[bucket]; i < kHashTable[bucket + 1]; ) {
17 const size_t blacklist_entry_len = static_cast<uint8>(kHashData[i]); 20 const size_t blacklist_entry_len = static_cast<uint8>(kHashData[i]);
18 if (host.length() >= blacklist_entry_len && 21 if (len >= blacklist_entry_len &&
19 !host.compare(host.length() - blacklist_entry_len, blacklist_entry_len, 22 memcmp(&host[len - blacklist_entry_len], &kHashData[i + 1],
20 &kHashData[i + 1], blacklist_entry_len) && 23 blacklist_entry_len) == 0 &&
21 (host.length() == blacklist_entry_len || 24 (len == blacklist_entry_len ||
22 host[host.length() - blacklist_entry_len - 1] == '.')) { 25 host[len - blacklist_entry_len - 1] == '.')) {
23 return true; 26 return true;
24 } 27 }
25 i += blacklist_entry_len + 1; 28 i += blacklist_entry_len + 1;
26 } 29 }
27 30
28 return false; 31 return false;
29 } 32 }
30 33
31 } // namespace net 34 } // namespace net
OLDNEW
« 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