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

Unified Diff: net/base/sdch_dictionary.cc

Issue 1876683002: Implement SDCH Dictionary domain matching as per RFC 2965 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factor out IsDomainMatch from CanonicalCookie and use it in SdchDictionary. Created 4 years, 8 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 | « no previous file | net/base/url_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_dictionary.cc
diff --git a/net/base/sdch_dictionary.cc b/net/base/sdch_dictionary.cc
index b8faf552390601da1e31dfe13d229ab60cded96e..1842c451f9eb9051b644e6db7475cda0e70e9d14 100644
--- a/net/base/sdch_dictionary.cc
+++ b/net/base/sdch_dictionary.cc
@@ -4,19 +4,12 @@
#include "net/base/sdch_dictionary.h"
+#include "base/strings/string_util.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/values.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
-
-namespace {
-
-bool DomainMatch(const GURL& gurl, const std::string& restriction) {
- // TODO(jar): This is not precisely a domain match definition.
- return gurl.DomainIs(restriction);
-}
-
-} // namespace
+#include "net/base/url_util.h"
namespace net {
@@ -87,7 +80,7 @@ SdchProblemCode SdchDictionary::CanSet(const std::string& domain,
return SDCH_DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN; // domain was a TLD.
}
- if (!DomainMatch(dictionary_url, domain))
+ if (!IsDomainMatch(domain, dictionary_url.host()))
return SDCH_DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL;
std::string referrer_url_host = dictionary_url.host();
@@ -119,7 +112,7 @@ SdchProblemCode SdchDictionary::CanUse(const GURL& target_url) const {
* HTTPS support AND the dictionary acquisition scheme matches the target
* url scheme.
*/
- if (!DomainMatch(target_url, domain_))
+ if (!IsDomainMatch(domain_, target_url.host()))
return SDCH_DICTIONARY_FOUND_HAS_WRONG_DOMAIN;
if (!ports_.empty() && 0 == ports_.count(target_url.EffectiveIntPort()))
« no previous file with comments | « no previous file | net/base/url_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698