proxmox/proxmox-http/src/http_options.rs
Fabian Grünbichler ab5d5b39f6 http: move SimpleHttpOptions to http-helpers feature
and rename it to HttpOptions, since it's not specific to the "Simple"
client at all.

this is a breaking change.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00

25 lines
617 B
Rust

use crate::ProxyConfig;
/// Options for an HTTP client.
#[derive(Default)]
pub struct HttpOptions {
/// Proxy configuration
pub proxy_config: Option<ProxyConfig>,
/// `User-Agent` header value
pub user_agent: Option<String>,
/// TCP keepalive time, defaults to 7200
pub tcp_keepalive: Option<u32>,
}
impl HttpOptions {
pub fn get_proxy_authorization(&self) -> Option<String> {
if let Some(ref proxy_config) = self.proxy_config {
if !proxy_config.force_connect {
return proxy_config.authorization.clone();
}
}
None
}
}