aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2017-03-06 19:58:32 +0000
committerMichael Howell <michael@notriddle.com>2017-03-09 02:18:02 +0000
commitb0499e34224019bf895dac66cbdf611ecdeea2d6 (patch)
tree89915a242f568aab2b44a854ef49c3dc4ed78171
parent0dbee36915abd926e61ca8571e11abf1f97ec830 (diff)
downloadservo-b0499e34224019bf895dac66cbdf611ecdeea2d6.tar.gz
servo-b0499e34224019bf895dac66cbdf611ecdeea2d6.zip
Assert that `domain_match` is operating on lowercase text
> (Note that both the domain string and the string will have been > canonicalized to lower case at this point.) Related to #15789
-rw-r--r--components/net/cookie.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/components/net/cookie.rs b/components/net/cookie.rs
index c40bf909e2a..45fe1403e58 100644
--- a/components/net/cookie.rs
+++ b/components/net/cookie.rs
@@ -139,6 +139,8 @@ impl Cookie {
// http://tools.ietf.org/html/rfc6265#section-5.1.3
pub fn domain_match(string: &str, domain_string: &str) -> bool {
+ debug_assert!(string.to_lowercase() == string);
+ debug_assert!(domain_string.to_lowercase() == domain_string);
string == domain_string ||
(string.ends_with(domain_string) &&
string.as_bytes()[string.len()-domain_string.len()-1] == b'.' &&