From b0499e34224019bf895dac66cbdf611ecdeea2d6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 6 Mar 2017 19:58:32 +0000 Subject: [PATCH] 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 --- components/net/cookie.rs | 2 ++ 1 file changed, 2 insertions(+) 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'.' &&