diff --git a/proxmox-http/src/client/connector.rs b/proxmox-http/src/client/connector.rs index eac83354..abbd0f1a 100644 --- a/proxmox-http/src/client/connector.rs +++ b/proxmox-http/src/client/connector.rs @@ -135,7 +135,7 @@ impl hyper::service::Service for HttpsConnector { let proxy_authority = match build_authority(&proxy.host, proxy.port) { Ok(authority) => authority, - Err(err) => return futures::future::err(err).boxed(), + Err(err) => return futures::future::err(err.into()).boxed(), }; let proxy_uri = match Uri::builder() diff --git a/proxmox-http/src/uri.rs b/proxmox-http/src/uri.rs index ca671612..0f05ec7e 100644 --- a/proxmox-http/src/uri.rs +++ b/proxmox-http/src/uri.rs @@ -1,9 +1,10 @@ -use anyhow::Error; +//! URI Related helpers, such as `build_authority` -use http::uri::Authority; +use http::uri::{Authority, InvalidUri}; -// Build a http::uri::Authority ("host:port"), use '[..]' around IPv6 addresses -pub fn build_authority(host: &str, port: u16) -> Result { +// Build an [`Authority`](http::uri::Authority) from a combination of `host` and `port`, ensuring that +// IPv6 addresses are enclosed in brackets. +pub fn build_authority(host: &str, port: u16) -> Result { let bytes = host.as_bytes(); let len = bytes.len(); let authority =