Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use crate::async_impl::h3_client::H3Client;
use crate::config::{RequestConfig, TotalTimeout};
#[cfg(unix)]
use crate::connect::uds::UnixSocketProvider;
#[cfg(target_os = "windows")]
use crate::connect::windows_named_pipe::WindowsNamedPipeProvider;
use crate::connect::{
sealed::{Conn, Unnameable},
BoxedConnectorLayer, BoxedConnectorService, Connector, ConnectorBuilder,
Expand Down Expand Up @@ -227,6 +229,8 @@ struct Config {

#[cfg(unix)]
unix_socket: Option<Arc<std::path::Path>>,
#[cfg(target_os = "windows")]
windows_named_pipe: Option<Arc<std::ffi::OsStr>>,
}

impl Default for ClientBuilder {
Expand Down Expand Up @@ -352,6 +356,8 @@ impl ClientBuilder {
dns_resolver: None,
#[cfg(unix)]
unix_socket: None,
#[cfg(target_os = "windows")]
windows_named_pipe: None,
},
}
}
Expand Down Expand Up @@ -886,6 +892,8 @@ impl ClientBuilder {
// ways TLS can be configured...
#[cfg(unix)]
connector_builder.set_unix_socket(config.unix_socket);
#[cfg(target_os = "windows")]
connector_builder.set_windows_named_pipe(config.windows_named_pipe.clone());

let mut builder =
hyper_util::client::legacy::Client::builder(hyper_util::rt::TokioExecutor::new());
Expand Down Expand Up @@ -1720,6 +1728,26 @@ impl ClientBuilder {
self
}

/// Set that all connections will use this Windows named pipe.
///
/// If a request URI uses the `https` scheme, TLS will still be used over
/// the Windows named pipe.
///
/// # Note
///
/// This option is not compatible with any of the TCP or Proxy options.
/// Setting this will ignore all those options previously set.
///
/// Likewise, DNS resolution will not be done on the domain name.
#[cfg(target_os = "windows")]
pub fn windows_named_pipe(mut self, pipe: impl WindowsNamedPipeProvider) -> ClientBuilder {
self.config.windows_named_pipe = Some(
pipe.reqwest_windows_named_pipe_path(crate::connect::windows_named_pipe::Internal)
.into(),
);
self
}

// TLS options

/// Add a custom root certificate.
Expand Down
Loading
Loading