mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -11,9 +11,9 @@
|
|||
|
||||
use hyper::method::Method;
|
||||
use net_traits::request::{CredentialsMode, Origin, Request};
|
||||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
use time::{self, Timespec};
|
||||
use url::Url;
|
||||
|
||||
/// Union type for CORS cache entries
|
||||
///
|
||||
|
@ -44,7 +44,7 @@ impl HeaderOrMethod {
|
|||
#[derive(Clone, Debug)]
|
||||
pub struct CorsCacheEntry {
|
||||
pub origin: Origin,
|
||||
pub url: Url,
|
||||
pub url: ServoUrl,
|
||||
pub max_age: u32,
|
||||
pub credentials: bool,
|
||||
pub header_or_method: HeaderOrMethod,
|
||||
|
@ -52,7 +52,7 @@ pub struct CorsCacheEntry {
|
|||
}
|
||||
|
||||
impl CorsCacheEntry {
|
||||
fn new(origin: Origin, url: Url, max_age: u32, credentials: bool,
|
||||
fn new(origin: Origin, url: ServoUrl, max_age: u32, credentials: bool,
|
||||
header_or_method: HeaderOrMethod) -> CorsCacheEntry {
|
||||
CorsCacheEntry {
|
||||
origin: origin,
|
||||
|
|
|
@ -29,6 +29,7 @@ use net_traits::request::{RedirectMode, Referrer, Request, RequestMode, Response
|
|||
use net_traits::request::{Type, Origin, Window};
|
||||
use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType};
|
||||
use resource_thread::CancellationListener;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashSet;
|
||||
use std::error::Error;
|
||||
|
@ -40,7 +41,7 @@ use std::ops::Deref;
|
|||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use unicase::UniCase;
|
||||
use url::{Origin as UrlOrigin, Url};
|
||||
use url::{Origin as UrlOrigin};
|
||||
use util::thread::spawn_named;
|
||||
use uuid;
|
||||
|
||||
|
@ -1305,7 +1306,7 @@ fn cors_check(request: Rc<Request>, response: &Response) -> Result<(), ()> {
|
|||
Err(())
|
||||
}
|
||||
|
||||
fn has_credentials(url: &Url) -> bool {
|
||||
fn has_credentials(url: &ServoUrl) -> bool {
|
||||
!url.username().is_empty() || url.password().is_some()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue