aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-03-08 18:18:16 -0800
committerGitHub <noreply@github.com>2017-03-08 18:18:16 -0800
commit5fe921f2ab81726dc34b0c427580f355d503f56e (patch)
tree9a7f983f043caa3cf5e7582d4fb822a6d4008e10
parent28f871247c6461ccc8c254caba0d674ac4ddc545 (diff)
parentb0499e34224019bf895dac66cbdf611ecdeea2d6 (diff)
downloadservo-5fe921f2ab81726dc34b0c427580f355d503f56e.tar.gz
servo-5fe921f2ab81726dc34b0c427580f355d503f56e.zip
Auto merge of #15844 - notriddle:domain_match_lowercase, r=nox
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 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15844) <!-- Reviewable:end -->
-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'.' &&