summaryrefslogtreecommitdiffstats
path: root/net/base/sdch_manager.cc
diff options
context:
space:
mode:
authorjar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 02:39:45 +0000
committerjar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 02:39:45 +0000
commit4ff391fcc5b88061912f73ec570f389100cc5e2a (patch)
tree91d3eb1a894a71b64ff3769beb058fc274ce44fb /net/base/sdch_manager.cc
parentdf4ac237348f1aebfe7ca345e2bc6375fd51a1dc (diff)
downloadchromium_src-4ff391fcc5b88061912f73ec570f389100cc5e2a.zip
chromium_src-4ff391fcc5b88061912f73ec570f389100cc5e2a.tar.gz
chromium_src-4ff391fcc5b88061912f73ec570f389100cc5e2a.tar.bz2
Open up SDCH for all sites, in preparation for latency tests
Since the stability test is going well (so far) on ".google.com," this change will open up support for SDCH compression to all sites. This will allow for more international testing as well. I tightened down the restrictions on who can set up a dictionary for a given domain. I'm pretty sure it is at least as restrictive as the current SDCH spec. I also supplied a default expiration time for using an SDCH dictionary at 30 days (as per SDCH spec). To be safer with the latency histograms, I also tightened the period of time we measure, on the off chance that the page some-how asks for more bytes after everything has been read/rendered. r=openvcdiff,hunar Review URL: http://codereview.chromium.org/11009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/sdch_manager.cc')
-rw-r--r--net/base/sdch_manager.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 08c9d1c2..005d300 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -122,7 +122,7 @@ bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
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 @@ bool SdchManager::Dictionary::CanSet(const std::string& domain,
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 @@ bool SdchManager::Dictionary::CanAdvertise(const GURL& target_url) {
return false;
if (target_url.SchemeIsSecure())
return false;
+ if (Time::Now() > expiration_)
+ return false;
return true;
}