fix: emergency patch for 403

This commit is contained in:
Matthew Esposito 2024-10-31 16:06:29 -04:00
parent bc9530821d
commit efdf1848ac
2 changed files with 12 additions and 3 deletions

View File

@ -154,7 +154,10 @@ async fn stream(url: &str, req: &Request<Body>) -> Result<Response<Body>, String
let parsed_uri = url.parse::<Uri>().map_err(|_| "Couldn't parse URL".to_string())?;
// Build the hyper client from the HTTPS connector.
let client: Client<_, Body> = CLIENT.clone();
let client: Client<_, Body> = {
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
client::Client::builder().pool_max_idle_per_host(0).build(https)
};
let mut builder = Request::get(parsed_uri);
@ -216,7 +219,10 @@ fn request(method: &'static Method, path: String, redirect: bool, quarantine: bo
let url = format!("{base_path}{path}");
// Construct the hyper client from the HTTPS connector.
let client: Client<_, Body> = CLIENT.clone();
let client: Client<_, Body> = {
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
client::Client::builder().pool_max_idle_per_host(0).build(https)
};
let (token, vendor_id, device_id, user_agent, loid) = {
let client = OAUTH_CLIENT.load_full();

View File

@ -94,7 +94,10 @@ impl Oauth {
trace!("Sending token request...");
// Send request
let client: client::Client<_, Body> = CLIENT.clone();
let client: client::Client<_, Body> = {
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
client::Client::builder().pool_max_idle_per_host(0).build(https)
};
let resp = client.request(request).await.ok()?;
trace!("Received response with status {} and length {:?}", resp.status(), resp.headers().get("content-length"));