aboutsummaryrefslogtreecommitdiff
path: root/src/request/non_blocking.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-11 06:04:01 +0000
committerFuwn <[email protected]>2025-09-11 06:04:01 +0000
commit51e79294d8fbfb1bd4be8584e2d32ff0712227aa (patch)
treee77c766264366af78345c2e1da823e6610c852a6 /src/request/non_blocking.rs
parentfix(request): Handle malformed response header (diff)
downloadgerm-51e79294d8fbfb1bd4be8584e2d32ff0712227aa.tar.xz
germ-51e79294d8fbfb1bd4be8584e2d32ff0712227aa.zip
fix(request): Handle invalid URLs
Diffstat (limited to 'src/request/non_blocking.rs')
-rw-r--r--src/request/non_blocking.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/request/non_blocking.rs b/src/request/non_blocking.rs
index 3bbcd95..85856e7 100644
--- a/src/request/non_blocking.rs
+++ b/src/request/non_blocking.rs
@@ -55,10 +55,16 @@ pub async fn request(url: &url::Url) -> anyhow::Result<Response> {
.with_no_client_auth(),
))
.connect(
- rustls::ServerName::try_from(url.domain().unwrap_or_default())?,
+ rustls::ServerName::try_from(
+ url
+ .domain()
+ .ok_or_else(|| anyhow::anyhow!("Invalid URL: missing domain"))?,
+ )?,
tokio::net::TcpStream::connect(format!(
"{}:{}",
- url.domain().unwrap_or(""),
+ url
+ .domain()
+ .ok_or_else(|| anyhow::anyhow!("Invalid URL: missing domain"))?,
url.port().unwrap_or(1965)
))
.await?,