Net::HTTP2::Client::Connection - Base class for individual HTTP/2 client connection
See:
Net::HTTP2::Client::Connection::Mojo
Net::HTTP2::Client::Connection::IOAsync
Net::HTTP2::Client::Connection::AnyEvent
This implements a non-blocking, non-redirecting HTTP/2 client. It’s a base class; the actual class you’ll use will depend on your event loop interface (see "SYNOPSIS").
If you want a full-featured client (that honors redirections), see Net::HTT2::Client.
TCP connections are kept open as long as instances of this class live.
This class’s design would facilitate HTTP redirects only in the case where the target of the redirect is the same server that answers the initial request. (e.g., we could honor Location: https://same.server/some/other/path or Location: /some/other/path, but not Location: https://some.other.server/foo.)
Location: https://same.server/some/other/path
Location: /some/other/path
Location: https://some.other.server/foo
To avoid that inconsistency, this class purposely omits HTTP redirection. See Net::HTTP2::UserAgent for an interface that implements redirection.
Instantiates CLASS.
%OPTS will depend on the CLASS, but can always include:
port - The TCP port to connect to. Defaults to 443.
port
tls_verify - Either peer (default) or none.
tls_verify
peer
none
Sends an HTTP/2 request.
Returns a promise (an instance of <Promise::ES6>, unless otherwise noted in the subclass) that resolves to a Net::HTTP2::Response instance.
%OPTS can be:
headers - Request headers, as in HTTP::Tiny’s request().
headers
request()
content - Request content, as in HTTP::Tiny’s request().
content
on_data - A code reference that fires as each chunk of the HTTP response arrives. The code reference always receives a Net::HTTP2::PartialResponse instance.
on_data
On failure (NOT including valid HTTP responses!), the promise rejects with an instance of an appropriate Net::HTTP2::X::Base class, e.g., Net::HTTP2::X::HTTP2.
To install Net::HTTP2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::HTTP2
CPAN shell
perl -MCPAN -e shell install Net::HTTP2
For more information on module installation, please visit the detailed CPAN module installation guide.