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

Unified Diff: net/base/sdch_manager.cc

Issue 11009: Open up SDCH for all sites, in preparation for latency tests... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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
« net/base/sdch_filter_unittest.cc ('K') | « net/base/sdch_filter_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager.cc
===================================================================
--- net/base/sdch_manager.cc (revision 5301)
+++ net/base/sdch_manager.cc (working copy)
@@ -122,7 +122,7 @@
std::string domain, path;
std::set<int> ports;
- Time expiration;
+ Time expiration(Time::Now() + TimeDelta::FromDays(30));
size_t header_end = dictionary_text.find("\n\n");
if (std::string::npos == header_end) {
@@ -300,7 +300,16 @@
return false;
}
- // TODO(jar): Enforce item 4 above.
+ std::string referrer_url_host = dictionary_url.host();
+ size_t postfix_domain_index = referrer_url_host.rfind(domain);
+ // See if it is indeed a postfix, or just an internal string.
+ if (referrer_url_host.size() == postfix_domain_index + domain.size()) {
+ // It is a postfix... so check to see if there's a dot in the prefix.
+ size_t end_of_host_index = referrer_url_host.find_first_of('.');
+ if (referrer_url_host.npos != end_of_host_index &&
+ end_of_host_index < postfix_domain_index)
+ return false;
+ }
if (!ports.empty()
&& 0 == ports.count(dictionary_url.EffectiveIntPort())) {
@@ -365,6 +374,8 @@
return false;
if (target_url.SchemeIsSecure())
return false;
+ if (Time::Now() > expiration_)
+ return false;
return true;
}
« net/base/sdch_filter_unittest.cc ('K') | « net/base/sdch_filter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698