pub struct EasyHttpWebClientBuilder<C = (), S = ()> { /* private fields */ }
Expand description
Builder that is designed to easily create a super::EasyHttpWebClient
from most basic use cases
Implementations§
Source§impl EasyHttpWebClientBuilder
impl EasyHttpWebClientBuilder
pub fn new() -> Self
pub fn with_default_transport_connector( self, ) -> EasyHttpWebClientBuilder<TcpConnector, TransportStage>
Sourcepub fn with_custom_transport_connector<C>(
self,
connector: C,
) -> EasyHttpWebClientBuilder<C, TransportStage>
pub fn with_custom_transport_connector<C>( self, connector: C, ) -> EasyHttpWebClientBuilder<C, TransportStage>
Add a custom transport connector that will be used by this client for the transport layer
Source§impl EasyHttpWebClientBuilder<TcpConnector, TransportStage>
impl EasyHttpWebClientBuilder<TcpConnector, TransportStage>
Sourcepub fn with_dns_resolver<T: DnsResolver + Clone>(
self,
resolver: T,
) -> EasyHttpWebClientBuilder<TcpConnector<T>, TransportStage>
pub fn with_dns_resolver<T: DnsResolver + Clone>( self, resolver: T, ) -> EasyHttpWebClientBuilder<TcpConnector<T>, TransportStage>
Add a custom DnsResolver
that will be used by this client
Source§impl<T> EasyHttpWebClientBuilder<T, TransportStage>
impl<T> EasyHttpWebClientBuilder<T, TransportStage>
Sourcepub fn with_custom_tls_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, ProxyTunnelStage>where
L: Layer<T>,
pub fn with_custom_tls_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, ProxyTunnelStage>where
L: Layer<T>,
Add a custom proxy tls connector that will be used to setup a tls connection to the proxy
Sourcepub fn with_tls_proxy_support_using_boringssl(
self,
) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
pub fn with_tls_proxy_support_using_boringssl( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Support a tls tunnel to the proxy itself using boringssl
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn with_tls_proxy_support_using_boringssl_config(
self,
config: Arc<TlsConnectorDataBuilder>,
) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
pub fn with_tls_proxy_support_using_boringssl_config( self, config: Arc<TlsConnectorDataBuilder>, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Support a tls tunnel to the proxy itself using boringssl and the provided config
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn with_tls_proxy_support_using_rustls(
self,
) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
pub fn with_tls_proxy_support_using_rustls( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Support a tls tunnel to the proxy itself using rustls
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn with_tls_proxy_support_using_rustls_config(
self,
config: TlsConnectorData,
) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
pub fn with_tls_proxy_support_using_rustls_config( self, config: TlsConnectorData, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Support a tls tunnel to the proxy itself using rustls and the provided config
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn without_tls_proxy_support(
self,
) -> EasyHttpWebClientBuilder<T, ProxyTunnelStage>
pub fn without_tls_proxy_support( self, ) -> EasyHttpWebClientBuilder<T, ProxyTunnelStage>
Don’t support a tls tunnel to the proxy itself
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Source§impl<T> EasyHttpWebClientBuilder<T, ProxyTunnelStage>
impl<T> EasyHttpWebClientBuilder<T, ProxyTunnelStage>
Sourcepub fn with_custom_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, ProxyStage>where
L: Layer<T>,
pub fn with_custom_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, ProxyStage>where
L: Layer<T>,
Add a custom proxy connector that will be used by this client
Sourcepub fn with_proxy_support(
self,
) -> EasyHttpWebClientBuilder<ProxyConnector<Arc<T>>, ProxyStage>
pub fn with_proxy_support( self, ) -> EasyHttpWebClientBuilder<ProxyConnector<Arc<T>>, ProxyStage>
Add support for usage of a http(s) and socks5(h) ProxyAddress
to this client
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn with_http_proxy_support(
self,
) -> EasyHttpWebClientBuilder<HttpProxyConnector<T>, ProxyStage>
pub fn with_http_proxy_support( self, ) -> EasyHttpWebClientBuilder<HttpProxyConnector<T>, ProxyStage>
Add support for usage of a http(s) ProxyAddress
to this client
Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself
Sourcepub fn with_socks5_proxy_support(
self,
) -> EasyHttpWebClientBuilder<Socks5ProxyConnector<T>, ProxyStage>
pub fn with_socks5_proxy_support( self, ) -> EasyHttpWebClientBuilder<Socks5ProxyConnector<T>, ProxyStage>
Add support for usage of a socks5(h) ProxyAddress
to this client
Sourcepub fn without_proxy_support(self) -> EasyHttpWebClientBuilder<T, ProxyStage>
pub fn without_proxy_support(self) -> EasyHttpWebClientBuilder<T, ProxyStage>
Make a client without proxy support
Source§impl<T> EasyHttpWebClientBuilder<T, ProxyStage>
impl<T> EasyHttpWebClientBuilder<T, ProxyStage>
Sourcepub fn with_custom_tls_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<HttpConnector<L::Service, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>where
L: Layer<T>,
pub fn with_custom_tls_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<HttpConnector<L::Service, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>where
L: Layer<T>,
Add a custom tls connector that will be used by the client
This will also add the HttpsAlpnModifier
request inspector as that one is
crucial to make tls alpn work and set the correct TargetHttpVersion
And a HttpVersionAdapter
that will adapt the request version to the configured
TargetHttpVersion
If you don’t want any of these inspector you can use Self::with_advanced_jit_req_inspector
to configure your own request inspectors or Self::without_jit_req_inspector
to remove
all the default request inspectors
Sourcepub fn with_tls_support_using_boringssl(
self,
config: Option<Arc<TlsConnectorDataBuilder>>,
) -> EasyHttpWebClientBuilder<HttpConnector<TlsConnector<T>, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>
pub fn with_tls_support_using_boringssl( self, config: Option<Arc<TlsConnectorDataBuilder>>, ) -> EasyHttpWebClientBuilder<HttpConnector<TlsConnector<T>, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>
Support https connections by using boringssl for tls
This will also add the HttpsAlpnModifier
request inspector as that one is
crucial to make tls alpn work and set the correct TargetHttpVersion
And a HttpVersionAdapter
that will adapt the request version to the configured
TargetHttpVersion
If you don’t want any of these inspector you can use Self::with_advanced_jit_req_inspector
to configure your own request inspectors or Self::without_jit_req_inspector
to remove
all the default request inspectors
Sourcepub fn with_tls_support_using_rustls(
self,
config: Option<TlsConnectorData>,
) -> EasyHttpWebClientBuilder<HttpConnector<TlsConnector<T>, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>
pub fn with_tls_support_using_rustls( self, config: Option<TlsConnectorData>, ) -> EasyHttpWebClientBuilder<HttpConnector<TlsConnector<T>, (HttpsAlpnModifier, HttpVersionAdapter)>, HttpStage>
Support https connections by using ruslts for tls
This will also add the HttpsAlpnModifier
request inspector as that one is
crucial to make tls alpn work and set the correct TargetHttpVersion
And a HttpVersionAdapter
that will adapt the request version to the configured
TargetHttpVersion
If you don’t want any of these inspector you can use Self::with_advanced_jit_req_inspector
to configure your own request inspectors or Self::without_jit_req_inspector
to remove
all the default request inspectors
Sourcepub fn without_tls_support(
self,
) -> EasyHttpWebClientBuilder<HttpConnector<T, HttpVersionAdapter>, HttpStage>
pub fn without_tls_support( self, ) -> EasyHttpWebClientBuilder<HttpConnector<T, HttpVersionAdapter>, HttpStage>
Dont support https on this connector
This will also add the HttpVersionAdapter
that will adapt the request version to
the configured TargetHttpVersion
If you don’t want any of these inspector you can use Self::with_advanced_jit_req_inspector
to configure your own request inspectors or Self::without_jit_req_inspector
to remove
all the default request inspectors
Source§impl<T, I1, I2> EasyHttpWebClientBuilder<HttpConnector<T, I1, I2>, HttpStage>
impl<T, I1, I2> EasyHttpWebClientBuilder<HttpConnector<T, I1, I2>, HttpStage>
Sourcepub fn with_advanced_jit_req_inspector<I>(
self,
http_req_inspector: I,
) -> EasyHttpWebClientBuilder<HttpConnector<T, I, I2>, HttpStage>
pub fn with_advanced_jit_req_inspector<I>( self, http_req_inspector: I, ) -> EasyHttpWebClientBuilder<HttpConnector<T, I, I2>, HttpStage>
Add a http request inspector that will run just after the inner http connector has connected but before the http handshake happens
This function doesn’t add any default request inspectors
Sourcepub fn without_jit_req_inspector(
self,
) -> EasyHttpWebClientBuilder<HttpConnector<T, (), I2>, HttpStage>
pub fn without_jit_req_inspector( self, ) -> EasyHttpWebClientBuilder<HttpConnector<T, (), I2>, HttpStage>
Removes the currently configured request inspector(s)
By default most methods add some request inspectors, this can be used to remove them
Sourcepub fn with_jit_req_inspector<I>(
self,
http_req_inspector: I,
) -> EasyHttpWebClientBuilder<HttpConnector<T, (HttpsAlpnModifier, HttpVersionAdapter, I), I2>, HttpStage>
pub fn with_jit_req_inspector<I>( self, http_req_inspector: I, ) -> EasyHttpWebClientBuilder<HttpConnector<T, (HttpsAlpnModifier, HttpVersionAdapter, I), I2>, HttpStage>
Add a http request inspector that will run just after the inner http connector has connected but before the http handshake happens
This will also add the HttpsAlpnModifier
request inspector as that one is
crucial to make tls alpn work and set the correct TargetHttpVersion
And a HttpVersionAdapter
that will adapt the request version to the configured
TargetHttpVersion
If you don’t want any of these inspector you can use Self::with_advanced_jit_req_inspector
to configure your own request inspectors without any defaults
Sourcepub fn with_svc_req_inspector<I>(
self,
http_req_inspector: I,
) -> EasyHttpWebClientBuilder<HttpConnector<T, I1, I>, HttpStage>
pub fn with_svc_req_inspector<I>( self, http_req_inspector: I, ) -> EasyHttpWebClientBuilder<HttpConnector<T, I1, I>, HttpStage>
Add a http request inspector that will run just before doing the actual http request
Source§impl<T> EasyHttpWebClientBuilder<T, HttpStage>
impl<T> EasyHttpWebClientBuilder<T, HttpStage>
Sourcepub fn with_connection_pool<C>(
self,
config: HttpPooledConnectorConfig,
) -> Result<EasyHttpWebClientBuilder<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>, PoolStage>, OpaqueError>
pub fn with_connection_pool<C>( self, config: HttpPooledConnectorConfig, ) -> Result<EasyHttpWebClientBuilder<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>, PoolStage>, OpaqueError>
Use the default connection pool for this super::EasyHttpWebClient
This will create a LruDropPool
using the provided limits
and will use BasicHttpConnIdentifier
to group connection on protocol
and authority, which should cover most common use cases
Use wait_for_pool_timeout
to limit how long we wait for the pool to give us a connection
If you need a different pool or custom way to group connection you can
use EasyHttpWebClientBuilder::with_custom_connection_pool()
to provide
you own.
Sourcepub fn with_custom_connection_pool<P, R>(
self,
pool: P,
req_to_conn_id: R,
wait_for_pool_timeout: Option<Duration>,
) -> EasyHttpWebClientBuilder<PooledConnector<T, P, R>, PoolStage>
pub fn with_custom_connection_pool<P, R>( self, pool: P, req_to_conn_id: R, wait_for_pool_timeout: Option<Duration>, ) -> EasyHttpWebClientBuilder<PooledConnector<T, P, R>, PoolStage>
Configure this client to use the provided Pool
and ReqToConnId
Use wait_for_pool_timeout
to limit how long we wait for the pool to give us a connection
Source§impl<T, S> EasyHttpWebClientBuilder<T, S>
impl<T, S> EasyHttpWebClientBuilder<T, S>
Sourcepub fn build<Body, ModifiedBody, ConnResponse>(
self,
) -> EasyHttpWebClient<Body, T::Response>
pub fn build<Body, ModifiedBody, ConnResponse>( self, ) -> EasyHttpWebClient<Body, T::Response>
Build a super::EasyHttpWebClient
using the provided config
Trait Implementations§
Auto Trait Implementations§
impl<C, S> Freeze for EasyHttpWebClientBuilder<C, S>where
C: Freeze,
impl<C, S> RefUnwindSafe for EasyHttpWebClientBuilder<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for EasyHttpWebClientBuilder<C, S>
impl<C, S> Sync for EasyHttpWebClientBuilder<C, S>
impl<C, S> Unpin for EasyHttpWebClientBuilder<C, S>
impl<C, S> UnwindSafe for EasyHttpWebClientBuilder<C, S>where
C: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more