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 🌈


πŸŽ€ 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