| 1 |
package Protocol::HTTP2; |
| 2 |
use 5.008005; |
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
our $VERSION = "1.14"; |
| 7 |
|
| 8 |
sub ident_plain { |
| 9 |
'h2c'; |
| 10 |
} |
| 11 |
|
| 12 |
sub ident_tls { |
| 13 |
'h2'; |
| 14 |
} |
| 15 |
|
| 16 |
1; |
| 17 |
__END__ |
| 18 |
|
| 19 |
=encoding utf-8 |
| 20 |
|
| 21 |
=head1 NAME |
| 22 |
|
| 23 |
Protocol::HTTP2 - HTTP/2 protocol implementation (RFC 7540) |
| 24 |
|
| 25 |
=head1 SYNOPSIS |
| 26 |
|
| 27 |
use Protocol::HTTP2; |
| 28 |
|
| 29 |
# get protocol identification string for secure connections |
| 30 |
print Protocol::HTTP2::ident_tls; # h2 |
| 31 |
|
| 32 |
# get protocol identification string for non-secure connections |
| 33 |
print Protocol::HTTP2::ident_plain; # h2c |
| 34 |
|
| 35 |
=head1 DESCRIPTION |
| 36 |
|
| 37 |
Protocol::HTTP2 is HTTP/2 protocol implementation (L<RFC 7540|https://tools.ietf.org/html/rfc7540>) with stateful |
| 38 |
decoders/encoders of HTTP/2 frames. You may use this module to implement your |
| 39 |
own HTTP/2 client/server/intermediate on top of your favorite event loop over |
| 40 |
plain or tls socket (see examples). |
| 41 |
|
| 42 |
=head1 STATUS |
| 43 |
|
| 44 |
Current status - beta. Structures, module names and methods seems like stable. |
| 45 |
I've started this project to understand internals of HTTP/2 and may be it will |
| 46 |
never become production, but at least it works. |
| 47 |
|
| 48 |
| Spec | status | |
| 49 |
| ----------------------- | --------------- | |
| 50 |
| Negotiation | ALPN, NPN, | |
| 51 |
| | Upgrade, direct | |
| 52 |
| Preface | + | |
| 53 |
| Headers (de)compression | + | |
| 54 |
| Stream states | + | |
| 55 |
| Flow control | ± | |
| 56 |
| Stream priority | ± | |
| 57 |
| Server push | + | |
| 58 |
| Connect method | - | |
| 59 |
|
| 60 |
|
| 61 |
| Frame | encoder | decoder | |
| 62 |
| --------------- |:-------:|:-------:| |
| 63 |
| DATA | ± | + | |
| 64 |
| HEADERS | + | + | |
| 65 |
| PRIORITY | + | + | |
| 66 |
| RST_STREAM | + | + | |
| 67 |
| SETTINGS | + | + | |
| 68 |
| PUSH_PROMISE | + | + | |
| 69 |
| PING | + | + | |
| 70 |
| GOAWAY | + | + | |
| 71 |
| WINDOW_UPDATE | + | + | |
| 72 |
| CONTINUATION | ± | + | |
| 73 |
|
| 74 |
|
| 75 |
=over |
| 76 |
|
| 77 |
=item - -- not implemented |
| 78 |
|
| 79 |
=item ± -- incomplete |
| 80 |
|
| 81 |
=item + -- implemented (may even work) |
| 82 |
|
| 83 |
=back |
| 84 |
|
| 85 |
=head1 MODULES |
| 86 |
|
| 87 |
=head2 L<Protocol::HTTP2::Client> |
| 88 |
|
| 89 |
Client protocol decoder/encoder with constructor of requests |
| 90 |
|
| 91 |
=head2 L<Protocol::HTTP2::Server> |
| 92 |
|
| 93 |
Server protocol decoder/encoder with constructor of responses/pushes |
| 94 |
|
| 95 |
=head2 L<Protocol::HTTP2::Connection> |
| 96 |
|
| 97 |
Main low level module for protocol logic and state processing. Connection |
| 98 |
object is a mixin of L<Protocol::HTTP2::Frame> (frame encoding/decoding), |
| 99 |
L<Protocol::HTTP2::Stream> (stream operations) and L<Protocol::HTTP2::Upgrade> |
| 100 |
(HTTP/1.1 Upgrade support) |
| 101 |
|
| 102 |
=head2 L<Protocol::HTTP2::HeaderCompression> |
| 103 |
|
| 104 |
Module implements HPACK - Header Compression for HTTP/2 (L<RFC 7541|https://tools.ietf.org/html/rfc7541>). |
| 105 |
|
| 106 |
=head2 L<Protocol::HTTP2::Constants> |
| 107 |
|
| 108 |
Module contains all defined in HTTP/2 protocol constants and default values |
| 109 |
|
| 110 |
=head2 L<Protocol::HTTP2::Trace> |
| 111 |
|
| 112 |
Module for debugging. You can setup HTTP2_DEBUG environment variable to change |
| 113 |
verbosity of the module (output to STDOUT). Default level is error. |
| 114 |
|
| 115 |
$ export HTTP2_DEBUG=debug |
| 116 |
$ perl ./http2_program |
| 117 |
|
| 118 |
=head1 SEE ALSO |
| 119 |
|
| 120 |
L<https://github.com/vlet/p5-Protocol-HTTP2/wiki> - Protocol::HTTP2 wiki |
| 121 |
|
| 122 |
L<http://http2.github.io/> - official HTTP/2 specification site |
| 123 |
|
| 124 |
L<http://daniel.haxx.se/http2/> - http2 explained |
| 125 |
|
| 126 |
=head1 LICENSE |
| 127 |
|
| 128 |
Copyright (C) Vladimir Lettiev. |
| 129 |
|
| 130 |
This library is free software; you can redistribute it and/or modify |
| 131 |
it under the same terms as Perl itself. |
| 132 |
|
| 133 |
=head1 AUTHOR |
| 134 |
|
| 135 |
Vladimir Lettiev E<lt>[email protected]<gt> |
| 136 |
|
| 137 |
=cut |
| 138 |
|