Skip to content

Commit

Permalink
fix: emergency patch for 403
Browse files Browse the repository at this point in the history
  • Loading branch information
sigaloid committed Oct 31, 2024
1 parent bc95308 commit efdf184
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion src/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit efdf184

Please sign in to comment.