NAME

Linux::Event::HTTP::Server::Connection - low-level HTTP/1 server connection

DESCRIPTION

Linux::Event::HTTP::Server::Connection is the advanced HTTP/1 connection executor used by Linux::Event::HTTP::Server.

Most applications use Server callbacks and do not interact with this class directly.

The connection owns HTTP/1 request sequencing, persistence, response serialization, and mapping between HTTP body production and Linux::Event transport backpressure.

Linux::Event still owns the socket, TLS transport, readiness, and native output queue.

TRANSACTION

transaction returns the active Linux::Event::HTTP::Transaction or undef while idle.

During on_request, on_body, and on_request_end, it is the Transaction containing the callback's Request and Response.

Retain the Transaction if work will finish later:

my $tx = $conn->transaction;

RESPONSE BODIES

Complete scalar response:

$res->body("hello\n");

Streaming response:

my $body = $conn->transaction->response_body(
    on_drain  => sub ($body) { ... },
    on_cancel => sub ($body) { ... },
);

$body->write($bytes);
$body->complete;

A delayed scalar Response is sent explicitly with:

$tx->send_response;

REQUEST BODIES

on_request runs after the validated request head.

on_body receives decoded body chunks.

on_request_end runs at the complete request-body boundary.

If on_body is absent, body bytes are drained rather than accumulated.

SUBCLASSING

Server::Connection is the public HTTP/1 connection subclass point.

Customize request handling through on_request, on_body, and on_request_end. Customize transport policy through the documented Linux::Event tuning and lifecycle hooks.

on_data is protocol-owned and is not a subclass extension point.

High-level HTTP/2 currently requires the default connection class; a custom Server::Connection subclass remains an HTTP/1 customization.

SEE ALSO

Linux::Event::HTTP::Server, Linux::Event::HTTP::Transaction, Linux::Event::HTTP::Body::Stream.