mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Urlmageddon: Use refcounted urls more often.
This commit is contained in:
parent
f14e7339b5
commit
913c874cb5
161 changed files with 1044 additions and 718 deletions
|
@ -8,10 +8,10 @@
|
|||
use cookie_rs;
|
||||
use net_traits::CookieSource;
|
||||
use net_traits::pub_domains::is_pub_domain;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::ToOwned;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use time::{Tm, now, at, Duration};
|
||||
use url::Url;
|
||||
|
||||
/// A stored cookie that wraps the definition in cookie-rs. This is used to implement
|
||||
/// various behaviours defined in the spec that rely on an associated request URL,
|
||||
|
@ -28,7 +28,7 @@ pub struct Cookie {
|
|||
|
||||
impl Cookie {
|
||||
/// http://tools.ietf.org/html/rfc6265#section-5.3
|
||||
pub fn new_wrapped(mut cookie: cookie_rs::Cookie, request: &Url, source: CookieSource)
|
||||
pub fn new_wrapped(mut cookie: cookie_rs::Cookie, request: &ServoUrl, source: CookieSource)
|
||||
-> Option<Cookie> {
|
||||
// Step 3
|
||||
let (persistent, expiry_time) = match (&cookie.max_age, &cookie.expires) {
|
||||
|
@ -145,7 +145,7 @@ impl Cookie {
|
|||
}
|
||||
|
||||
// http://tools.ietf.org/html/rfc6265#section-5.4 step 1
|
||||
pub fn appropriate_for_url(&self, url: &Url, source: CookieSource) -> bool {
|
||||
pub fn appropriate_for_url(&self, url: &ServoUrl, source: CookieSource) -> bool {
|
||||
let domain = url.host_str();
|
||||
if self.host_only {
|
||||
if self.cookie.domain.as_ref().map(String::as_str) != domain {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue