mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Pass the url by value to websocket_loader::main_fetch
This commit is contained in:
parent
fb86bfebf4
commit
5313e00e3a
1 changed files with 6 additions and 6 deletions
|
@ -36,7 +36,7 @@ pub fn init(connect: WebSocketCommunicate,
|
||||||
connect_data: WebSocketConnectData,
|
connect_data: WebSocketConnectData,
|
||||||
http_state: Arc<HttpState>) {
|
http_state: Arc<HttpState>) {
|
||||||
thread::Builder::new().name(format!("WebSocket connection to {}", connect_data.resource_url)).spawn(move || {
|
thread::Builder::new().name(format!("WebSocket connection to {}", connect_data.resource_url)).spawn(move || {
|
||||||
let channel = establish_a_websocket_connection(&connect_data.resource_url,
|
let channel = establish_a_websocket_connection(connect_data.resource_url,
|
||||||
connect_data.origin,
|
connect_data.origin,
|
||||||
connect_data.protocols,
|
connect_data.protocols,
|
||||||
&http_state);
|
&http_state);
|
||||||
|
@ -146,7 +146,7 @@ fn obtain_a_websocket_connection(url: &ServoUrl) -> Result<Stream, NetworkError>
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-websocket-establish
|
// https://fetch.spec.whatwg.org/#concept-websocket-establish
|
||||||
fn establish_a_websocket_connection(resource_url: &ServoUrl,
|
fn establish_a_websocket_connection(resource_url: ServoUrl,
|
||||||
origin: String,
|
origin: String,
|
||||||
protocols: Vec<String>,
|
protocols: Vec<String>,
|
||||||
http_state: &HttpState)
|
http_state: &HttpState)
|
||||||
|
@ -268,7 +268,7 @@ struct Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-fetch
|
// https://fetch.spec.whatwg.org/#concept-fetch
|
||||||
fn fetch(url: &ServoUrl,
|
fn fetch(url: ServoUrl,
|
||||||
origin: String,
|
origin: String,
|
||||||
mut headers: Headers,
|
mut headers: Headers,
|
||||||
http_state: &HttpState)
|
http_state: &HttpState)
|
||||||
|
@ -306,7 +306,7 @@ fn fetch(url: &ServoUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-main-fetch
|
// https://fetch.spec.whatwg.org/#concept-main-fetch
|
||||||
fn main_fetch(url: &ServoUrl,
|
fn main_fetch(url: ServoUrl,
|
||||||
origin: String,
|
origin: String,
|
||||||
mut headers: Headers,
|
mut headers: Headers,
|
||||||
http_state: &HttpState)
|
http_state: &HttpState)
|
||||||
|
@ -324,7 +324,7 @@ fn main_fetch(url: &ServoUrl,
|
||||||
// TODO: handle upgrade to a potentially secure URL.
|
// TODO: handle upgrade to a potentially secure URL.
|
||||||
|
|
||||||
// Step 5.
|
// Step 5.
|
||||||
if should_be_blocked_due_to_bad_port(url) {
|
if should_be_blocked_due_to_bad_port(&url) {
|
||||||
response = Some(Err(NetworkError::Internal("Request should be blocked due to bad port.".into())));
|
response = Some(Err(NetworkError::Internal("Request should be blocked due to bad port.".into())));
|
||||||
}
|
}
|
||||||
// TODO: handle blocking as mixed content.
|
// TODO: handle blocking as mixed content.
|
||||||
|
@ -352,7 +352,7 @@ fn main_fetch(url: &ServoUrl,
|
||||||
// doesn't need to be filtered at all.
|
// doesn't need to be filtered at all.
|
||||||
|
|
||||||
// Step 12.2.
|
// Step 12.2.
|
||||||
basic_fetch(url, origin, &mut headers, http_state)
|
basic_fetch(&url, origin, &mut headers, http_state)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Step 13.
|
// Step 13.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue