From 00c6ff18cf56cb499f8192c68ab24dd5819f43de Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Tue, 6 Aug 2024 16:43:33 -0700 Subject: [PATCH] remove outdated easylist host redirection --- tests/live.rs | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/tests/live.rs b/tests/live.rs index 96ec395b..578738ef 100644 --- a/tests/live.rs +++ b/tests/live.rs @@ -86,53 +86,13 @@ static ALL_FILTERS: once_cell::sync::Lazy 10); // sanity check let filters_fut: Vec<_> = default_lists .iter() .map(|list| { println!("Starting download of filter, '{}'", list.url); - // 'easylist.to' is deployed via GitHub Pages. However, sometimes 'easylist.to' can - // take minutes to respond despite 'easylist.github.io' having no delay. - // - // In one test, the first request below ↓ took <1 second, and the second request took ~7 minutes - // time curl --fail -H 'Host: easylist.to' https://easylist.github.io/easylist/easylist.txt -o /dev/null - // time curl --fail https://easylist.to/easylist/easylist.txt -o /dev/null - // - // Toggle the `cfg` below if encountering this issue during local development. - // (e.g., add '--cfg override_easylist_host' to RUSTFLAGS) - #[cfg(any(override_easylist_host))] - let downloader = { - let client = reqwest::Client::builder() - .redirect(reqwest::redirect::Policy::none()) - .build() - .unwrap(); - if list.url.starts_with("https://easylist.to") { - // The use of 'http' rather than 'https' below is intentional. reqwest only - // respects the host header if the target url is http, not https. (Unclear - // whether that's a bug or intentional behavior.) One way to confirm that is - // to send requests to http://httpbin.org/headers instead of github.io. - client - .get(&list.url.replace("https://easylist.to", "http://easylist.github.io")) - .header(reqwest::header::HOST, "easylist.to") - .send() - } else { - // leave all other filter list requests unmodified - client.get(&list.url).send() - } - }; - - #[cfg(not(override_easylist_host))] - let downloader = reqwest::get(&list.url); - downloader + reqwest::get(&list.url) .then(move |resp| { let response = resp.expect("Could not request rules"); if response.status() != 200 { @@ -142,14 +102,11 @@ static ALL_FILTERS: once_cell::sync::Lazy