EasyHttpWebClientBuilder

Struct EasyHttpWebClientBuilder 

Source
pub struct EasyHttpWebClientBuilder<C = (), S = ()> { /* private fields */ }
Available on crate features 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

Source

pub fn new() -> Self

Source

pub fn with_default_transport_connector( self, ) -> EasyHttpWebClientBuilder<TcpConnector, TransportStage>

Source

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>

Source

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>

Source

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>

Source

pub 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.

Add a custom proxy tls connector that will be used to setup a tls connection to the proxy

Source

pub fn with_tls_proxy_support_using_boringssl( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature 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

Source

pub fn with_tls_proxy_support_using_boringssl_config( self, config: Arc<TlsConnectorDataBuilder>, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature 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

Source

pub fn with_tls_proxy_support_using_rustls( self, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature 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

Source

pub fn with_tls_proxy_support_using_rustls_config( self, config: TlsConnectorData, ) -> EasyHttpWebClientBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature 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

Source

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>

Source

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

Source

pub fn with_proxy_support( self, ) -> EasyHttpWebClientBuilder<ProxyConnector<Arc<T>>, ProxyStage>

Available on crate feature 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

Source

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

Source

pub fn with_socks5_proxy_support( self, ) -> EasyHttpWebClientBuilder<Socks5ProxyConnector<T>, ProxyStage>

Available on crate feature socks5 only.

Add support for usage of a socks5(h) ProxyAddress to this client

Source

pub fn without_proxy_support(self) -> EasyHttpWebClientBuilder<T, ProxyStage>

Make a client without proxy support

Source§

impl<T> EasyHttpWebClientBuilder<T, ProxyStage>

Source

pub 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.

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.

Source

pub fn with_tls_support_using_boringssl( self, config: Option<Arc<TlsConnectorDataBuilder>>, ) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature 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.

Source

pub fn with_tls_support_using_rustls( self, config: Option<TlsConnectorData>, ) -> EasyHttpWebClientBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature 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.

Source

pub fn without_tls_support(self) -> EasyHttpWebClientBuilder<T, TlsStage>

Dont support https on this connector

Source§

impl<T> EasyHttpWebClientBuilder<T, TlsStage>

Source

pub fn with_default_http_connector( self, ) -> EasyHttpWebClientBuilder<HttpConnector<T>, HttpStage>

Add http support to this connector

Source

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>

Source

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>

Source

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.

Source

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>

Source

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§

Source§

impl<C: Default, S: Default> Default for EasyHttpWebClientBuilder<C, S>

Source§

fn default() -> EasyHttpWebClientBuilder<C, S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C, S> Freeze for EasyHttpWebClientBuilder<C, S>
where C: Freeze,

§

impl<C, S> RefUnwindSafe for EasyHttpWebClientBuilder<C, S>

§

impl<C, S> Send for EasyHttpWebClientBuilder<C, S>
where C: Send, S: Send,

§

impl<C, S> Sync for EasyHttpWebClientBuilder<C, S>
where C: Sync, S: Sync,

§

impl<C, S> Unpin for EasyHttpWebClientBuilder<C, S>
where C: Unpin, S: Unpin,

§

impl<C, S> UnwindSafe for EasyHttpWebClientBuilder<C, S>
where C: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<T, U> RamaFrom<T> for U
where U: From<T>,

§

fn rama_from(value: T) -> U

§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

§

fn rama_into(self) -> U

§

impl<T, U> RamaTryFrom<T> for U
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more