Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump reqwest & hyper and allow http2 negotiation #125

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tar = { version = "0.4", optional = true }
semver = "1.0"
zip = { version = "0.6", default-features = false, features = ["time"], optional = true }
either = { version = "1", optional = true }
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json"] }
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls", "http2"] }
hyper = "1"
indicatif = "0.17"
quick-xml = "0.23"
Expand Down
18 changes: 15 additions & 3 deletions src/backends/gitea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ impl ReleaseList {
}

fn fetch_releases(&self, url: &str) -> Result<Vec<Release>> {
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(url)
.headers(api_headers(&self.auth_token)?)
.send()?;
Expand Down Expand Up @@ -503,7 +507,11 @@ impl ReleaseUpdate for Update {
"{}/api/v1/repos/{}/{}/releases",
self.host, self.repo_owner, self.repo_name
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(self.api_headers(&self.auth_token)?)
.send()?;
Expand All @@ -525,7 +533,11 @@ impl ReleaseUpdate for Update {
"{}/api/v1/repos/{}/{}/releases/{}",
self.host, self.repo_owner, self.repo_name, ver
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(self.api_headers(&self.auth_token)?)
.send()?;
Expand Down
18 changes: 15 additions & 3 deletions src/backends/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ impl ReleaseList {
}

fn fetch_releases(&self, url: &str) -> Result<Vec<Release>> {
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(url)
.headers(api_headers(&self.auth_token)?)
.send()?;
Expand Down Expand Up @@ -518,7 +522,11 @@ impl ReleaseUpdate for Update {
self.repo_owner,
self.repo_name
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(api_headers(&self.auth_token)?)
.send()?;
Expand All @@ -545,7 +553,11 @@ impl ReleaseUpdate for Update {
self.repo_name,
ver
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(api_headers(&self.auth_token)?)
.send()?;
Expand Down
18 changes: 15 additions & 3 deletions src/backends/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ impl ReleaseList {
}

fn fetch_releases(&self, url: &str) -> Result<Vec<Release>> {
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(url)
.headers(api_headers(&self.auth_token)?)
.send()?;
Expand Down Expand Up @@ -498,7 +502,11 @@ impl ReleaseUpdate for Update {
urlencoding::encode(&self.repo_owner),
self.repo_name
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(self.api_headers(&self.auth_token)?)
.send()?;
Expand All @@ -523,7 +531,11 @@ impl ReleaseUpdate for Update {
self.repo_name,
ver
);
let resp = reqwest::blocking::Client::new()
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client
.get(&api_url)
.headers(self.api_headers(&self.auth_token)?)
.send()?;
Expand Down
6 changes: 5 additions & 1 deletion src/backends/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,11 @@ fn fetch_releases_from_s3(

debug!("using api url: {:?}", api_url);

let resp = reqwest::blocking::Client::new().get(&api_url).send()?;
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client.get(&api_url).send()?;
if !resp.status().is_success() {
bail!(
Error::Network,
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,11 @@ impl Download {
}

set_ssl_vars!();
let resp = reqwest::blocking::Client::new()
.get(&self.url)
.headers(headers)
.send()?;
let client = reqwest::blocking::ClientBuilder::new()
.use_rustls_tls()
.http2_adaptive_window(true)
.build()?;
let resp = client.get(&self.url).headers(headers).send()?;
let size = resp
.headers()
.get(reqwest::header::CONTENT_LENGTH)
Expand Down