mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #10154 - stjepang:fix-local-urls-only-10147, r=KiChjang
Fix #10147: 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. Fixes #10147. Test with: `./mach test-unit -p net fetch::test_fetch_with_local_urls_only` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10154) <!-- Reviewable:end -->
This commit is contained in:
commit
38e8c923b5
3 changed files with 36 additions and 4 deletions
|
@ -112,9 +112,9 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
// Step 2
|
||||
if request.local_urls_only {
|
||||
match &*request.current_url().scheme {
|
||||
"about" | "blob" | "data" | "filesystem" => response = Some(Response::network_error()),
|
||||
_ => { }
|
||||
};
|
||||
"about" | "blob" | "data" | "filesystem" => (), // Ok, the URL is local.
|
||||
_ => response = Some(Response::network_error())
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3
|
||||
|
|
|
@ -152,7 +152,7 @@ impl Request {
|
|||
pub fn new(url: Url,
|
||||
origin: Option<Origin>,
|
||||
is_service_worker_global_scope: bool) -> Request {
|
||||
Request {
|
||||
Request {
|
||||
method: RefCell::new(Method::Get),
|
||||
local_urls_only: false,
|
||||
sandboxed_storage_area_urls: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue