pub struct HttpPeer { /* private fields */ }
Implementations§
Source§impl HttpPeer
impl HttpPeer
Sourcepub fn new(address: SocketAddr, request_host: &str) -> Self
pub fn new(address: SocketAddr, request_host: &str) -> Self
Create a new HttpPeer
with the given address and request host.
Sourcepub fn forward_for(self, forward_for: ForwardedFor) -> Self
pub fn forward_for(self, forward_for: ForwardedFor) -> Self
Set the Forwarded-For
or X-Forwarded-*
headers to the given value.
Sourcepub fn sni_host(self, sni_host: String) -> Self
pub fn sni_host(self, sni_host: String) -> Self
Set the SNI host to the given value. This is the host that will be used for the TLS handshake.
Sourcepub fn request_host(self, request_host: String) -> Self
pub fn request_host(self, request_host: String) -> Self
Set the Host
header to the given value. This is the host that will be used for the HTTP request.
Sourcepub fn via(self, via: &str, in_request: bool, in_response: bool) -> Self
pub fn via(self, via: &str, in_request: bool, in_response: bool) -> Self
Set the Via
header to the given value. This header can be added to the request fowarded to the peer and/or to the response returned to the client.
Sourcepub fn allow_invalid_certificates(
self,
allow_invalid_certificates: bool,
) -> Self
pub fn allow_invalid_certificates( self, allow_invalid_certificates: bool, ) -> Self
Set whether invalid certificates should be allowed.
Sourcepub fn supported_encodings(self, supported_encodings: HashSet<String>) -> Self
pub fn supported_encodings(self, supported_encodings: HashSet<String>) -> Self
A set of supported encodings that this server can handle, this may be useful if you need to update the response body and you cannot handle some encodings.
Sourcepub fn force_close(self, force_close: bool) -> Self
pub fn force_close(self, force_close: bool) -> Self
Set whether the connection should be closed after the request has been forwarded to the peer.
Sourcepub fn tls(self, tls: bool) -> Self
pub fn tls(self, tls: bool) -> Self
Set whether the connection should be encrypted using TLS when connecting to the peer.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the timeout for the request to the peer. If the timeout is reached, the request will be aborted and an error will be returned to the client.
Sourcepub fn request_body_size_limit(self, request_body_size_limit: usize) -> Self
pub fn request_body_size_limit(self, request_body_size_limit: usize) -> Self
Set the maximum size of the request body that can be stored in memory.
This limit should not be used in most cases as the request body is streamed and not stored in memory. However, there is some cases where the request body needs to be stored in memory, think of an old client sending HTTP/1.0 requests with a body. In this case the body will be stored in memory before being forwarded to the peer.
This limit prevents the server from storing too much data in memory. The default value is 16MB.
Trait Implementations§
impl Eq for HttpPeer
impl StructuralPartialEq for HttpPeer
Auto Trait Implementations§
impl Freeze for HttpPeer
impl RefUnwindSafe for HttpPeer
impl Send for HttpPeer
impl Sync for HttpPeer
impl Unpin for HttpPeer
impl UnwindSafe for HttpPeer
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.