NAME
Unblock::HTTP2 - non-blocking HTTP/2 protocol engine for Perl
SYNOPSIS
use Uniform::HTTP::Request;
use Unblock::HTTP2::Client;
my $client = Unblock::HTTP2::Client->new;
my $stream = $client->request(
Uniform::HTTP::Request->new(
method => 'GET',
target => '/',
scheme => 'https',
authority => 'example.com',
),
);
$client->input($bytes_from_transport);
while ($client->want_write) {
my $bytes = $client->output;
last unless length $bytes;
$transport->write($bytes);
}
DESCRIPTION
Unblock::HTTP2 is an HTTP/2 protocol engine.
It handles HTTP/2 framing, HPACK, multiplexed streams, SETTINGS, flow control, PING, GOAWAY, trailers, CONNECT, and RFC 9218 priority signaling.
It does not own sockets, TLS, ALPN, an event loop, connection pooling, or retry policy.
HTTP messages are Uniform::HTTP::Request and Uniform::HTTP::Response objects.
libnghttp2 is used through a small private XS binding contained in this distribution.
MODULES
- Unblock::HTTP2::Client
-
One client HTTP/2 connection.
- Unblock::HTTP2::Server
-
One server HTTP/2 connection.
- Unblock::HTTP2::Stream
-
One multiplexed request/response stream.
ERROR CODES
The standard HTTP/2 error codes are available as package constants, including NO_ERROR, PROTOCOL_ERROR, REFUSED_STREAM, and CANCEL.
error_name($code) returns the symbolic name for a known code.
TRANSPORT BOUNDARY
Feed received HTTP/2 bytes to input() and drain generated bytes from output() while want_write() is true.
The caller decides how those bytes reach the network.
SEE ALSO
LICENSE
MIT License.