Protocol::HTTP2(3pm)
π NAME π
Protocol::HTTP2 β HTTP/2 protocol implementation (RFC 7540). That's it, that's the whole vibe, she does HTTP/2 and she does it in Perl π¦
β¨ SYNOPSIS β¨
okay so first you gotta pull her in:
use Protocol::HTTP2;
# get protocol identification string for secure connections
print Protocol::HTTP2::ident_tls; # h2
# get protocol identification string for non-secure connections
print Protocol::HTTP2::ident_plain; # h2c
literally that's the whole hello-world bestie π
πΈ DESCRIPTION πΈ
Protocol::HTTP2 is an HTTP/2 protocol implementation (RFC 7540, that's https://tools.ietf.org/html/rfc7540 if you wanna read the lore) with stateful decoders/encoders of HTTP/2 frames. No cap.
So like β you can use this module to build your very own HTTP/2 client, server, or intermediate on top of whatever event loop is your current hyperfixation, over a plain socket or a tls socket (go peep the examples, they're right there).
π STATUS π
Current status: beta. The structures, module names and methods are like... seemingly stable? That's the tea.
Real talk from the author: he started this project to understand the internals of HTTP/2, and maybe it will never become production, but at least it works. π«Ά
Here's the spec vibe check, frame by frame:
Spec support, bestie:
- Negotiation β
ALPN,NPN,Upgrade,direct - Preface β
+ - Headers (de)compression β
+ - Stream states β
+ - Flow control β
Β± - Stream priority β
Β± - Server push β
+ - Connect method β
-
Frames, encoder vs decoder:
DATAβ encoderΒ±, decoder+HEADERSβ encoder+, decoder+PRIORITYβ encoder+, decoder+RST_STREAMβ encoder+, decoder+SETTINGSβ encoder+, decoder+PUSH_PROMISEβ encoder+, decoder+PINGβ encoder+, decoder+GOAWAYβ encoder+, decoder+WINDOW_UPDATEβ encoder+, decoder+CONTINUATIONβ encoderΒ±, decoder+
And the legend, so you know what the symbols are saying:
-β not implementedΒ±β incomplete+β implemented (may even work) π
π§ MODULES π§
Protocol::HTTP2::Client
Client protocol decoder/encoder, and she comes with a constructor of requests. main character energy β¨
Protocol::HTTP2::Server
Server protocol decoder/encoder, with a constructor of responses and pushes. the other main character π
Protocol::HTTP2::Connection
The main low level module for protocol logic and state processing. The Connection object is a mixin of Protocol::HTTP2::Frame (frame encoding/decoding), Protocol::HTTP2::Stream (stream operations) and Protocol::HTTP2::Upgrade (HTTP/1.1 Upgrade support). It's giving "everything bagel" and we're obsessed π₯―
Protocol::HTTP2::HeaderCompression
This module implements HPACK β Header Compression for HTTP/2 (RFC 7541, aka https://tools.ietf.org/html/rfc7541). Squish those headers, queen π
Protocol::HTTP2::Constants
Contains every constant defined in the HTTP/2 protocol plus the default values. One-stop shop, no cap.
Protocol::HTTP2::Trace
The debugging module π You can set the HTTP2_DEBUG environment variable to change the verbosity of the module (output goes to STDOUT). Default level is error.
$ export HTTP2_DEBUG=debug
$ perl ./http2_program
π SEE ALSO π
https://github.com/vlet/p5-Protocol-HTTP2/wikiβ the Protocol::HTTP2 wikihttp://http2.github.io/β official HTTP/2 specification sitehttp://daniel.haxx.se/http2/β http2 explained
π LICENSE π
Copyright (C) Vladimir Lettiev.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay π
β AUTHOR β
Vladimir Lettiev <thecrux@gmail.com>
okay bestie that's the whole page, hope it ate π
perl v5.42.3 Β· 2026-09-04 Β· Protocol::HTTP2(3pm) β that's the footer energy, mwah, go write some frames π β¨
π¦ where this page comes from
- fedora 43: perl-Protocol-HTTP2 1.14-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Protocol-HTTP2 1.14-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms