mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 14:19:07 +00:00
reorganize crate
it's a 'http' utility crate * the extra 'http' module is redundant * the module name 'helpers' as a public path doesn't say much about what it does Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
3a161119c2
commit
ca9dd7ec36
@ -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<Uri> 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(),
|
||||
};
|
@ -1,5 +1,4 @@
|
||||
mod connector;
|
||||
|
||||
pub use connector::HttpsConnector;
|
||||
|
||||
mod simple;
|
@ -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)]
|
@ -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;
|
@ -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;
|
||||
|
@ -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<String, Error> {
|
||||
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),
|
Loading…
Reference in New Issue
Block a user