pub struct HttpConn { /* private fields */ }Expand description
A connected HTTP/1.1 client connection. Hand it to a Driver; the socket
closes when it is dropped.
Implementations§
Source§impl HttpConn
impl HttpConn
Sourcepub fn request(
&mut self,
method: &str,
path: &str,
headers: &[(&str, &str)],
body: &[u8],
) -> Result<u64>
pub fn request( &mut self, method: &str, path: &str, headers: &[(&str, &str)], body: &[u8], ) -> Result<u64>
Queues a request for the driver’s next poll or flush and returns its
id. headers come after the connection’s fixed headers;
Content-Length is added when there is a body or the method is POST,
PUT or PATCH.
§Errors
Error::Busy when max_in_flight requests are outstanding, or the
request is larger than MAX_REQUEST or contains CR/LF in a field.
Sourcepub fn signed_request(
&mut self,
method: &str,
path: &str,
params: &str,
headers: &[(&str, &str)],
signer: &Signer,
) -> Result<u64>
pub fn signed_request( &mut self, method: &str, path: &str, params: &str, headers: &[(&str, &str)], signer: &Signer, ) -> Result<u64>
Queues a signed request: params (already percent-encoded), then
timestamp=<now, ms> and a signature over exactly those bytes, in
the query string. The signature is computed into the TLS record being
built, without allocating. Set the API key header once with
Target::with_header.
§Errors
As HttpConn::request, or params needs percent-encoding.
Sourcepub fn signed_request_at(
&mut self,
method: &str,
path: &str,
params: &str,
headers: &[(&str, &str)],
signer: &Signer,
timestamp_ms: u64,
) -> Result<u64>
pub fn signed_request_at( &mut self, method: &str, path: &str, params: &str, headers: &[(&str, &str)], signer: &Signer, timestamp_ms: u64, ) -> Result<u64>
HttpConn::signed_request with an explicit timestamp (tests, replay).
§Errors
Sourcepub fn raw_fd(&self) -> RawFd
pub fn raw_fd(&self) -> RawFd
The socket’s descriptor, for socket options and diagnostics. Do not read from or write to it: the driver owns the byte stream.
Sourcepub fn route(&self) -> &RouteCheck
pub fn route(&self) -> &RouteCheck
What the quick-ACK route check found for this connection
(crate::route::RouteCheck::Pending while ergon-io’s warning
thread is still looking it up).