kvarn

Function handle_connection

source
pub async fn handle_connection(
    stream: Incoming,
    address: SocketAddr,
    descriptor: Arc<PortDescriptor>,
    continue_accepting: impl FnMut() -> bool,
) -> Result<()>
Expand description

Handles a single connection. This includes encrypting it, extracting the HTTP header information, optionally (HTTP/2 & HTTP/3) decompressing them, and passing the request to handle_cache(). It will also recognize which host should handle the connection.

Here, both layer 2 and layer 3 are handled.

ยงErrors

Will pass any errors from reading the request, making a TLS handshake, and writing the response. See handle_cache() and handle_request(); errors from them are passed up, through this fn.