From aa57cc924daabde516219ef509ac3d258bd08fa7 Mon Sep 17 00:00:00 2001 From: Joep Meindertsma Date: Sat, 9 Apr 2022 12:42:23 +0200 Subject: [PATCH] #374 replace `awc` with `ureq` --- CHANGELOG.md | 1 + Cargo.lock | 37 +------------------------------------ server/Cargo.toml | 2 +- server/src/https.rs | 10 ++++++---- 4 files changed, 9 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aed55734..639986bd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ By far most changes relate to `atomic-server`, so if not specified, assume the c - Updated various dependencies, and made `cargo.toml` less restrictive. - Remove `async-std` calls from `upload.rs` - Added `reset` and `show-config` commands to `atomic-server`. +- Replaced `awc` with `ureq` #374 ## [v0.31.1] - 2022-03-29 diff --git a/Cargo.lock b/Cargo.lock index dd91329a1..a772229bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,7 +228,6 @@ dependencies = [ "actix-service", "actix-utils", "futures-core", - "http", "log", "pin-project-lite", "tokio-rustls", @@ -565,7 +564,6 @@ dependencies = [ "actix-web-actors", "actix-web-static-files", "atomic_lib", - "awc", "chrono", "clap 3.1.6", "dialoguer", @@ -590,6 +588,7 @@ dependencies = [ "tracing-chrome", "tracing-log", "tracing-subscriber", + "ureq 2.4.0", "urlencoding", ] @@ -666,40 +665,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "awc" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c60c44fbf3c8cee365e86b97d706e513b733c4eeb16437b45b88d2fffe889a" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "actix-tls", - "actix-utils", - "ahash", - "base64", - "bytes", - "cfg-if 1.0.0", - "cookie 0.16.0", - "derive_more", - "futures-core", - "futures-util", - "h2", - "http", - "itoa 1.0.1", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "rand 0.8.5", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", -] - [[package]] name = "base-x" version = "0.2.8" diff --git a/server/Cargo.toml b/server/Cargo.toml index ee2bf9f53..9ca5ccd23 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -20,7 +20,6 @@ actix-cors = "0.6" actix-files = "0.6" actix-multipart = "0.4" actix-web-actors = "=4.0.0" -awc = "3" chrono = "0.4" dialoguer = "0.10" directories = ">= 2, < 5" @@ -40,6 +39,7 @@ tracing = "0.1" tracing-actix-web = "0.5" tracing-chrome = "0.5" tracing-log = "0.1" +ureq = "2" urlencoding = "2" [dependencies.acme-lib] diff --git a/server/src/https.rs b/server/src/https.rs index 7e6dd6c96..7912aa3d0 100644 --- a/server/src/https.rs +++ b/server/src/https.rs @@ -47,13 +47,15 @@ pub async fn cert_init_server(config: &crate::config::Config) -> Result<(), Erro let handle = rx.recv().unwrap(); - let client = awc::Client::new(); + let agent = ureq::builder() + .timeout(std::time::Duration::from_secs(2)) + .build(); + let well_known_url = format!("http://{}/.well-known/", &config.opts.domain); tracing::info!("Testing availability of {}", &well_known_url); - let resp = client + let resp = agent .get(&well_known_url) - .send() - .await + .call() .expect("Unable to send request for Let's Encrypt initialization"); if resp.status() != 200 { return Err(