pub struct EasyHttpWebClientBuilder<C = (), S = ()> { /* private fields */ }http and http-full only.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<T, Stage> EasyHttpWebClientBuilder<T, Stage>
impl<T, Stage> EasyHttpWebClientBuilder<T, Stage>
Sourcepub fn with_custom_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, Stage>where
L: Layer<T>,
pub fn with_custom_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, Stage>where
L: Layer<T>,
Add a custom connector to this Stage.
Adding a custom connector to a stage will not change the state so this can be used to modify behaviour at a specific stage.
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>,
Available on crate features rustls or boring only.
pub fn with_custom_tls_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, ProxyTunnelStage>where
L: Layer<T>,
rustls or boring only.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>
Available on crate feature boring only.
pub fn with_tls_proxy_support_using_boringssl( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
boring only.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>
Available on crate feature boring only.
pub fn with_tls_proxy_support_using_boringssl_config( self, config: Arc<TlsConnectorDataBuilder>, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
boring only.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>
Available on crate feature rustls only.
pub fn with_tls_proxy_support_using_rustls( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
rustls only.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>
Available on crate feature rustls only.
pub fn with_tls_proxy_support_using_rustls_config( self, config: TlsConnectorData, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
rustls only.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>
Available on crate feature socks5 only.
pub fn with_proxy_support( self, ) -> EasyHttpWebClientBuilder<ProxyConnector<Arc<T>>, ProxyStage>
socks5 only.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>
Available on crate feature socks5 only.
pub fn with_socks5_proxy_support( self, ) -> EasyHttpWebClientBuilder<Socks5ProxyConnector<T>, ProxyStage>
socks5 only.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<L::Service, TlsStage>where
L: Layer<T>,
Available on crate features rustls or boring only.
pub fn with_custom_tls_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, TlsStage>where
L: Layer<T>,
rustls or boring only.Add a custom tls connector that will be used by the client
Note: when using a tls_connector you probably want to also
add a RequestVersionAdapter which applies the negotiated
http version from tls alpn. This can be achieved by using
Self::with_custom_connector just after adding the tls connector.
Sourcepub fn with_tls_support_using_boringssl(
self,
config: Option<Arc<TlsConnectorDataBuilder>>,
) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
Available on crate feature boring only.
pub fn with_tls_support_using_boringssl( self, config: Option<Arc<TlsConnectorDataBuilder>>, ) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
boring only.Support https connections by using boringssl for tls
Note: this also adds a RequestVersionAdapter to automatically change the
request version to the one configured with tls alpn. If this is not
wanted, use Self::with_custom_tls_connector instead.
Sourcepub fn with_tls_support_using_rustls(
self,
config: Option<TlsConnectorData>,
) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
Available on crate feature rustls only.
pub fn with_tls_support_using_rustls( self, config: Option<TlsConnectorData>, ) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
rustls only.Support https connections by using ruslts for tls
Note: this also adds a RequestVersionAdapter to automatically change the
request version to the one configured with tls alpn. If this is not
wanted, use Self::with_custom_tls_connector instead.
Sourcepub fn without_tls_support(self) -> EasyHttpWebClientBuilder<T, TlsStage>
pub fn without_tls_support(self) -> EasyHttpWebClientBuilder<T, TlsStage>
Dont support https on this connector
Source§impl<T> EasyHttpWebClientBuilder<T, TlsStage>
impl<T> EasyHttpWebClientBuilder<T, TlsStage>
Sourcepub fn with_default_http_connector(
self,
) -> EasyHttpWebClientBuilder<HttpConnector<T>, HttpStage>
pub fn with_default_http_connector( self, ) -> EasyHttpWebClientBuilder<HttpConnector<T>, HttpStage>
Add http support to this connector
Sourcepub fn with_custom_http_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, HttpStage>where
L: Layer<T>,
pub fn with_custom_http_connector<L>(
self,
connector_layer: L,
) -> EasyHttpWebClientBuilder<L::Service, HttpStage>where
L: Layer<T>,
Add a custom http connector that will be run just after tls
Source§impl<T, I> EasyHttpWebClientBuilder<HttpConnector<T, I>, HttpStage>
impl<T, I> EasyHttpWebClientBuilder<HttpConnector<T, I>, HttpStage>
Sourcepub fn with_svc_req_inspector<U>(
self,
http_req_inspector: U,
) -> EasyHttpWebClientBuilder<HttpConnector<T, U>, HttpStage>
pub fn with_svc_req_inspector<U>( self, http_req_inspector: U, ) -> EasyHttpWebClientBuilder<HttpConnector<T, U>, 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>where
Body: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
ModifiedBody: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
T: Service<Request<Body>, Response = EstablishedClientConnection<ConnResponse, Request<ModifiedBody>>, Error = BoxError>,
ConnResponse: ExtensionsMut,
pub fn build<Body, ModifiedBody, ConnResponse>(
self,
) -> EasyHttpWebClient<Body, T::Response>where
Body: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
ModifiedBody: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
T: Service<Request<Body>, Response = EstablishedClientConnection<ConnResponse, Request<ModifiedBody>>, Error = BoxError>,
ConnResponse: ExtensionsMut,
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