pub struct HttpConnection<T> { /* private fields */ }
Expand description

A wrapper over a HTTP Connection.

Implementations

Creates an empty connection.

This function sets the limit for PUT/PATCH requests. It overwrites the default limit of 0.05MiB with the one allowed by server.

Tries to read new bytes from the stream and automatically update the request. Meant to be used only with non-blocking streams and an EPOLL structure. Should be called whenever an EPOLLIN event is signaled.

Errors

StreamError is returned when an IO operation fails. ConnectionClosed is returned when a client prematurely closes the connection. ParseError is returned when a parsing operation fails.

Tries to write the first available response to the provided stream. Meant to be used only with non-blocking streams and an EPOLL structure. Should be called whenever an EPOLLOUT event is signaled. If no bytes were written to the stream or error occurred while trying to write to stream, we will discard all responses from response_queue because there is no way to deliver it to client.

Errors

StreamError is returned when an IO operation fails. ConnectionClosed is returned when trying to write on a closed connection. InvalidWrite is returned when trying to write on a connection with an empty outgoing buffer.

Discards all pending writes from the connection.

Send a response back to the source of a request.

Returns the first parsed request in the queue or None if the queue is empty.

Returns if parsed_requests is not empty

Returns true if there are bytes waiting to be written into the stream.

Trait Implementations

Extracts the raw file descriptor. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.