pub struct PooledClient<'a> { /* private fields */ }Expand description
A pool-owned handle to an HttpClient.
Borrows the pool exclusively while alive; derefs to &mut HttpClient.
On drop, the guard inspects HttpClient::peer_will_close and
recycles its slot (closes the underlying connection and marks the
slot for lazy reconnect) when the peer has signalled close — avoiding
the request-smuggling-class hazard of sending a fresh request on a
connection the server is about to close.
Implementations§
Methods from Deref<Target = HttpClient>§
Sourcepub fn get(&mut self, path: &str) -> RequestBuilder<'_>
pub fn get(&mut self, path: &str) -> RequestBuilder<'_>
Build a GET request.
Sourcepub fn post(&mut self, path: &str) -> RequestBuilder<'_>
pub fn post(&mut self, path: &str) -> RequestBuilder<'_>
Build a POST request.
Sourcepub fn put(&mut self, path: &str) -> RequestBuilder<'_>
pub fn put(&mut self, path: &str) -> RequestBuilder<'_>
Build a PUT request.
Sourcepub fn delete(&mut self, path: &str) -> RequestBuilder<'_>
pub fn delete(&mut self, path: &str) -> RequestBuilder<'_>
Build a DELETE request.
Sourcepub fn peer_will_close(&self) -> bool
pub fn peer_will_close(&self) -> bool
Whether the peer has signalled the connection will close. For H1
this reflects Connection: close on the most recent response (or
the HTTP/1.0 default); for H2 this reflects a GOAWAY frame. The
Pool honours this automatically via the
guard returned by Pool::client.