Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Perl の HTTP/2 事情 / HTTP2 in Perl

zoncoen
December 09, 2015

Perl の HTTP/2 事情 / HTTP2 in Perl

Gotanda.pm #4 http://gotanda-pm.connpass.com/event/11993/ の発表資料です

zoncoen

December 09, 2015
Tweet

More Decks by zoncoen

Other Decks in Programming

Transcript

  1. HTTP/2 • HTTP/2 Approved | IETF Blog • ΋͏͙͢ RFC

    ͕ൃߦ͞ΕΔ • ͢Ͱʹ30Ҏ্ͷ࣮૷͕͋Δ • Implementations · http2/http2-spec Wiki
  2. Protocol::HTTP2 # Prepare http/2 request $client->request( ':scheme' => "http", ':authority'

    => $host . ":" . $port, ':path' => "/hello", ':method' => "GET", headers => [ 'accept' => '*/*', 'user-agent' => 'perl-Protocol-HTTP2/0.01', ], on_done => sub { my ( $headers, $data ) = @_; printf "Get headers. Count: %i\n", scalar(@$headers) / 2; printf "Get data. Length: %i\n", length($data); print $data; }, ); • Connect ͸ AnyEvent Ͱΰχϣΰχϣ΍Δ
  3. Protocol::HTTP2 • request -> request ͰฒྻϦΫΤετ $client->request( ':scheme' => "http",

    ':authority' => $host . ":" . $port, ':path' => "/minil.toml", ':method' => "GET", headers => [ 'accept' => '*/*', 'user-agent' => 'perl-Protocol-HTTP2/0.01', ], on_done => sub { my ( $headers, $data ) = @_; printf "Get headers. Count: %i\n", scalar(@$headers) / 2; printf "Get data. Length: %i\n", length($data); print $data; }, )->request( … );