mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Correctly handle flag local_urls_only
In function Request::fetch_main, flag local_urls_only (if set) should allow fetching local urls only. Before this change, the flag had the inverse behaviour.
This commit is contained in:
parent
ef8d36d208
commit
6576fde29b
3 changed files with 43 additions and 6 deletions
|
@ -110,11 +110,8 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
let mut response = None;
|
||||
|
||||
// Step 2
|
||||
if request.local_urls_only {
|
||||
match &*request.current_url().scheme {
|
||||
"about" | "blob" | "data" | "filesystem" => response = Some(Response::network_error()),
|
||||
_ => { }
|
||||
};
|
||||
if request.local_urls_only && !url_is_local(&request.current_url()) {
|
||||
response = Some(Response::network_error());
|
||||
}
|
||||
|
||||
// Step 3
|
||||
|
@ -1047,6 +1044,13 @@ fn includes_credentials(url: &Url) -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
fn url_is_local(url: &Url) -> bool {
|
||||
match &*url.scheme {
|
||||
"about" | "blob" | "data" | "filesystem" => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
||||
fn response_needs_revalidation(_response: &Response) -> bool {
|
||||
// TODO this function
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue