Skip to main content

HttpConn

Struct HttpConn 

Source
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

Source

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.

Source

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.

Source

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

As HttpConn::signed_request.

Source

pub fn in_flight(&self) -> usize

Requests sent and not yet answered.

Source

pub const fn stats(&self) -> HttpStats

Counters.

Source

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.

Source

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

Auto Trait Implementations§

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
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> Endpoint for T
where T: Io,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<H, T> Receive<H> for T
where T: Deliver<H>, H: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.