Skip to content
Permalink
Browse files

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
  • Loading branch information
notriddle committed Mar 9, 2017
1 parent 0dbee36 commit b0499e34224019bf895dac66cbdf611ecdeea2d6
Showing with 2 additions and 0 deletions.
  1. +2 −0 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'.' &&

0 comments on commit b0499e3

Please sign in to comment.
You can’t perform that action at this time.