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

Perl の HTTP/2 事情 / HTTP2 in Perl

Bca2e4847cad171859e093aaf88a6c22?s=47 zoncoen
December 09, 2015

Perl の HTTP/2 事情 / HTTP2 in Perl

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

Bca2e4847cad171859e093aaf88a6c22?s=128

zoncoen

December 09, 2015
Tweet

More Decks by zoncoen

Other Decks in Programming

Transcript

  1. Perl ͷ HTTP/2 ࣄ৘ Kenta Mori (@zoncoen)

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

    ͕ൃߦ͞ΕΔ • ͢Ͱʹ30Ҏ্ͷ࣮૷͕͋Δ • Implementations · http2/http2-spec Wiki
  3. HTTP/2 for Perl • http2-perl • draft-04 • Protocol::HTTP2 •

    draft-17
  4. 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 Ͱΰχϣΰχϣ΍Δ
  5. 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( … );
  6. Demo with nghttp2

  7. ॴײ • ҰԠಈ͘ • ༏ઌ੍ޚͱ͔͕·ͩඍົͬΆ͍ • HPACK ͷ࣮૷͕… • Perl

    ͰඇಉظϓϩάϥϛϯάͭΒͦ͏
  8. ༨ஊ • 2/26 ʹ gRPC ͕ެ։͞Εͨ • RPC on HTTP/2

    • ֤ݴޠ༻ͷϥΠϒϥϦ΋ެ։
  9. None
  10. None
  11. None