aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/cookie.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-09 12:54:42 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-06-09 12:54:42 -0500
commit4dbba2dcabbde11b01a95078ba75742aff3fc44d (patch)
treea796241b1377d020af8da3c7d8ad20f465d2297b /components/net/cookie.rs
parent0ac1ff066107def0781d18e1d76856380a349bef (diff)
parentdbef65129f40ce6ca0e8ee7e520ec366c1c7577e (diff)
downloadservo-4dbba2dcabbde11b01a95078ba75742aff3fc44d.tar.gz
servo-4dbba2dcabbde11b01a95078ba75742aff3fc44d.zip
Auto merge of #11513 - fduraffourg:pr11216, r=jdm
Add mach command to update public domain list and use a HashSet for matching <!-- Please describe your changes on the following line: --> Add a `mach update-pub-domains` command that update the public domain list used by servo. Replace the Vec matching with a HashSet which is way quicker. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11216 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11513) <!-- Reviewable:end -->
Diffstat (limited to 'components/net/cookie.rs')
-rw-r--r--components/net/cookie.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/components/net/cookie.rs b/components/net/cookie.rs
index e85f0b41397..558d8e49a8c 100644
--- a/components/net/cookie.rs
+++ b/components/net/cookie.rs
@@ -7,7 +7,7 @@
use cookie_rs;
use net_traits::CookieSource;
-use pub_domains::PUB_DOMAINS;
+use pub_domains::is_pub_domain;
use std::borrow::ToOwned;
use std::net::{Ipv4Addr, Ipv6Addr};
use time::{Tm, now, at, Duration};
@@ -45,10 +45,12 @@ impl Cookie {
let mut domain = cookie.domain.clone().unwrap_or("".to_owned());
// Step 5
- match PUB_DOMAINS.iter().find(|&x| domain == *x) {
- Some(val) if *val == url_host => domain = "".to_owned(),
- Some(_) => return None,
- None => {}
+ if is_pub_domain(&domain) {
+ if domain == url_host {
+ domain = "".to_owned();
+ } else {
+ return None
+ }
}
// Step 6