diff --git a/proxmox-http/src/http/client/connector.rs b/proxmox-http/src/client/connector.rs similarity index 97% rename from proxmox-http/src/http/client/connector.rs rename to proxmox-http/src/client/connector.rs index d69fdf24..eac83354 100644 --- a/proxmox-http/src/http/client/connector.rs +++ b/proxmox-http/src/client/connector.rs @@ -14,7 +14,9 @@ use tokio_openssl::SslStream; use proxmox::sys::linux::socket::set_tcp_keepalive; -use crate::http::{helpers, MaybeTlsStream, ProxyConfig}; +use crate::tls::MaybeTlsStream; +use crate::proxy_config::ProxyConfig; +use crate::uri::build_authority; #[derive(Clone)] pub struct HttpsConnector { @@ -131,7 +133,7 @@ impl hyper::service::Service for HttpsConnector { if let Some(ref proxy) = self.proxy { let use_connect = is_https || proxy.force_connect; - let proxy_authority = match helpers::build_authority(&proxy.host, proxy.port) { + let proxy_authority = match build_authority(&proxy.host, proxy.port) { Ok(authority) => authority, Err(err) => return futures::future::err(err).boxed(), }; diff --git a/proxmox-http/src/http/client.rs b/proxmox-http/src/client/mod.rs similarity index 99% rename from proxmox-http/src/http/client.rs rename to proxmox-http/src/client/mod.rs index c55cbd49..52d356d7 100644 --- a/proxmox-http/src/http/client.rs +++ b/proxmox-http/src/client/mod.rs @@ -1,5 +1,4 @@ mod connector; - pub use connector::HttpsConnector; mod simple; diff --git a/proxmox-http/src/http/client/simple.rs b/proxmox-http/src/client/simple.rs similarity index 98% rename from proxmox-http/src/http/client/simple.rs rename to proxmox-http/src/client/simple.rs index b6e6d5a2..4d04d7e9 100644 --- a/proxmox-http/src/http/client/simple.rs +++ b/proxmox-http/src/client/simple.rs @@ -7,7 +7,8 @@ use hyper::client::{Client, HttpConnector}; use hyper::Body; use openssl::ssl::{SslConnector, SslMethod}; -use crate::http::{client::HttpsConnector, ProxyConfig}; +use crate::client::HttpsConnector; +use crate::proxy_config::ProxyConfig; /// Options for a SimpleHttp client. #[derive(Default)] diff --git a/proxmox-http/src/http/mod.rs b/proxmox-http/src/http/mod.rs deleted file mode 100644 index 38037130..00000000 --- a/proxmox-http/src/http/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod wrapper; -pub use wrapper::MaybeTlsStream; - -pub mod helpers; - -mod proxy_config; -pub use proxy_config::ProxyConfig; - -#[cfg(feature = "client")] -pub mod client; diff --git a/proxmox-http/src/lib.rs b/proxmox-http/src/lib.rs index aa44c0dd..664a493d 100644 --- a/proxmox-http/src/lib.rs +++ b/proxmox-http/src/lib.rs @@ -1,5 +1,18 @@ +//! HTTP related utilities used by various Proxmox products. + #[cfg(feature = "websocket")] pub mod websocket; -#[cfg(any(feature = "http-helpers", feature = "client"))] -pub mod http; +#[cfg(any(feature = "http-helpers"))] +pub mod tls; + +#[cfg(any(feature = "http-helpers"))] +pub mod uri; + +#[cfg(any(feature = "http-helpers"))] +pub mod proxy_config; +#[cfg(any(feature = "http-helpers"))] +pub use proxy_config::ProxyConfig; + +#[cfg(feature = "client")] +pub mod client; diff --git a/proxmox-http/src/http/proxy_config.rs b/proxmox-http/src/proxy_config.rs similarity index 96% rename from proxmox-http/src/http/proxy_config.rs rename to proxmox-http/src/proxy_config.rs index 3fe7cbaf..1a0abfa1 100644 --- a/proxmox-http/src/http/proxy_config.rs +++ b/proxmox-http/src/proxy_config.rs @@ -2,7 +2,7 @@ use anyhow::{bail, format_err, Error}; use http::Uri; -use crate::http::helpers; +use crate::uri::build_authority; /// HTTP Proxy Configuration #[derive(Clone)] @@ -75,7 +75,7 @@ impl ProxyConfig { /// Assemble canonical proxy string (including scheme and port) pub fn to_proxy_string(&self) -> Result { - let authority = helpers::build_authority(&self.host, self.port)?; + let authority = build_authority(&self.host, self.port)?; Ok(match self.authorization { None => format!("http://{}", authority), Some(ref authorization) => format!("http://{}@{}", authorization, authority), diff --git a/proxmox-http/src/http/wrapper.rs b/proxmox-http/src/tls.rs similarity index 100% rename from proxmox-http/src/http/wrapper.rs rename to proxmox-http/src/tls.rs diff --git a/proxmox-http/src/http/helpers.rs b/proxmox-http/src/uri.rs similarity index 100% rename from proxmox-http/src/http/helpers.rs rename to proxmox-http/src/uri.rs