HTTP/2 protocol implementation (RFC 7540)
Perl
Latest commit c953a91 Sep 27, 2016 @vlet Checking in changes prior to tagging of version 1.08.
Changelog diff is:

diff --git a/Changes b/Changes
index f86a25b..8b47648 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,14 @@ Revision history for Perl extension Protocol-HTTP2

 {{$NEXT}}

+1.08 2016-09-27T12:57:26Z
+    - implemented on_error callback for request
+    - fixed bug: incorrect handling of negative window size (thanks to Daniil
+      Bondarev for patch #2)
+    - fixed bug: last chunk of blocked data can be sent several times
+    - size of flow control window updated with current value of
+      SETTINGS_INITIAL_WINDOW_SIZE
+
 1.07 2016-03-03T20:44:19Z
     - implemented ping() method for client and server
     - implemented trailer headers support

README.md

NAME

Protocol::HTTP2 - HTTP/2 protocol implementation (RFC 7540)

SYNOPSIS

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

DESCRIPTION

Protocol::HTTP2 is HTTP/2 protocol implementation (RFC 7540) with stateful decoders/encoders of HTTP/2 frames. You may use this module to implement your own HTTP/2 client/server/intermediate on top of your favorite event loop over plain or tls socket (see examples).

STATUS

Current status - beta. Structures, module names and methods seems like stable. I've started this project to understand internals of HTTP/2 and may be it will never become production, but at least it works.

| Spec                    |      status     |
| ----------------------- | --------------- |
| Negotiation             |   ALPN, NPN,    |
|                         | Upgrade, direct |
| Preface                 |        +        |
| Headers (de)compression |        +        |
| Stream states           |        +        |
| Flow control            |        ±        |
| Stream priority         |        ±        |
| Server push             |        +        |
| Connect method          |        -        |


| Frame           | encoder | decoder |
| --------------- |:-------:|:-------:|
| DATA            |    ±    |    +    |
| HEADERS         |    +    |    +    |
| PRIORITY        |    +    |    +    |
| RST_STREAM      |    +    |    +    |
| SETTINGS        |    +    |    +    |
| PUSH_PROMISE    |    +    |    +    |
| PING            |    +    |    +    |
| GOAWAY          |    +    |    +    |
| WINDOW_UPDATE   |    +    |    +    |
| CONTINUATION    |    ±    |    +    |
  • - -- not implemeted
  • ± -- incomplete
  • + -- implemented (may even work)

MODULES

Protocol::HTTP2::Client

Client protocol decoder/encoder with constructor of requests

Protocol::HTTP2::Server

Server protocol decoder/encoder with constructor of responses/pushes

Protocol::HTTP2::Connection

Main low level module for protocol logic and state processing. 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)

Protocol::HTTP2::HeaderCompression

Module implements HPACK - Header Compression for HTTP/2 (RFC 7541). https://tools.ietf.org/html/rfc7541

Protocol::HTTP2::Constants

Module contains all defined in HTTP/2 protocol constants and default values

Protocol::HTTP2::Trace

Module for debugging. You can setup HTTP2_DEBUG environment variable to change verbosity of the module (output to STDOUT). Default level is error.

$ export HTTP2_DEBUG=debug
$ perl ./http2_program

SEE ALSO

https://github.com/vlet/p5-Protocol-HTTP2/wiki - Protocol::HTTP2 wiki

http://http2.github.io/ - official HTTP/2 specification site

http://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.

AUTHOR

Vladimir Lettiev thecrux@gmail.com