Skip to content

Commit

Permalink
Fix broken compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
algesten committed Jul 27, 2024
1 parent 68cd7bc commit db1e1aa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ impl Agent {
} else {
Some(body.body_mode())
};
#[cfg(any(feature = "gzip", feature = "brotli"))]
let has_header_accept_enc = headers.has_accept_encoding();
let has_header_ua = headers.has_user_agent();

Expand Down
16 changes: 11 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ impl Default for AgentConfig {

impl fmt::Debug for AgentConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AgentConfig")
.field("timeout_global", &self.timeout_global)
let mut dbg = f.debug_struct("AgentConfig");

dbg.field("timeout_global", &self.timeout_global)
.field("timeout_per_call", &self.timeout_per_call)
.field("timeout_resolve", &self.timeout_resolve)
.field("timeout_connect", &self.timeout_connect)
Expand All @@ -242,8 +243,13 @@ impl fmt::Debug for AgentConfig {
&self.max_idle_connections_per_host,
)
.field("max_idle_age", &self.max_idle_age)
.field("tls_config", &self.tls_config)
.field("proxy", &self.proxy)
.finish()
.field("proxy", &self.proxy);

#[cfg(feature = "_tls")]
{
dbg.field("tls_config", &self.tls_config);
}

dbg.finish()
}
}
2 changes: 1 addition & 1 deletion src/tls/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! TLS for handling `https`.
mod cert;
use std::sync::Arc;

mod cert;
pub use cert::{parse_pem, Certificate, PemItem, PrivateKey};

#[cfg(feature = "rustls")]
Expand Down
7 changes: 3 additions & 4 deletions src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! * TCP Sockets
//! * SOCKS-proxy sockets
//! * HTTPS/TLS using rustls (feature flag **rustls**)
//! * HTTPS/TLS using native-tls (feature flag **native-tls** + [config](TlsProvider::NativeTls))
//! * HTTPS/TLS using native-tls (feature flag **native-tls** + [config](crate::tls::TlsProvider::NativeTls))
//!
//! The [`Connector`] trait anticipates a chain of connectors that each decide
//! whether to help perform the connection or not. It is for instance possible to make a
Expand All @@ -27,7 +27,6 @@ use std::net::SocketAddr;
use http::Uri;

use crate::resolver::Resolver;
use crate::tls::TlsProvider;
use crate::{AgentConfig, Error};

pub use self::tcp::TcpConnector;
Expand Down Expand Up @@ -228,7 +227,7 @@ impl Default for DefaultConnector {
// Panic if the config calls for rustls, the uri scheme is https and that
// TLS provider is not enabled by feature flags.
#[cfg(feature = "_tls")]
no_tls::WarnOnMissingTlsProvider(TlsProvider::RustlsWithRing).boxed(),
no_tls::WarnOnMissingTlsProvider(crate::tls::TlsProvider::RustlsWithRing).boxed(),
//
// As a fallback if rustls isn't enabled, use native-tls
#[cfg(feature = "native-tls")]
Expand All @@ -237,7 +236,7 @@ impl Default for DefaultConnector {
// Panic if the config calls for native-tls, the uri scheme is https and that
// TLS provider is not enabled by feature flags.
#[cfg(feature = "_tls")]
no_tls::WarnOnMissingTlsProvider(TlsProvider::NativeTls).boxed(),
no_tls::WarnOnMissingTlsProvider(crate::tls::TlsProvider::NativeTls).boxed(),
]);

DefaultConnector { chain }
Expand Down
2 changes: 2 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ pub(crate) trait HeaderMapExt {
fn get_str(&self, k: &str) -> Option<&str>;
fn is_chunked(&self) -> bool;
fn content_length(&self) -> Option<u64>;
#[cfg(any(feature = "gzip", feature = "brotli"))]
fn has_accept_encoding(&self) -> bool;
fn has_user_agent(&self) -> bool;
fn has_send_body_mode(&self) -> bool {
Expand All @@ -321,6 +322,7 @@ impl HeaderMapExt for HeaderMap {
Some(len)
}

#[cfg(any(feature = "gzip", feature = "brotli"))]
fn has_accept_encoding(&self) -> bool {
self.contains_key("accept-encoding")
}
Expand Down

0 comments on commit db1e1aa

Please sign in to comment.