NAME
Unblock::HTTP1::Client - Standalone HTTP/1 client protocol engine
DESCRIPTION
This object owns one HTTP/1 client connection's protocol state. It does not open a socket or run an event loop. Feed received bytes with input(), signal transport EOF with input_eof(), and drain generated wire bytes with output().
Requests are queued serially. This Client API intentionally does not pipeline requests on one connection. Callers that need parallel HTTP/1 work can use multiple connections without changing the protocol engine.
REQUEST CALLBACKS
request() accepts these callbacks:
on_informational => sub { my ($transaction, $response) = @_ }
on_response => sub { my ($transaction, $response) = @_ }
on_body => sub { my ($transaction, $response, $bytes) = @_ }
on_complete => sub { my ($transaction) = @_ }
on_error => sub { my ($transaction, $error) = @_ }
on_switch => sub { my ($transaction, $response) = @_ }
on_drain => sub { my ($transaction) = @_ }
on_drain is used with stream_body => 1.
When a 101 response or successful CONNECT switches away from HTTP, the engine stops HTTP parsing. take_remainder() returns bytes that followed the HTTP head in the same transport read.