mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make fetch take a &Request
This commit is contained in:
parent
9601a66b60
commit
f42a63baea
7 changed files with 87 additions and 91 deletions
|
@ -42,7 +42,6 @@ use net_traits::FetchTaskTarget;
|
|||
use net_traits::request::Request;
|
||||
use net_traits::response::Response;
|
||||
use servo_url::ServoUrl;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
|
||||
const DEFAULT_USER_AGENT: &'static str = "Such Browser. Very Layout. Wow.";
|
||||
|
@ -70,22 +69,22 @@ impl FetchTaskTarget for FetchResponseCollector {
|
|||
}
|
||||
}
|
||||
|
||||
fn fetch(request: Request, dc: Option<Sender<DevtoolsControlMsg>>) -> Response {
|
||||
fn fetch(request: &Request, dc: Option<Sender<DevtoolsControlMsg>>) -> Response {
|
||||
fetch_with_context(request, &new_fetch_context(dc))
|
||||
}
|
||||
|
||||
fn fetch_with_context(request: Request, context: &FetchContext) -> Response {
|
||||
fn fetch_with_context(request: &Request, context: &FetchContext) -> Response {
|
||||
let (sender, receiver) = channel();
|
||||
let mut target = FetchResponseCollector {
|
||||
sender: sender,
|
||||
};
|
||||
|
||||
methods::fetch(Rc::new(request), &mut target, context);
|
||||
methods::fetch(request, &mut target, context);
|
||||
|
||||
receiver.recv().unwrap()
|
||||
}
|
||||
|
||||
fn fetch_with_cors_cache(request: Rc<Request>, cache: &mut CorsCache) -> Response {
|
||||
fn fetch_with_cors_cache(request: &Request, cache: &mut CorsCache) -> Response {
|
||||
let (sender, receiver) = channel();
|
||||
let mut target = FetchResponseCollector {
|
||||
sender: sender,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue