NAME

Unblock::HTTP3::Server - one server HTTP/3 connection

SYNOPSIS

use Uniform::HTTP::Response;
use Unblock::HTTP3::Server;

my $server = Unblock::HTTP3::Server->new(
    quic => $quic,

    on_request => sub {
        my ($transaction, $request) = @_;

        $transaction->respond(
            Uniform::HTTP::Response->new(
                status => 200,
                body   => "hello\n",
            ),
        );
    },
);

$server->start;

DESCRIPTION

A Server owns HTTP/3 protocol state for one existing Net::QUIC connection.

It does not own a listening socket, UDP socket, TLS, timers, or an event loop.

The common request callbacks are:

on_request
on_body
on_request_end
on_error

on_request_end is a lifecycle callback. It does not change whether request bodies are buffered or streamed.

Use send_informational() for a 1xx response and respond() for the final response. Pass stream_body => 1 to respond() to produce the response body with write() and end().

The pull interface remains available through next_transaction().

SEE ALSO

Unblock::HTTP3, Unblock::HTTP3::Transaction, Uniform::HTTP::Response

LICENSE

MIT License.