NAME
Unblock::HTTP2::Server - one HTTP/2 server connection
SYNOPSIS
use Uniform::HTTP::Response;
use Unblock::HTTP2::Server;
my $server = Unblock::HTTP2::Server->new(
on_request => sub {
my ($transaction, $request) = @_;
$transaction->respond(
Uniform::HTTP::Response->new(
status => 200,
body => "hello\n",
),
);
},
);
DESCRIPTION
A Server owns one HTTP/2 server session.
It does not create a listening socket, own an accepted socket, perform TLS, or run an event loop.
Feed received HTTP/2 bytes to input(). Drain generated bytes from output() while want_write() is true.
CONSTRUCTOR
new() accepts an initial settings hash, max_concurrent_streams, max_header_list_size, and enable_connect_protocol.
Connection callbacks include on_settings, on_settings_ack, on_ping, on_ping_ack, on_priority, and on_invalid_frame.
REQUEST CALLBACKS
on_request runs when the request headers have been accepted.
on_body receives body chunks.
on_request_end runs after the complete request and any trailers have arrived.
The callback receives an Unblock::HTTP2::Transaction. Use inform() for informational responses and respond() for the final response.
CONNECTION CONTROL
The Server exposes the common connection methods:
is_closed
close_reason
transaction_count
transaction_for_stream_id
local_settings
local_setting
peer_settings
peer_setting
update_settings
settings_pending
ping
draining
drain
goaway
local_goaway
peer_goaway
want_read
want_write
input
output
close
The server can also observe RFC 9218 priority updates with on_priority.
SEE ALSO
Unblock::HTTP2, Unblock::HTTP2::Transaction, Uniform::HTTP::Response
LICENSE
MIT License.