aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/download.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/download.rs b/src/download.rs
index 9e126dd..7cf9694 100644
--- a/src/download.rs
+++ b/src/download.rs
@@ -4,13 +4,16 @@ use anyhow::{Error, Context};
use fehler::throws;
use hyper::Uri;
use hyper::body::HttpBody;
-use hyper::client::Client;
+use hyper::client::{Client, HttpConnector};
use hyper::header::{CONTENT_TYPE, LOCATION};
+use hyper_rustls::HttpsConnector;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use super::Args;
+type HttpsClient = Client<HttpsConnector<HttpConnector>>;
+
#[throws]
pub(crate) async fn download(url: Uri, args: &Args) {
let output_file_path = if let Some(output) = &args.output_document {
@@ -23,7 +26,7 @@ pub(crate) async fn download(url: Uri, args: &Args) {
}
};
- let client = Client::new();
+ let client: HttpsClient = Client::builder().build(HttpsConnector::with_native_roots());
let mut response = client.get(url.clone()).await?;
while response.status().is_redirection() {
let location = response.headers()