Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Very beginning of HTTP2
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Akira Morikawa
July 06, 2018
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Very beginning of HTTP2
HTTP/2 仕様を調べてまとめてみた
Akira Morikawa
July 06, 2018
More Decks by Akira Morikawa
See All by Akira Morikawa
コロナ禍だからこそ考えるオフラインコミュニティの意義 / significance of community
ariaki
0
2.2k
アウトプットの始め方/start output 20230121
ariaki
0
370
web-secure-phpcon2020
ariaki
3
3.8k
オブジェクトライフサイクルとメモリ管理を学ぼう / OOC 2020
ariaki
8
4.2k
エンジニアはアウトプットによって成長できるのか? / Grow with your output
ariaki
24
6.8k
アウトプットを始めよう / How to begin output jawsug-bgnr
ariaki
2
4.1k
参加者の安全を守れていますか? / Protecting community safety
ariaki
1
7.7k
タピオカに学ぶ二段階認証 / tapioca-mfa
ariaki
5
1.4k
古に学ぶ個人開発のススメ / My recommendation of personal development
ariaki
1
1.6k
Other Decks in Technology
See All in Technology
2026/09/10 Spring Bootから Jakarta EE/MicroProfileへの移行
megascus
0
350
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
AIオーケストレーションを活用した 開発ワークフローの設計と実践
bqnq
0
150
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
4
1.4k
消えない 動かない 効かない
yama3133
1
120
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
140
range over func 2年間の軌跡 Issue #56413 はGoのエコシステムをどう変えたか
ryujicre8ive
0
110
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
320
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
200
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
260
Code4Lib JAPANカンファレンス2026 開会挨拶 / Code4Lib JAPAN Conference 2026: Opening Remarks
ykiyota
0
340
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Why Our Code Smells
bkeepers
PRO
340
58k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
Between Models and Reality
mayunak
4
450
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
The Curse of the Amulet
leimatthew05
2
14k
How to Talk to Developers About Accessibility
jct
2
540
Bash Introduction
62gerente
615
220k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Building AI with AI
inesmontani
PRO
1
1.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
Transcript
Very beginning of HTTP/2 2018-07-06 / #web_kaiwai @ariaki4dev What’s Hypertext
Transfer Protocol ?
HTTP Histories HTTP/2 Features HTTP/2 Compatibility Agenda
HTTP Histories
None
HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 - 1991 年に登場 - GET メソッド
- ステータスコードなし - ヘッダなし - Content-Type が指定できないので HTML のみ転送可 HTTP Histories
HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 GET /index.html Request <HTML>HELLO WORLD</HTML> Response
HTTP Histories
HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 - 1996 年に登場 ( RFC1945 )
- HEAD / POST メソッドが追加された - PUT / DELETE は正式仕様ではなく参考仕様 - ステータスコードが追加された - ヘッダが追加された - HTML 以外の転送にも対応 - クッキーはまだない HTTP Histories
HTTP/1.1 HTTP/2 GET /index.html HTTP/1.0 User-Agent: NCSA_Mosaic/2.0 (Windows 3.1) Request
HTTP/0.9 HTTP/1.0 200 OK Date: Fri, 06 Jul 2018 19:00:00 GMT Server: CERN/3.0 libwww/2.17 Content-Type: text/html <HTML>HELLO WORLD</HTML> Response HTTP Histories
HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 - 1999 年に登場 ( RFC2068 )
- PUT / DELETE / OPTIONS / TRACE / CONNECT メソッドが追加された - 1台の HTTPd で複数ドメインに対応した ( Host ) - コネクションの再利用に対応した ( Keep-Alive ) - Chunked レスポンスに対応した - 言語 / タイプ / エンコーディングのネゴシエーションに対応した - HTTP パイプラインに対応した - 1つの TCP 接続で複数 HTTP リクエストを応答を待たずに送信できる HTTP Histories
GET /index.html HTTP/1.1 Host: ariaki.info Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Accept-Encoding: gzip, deflate,
br Accept-Language: ja,en-US;q=0.9,en;q=0.8 Cache-Control: max-age=0 HTTP/2 Request HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP Histories
HTTP/1.1 200 OK Date: Fri, 06 Jul 2018 19:00:00 GMT
Server: Apache Content-Type: text/html; charset=UTF-8 Cache-Control: private, max-age=0 Expires: -1 Connection: Keep-Alive <HTML>HELLO WORLD</HTML> HTTP/2 Response HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP Histories
HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 - 2015 年に登場 ( RFC7540 )
- HTTP/1.1 との後方互換性を維持 - 多くの新機能や改善 HTTP Histories 詳細は次のトピック
HTTP/2 Features
- ネゴシエーション方法として以下をサポート - h2c ( 非暗号通信 ) - Upgrade :
初回は HTTP/1.1 接続し、Upgrade ヘッダで対応を通知 - Direct : クライアントから直接 HTTP/2 接続を指定 - h2 ( 暗号通信 ) - ALPN : TLS/1.2+ 拡張を使用した暗号化接続 ( Application-Layer Protocol Negotiation ) - NPN : TLS/1.2+ 拡張を使用した暗号化接続 ( Next Protocol Negotiation ) 概要 Negotiation
h2c - Upgrade HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade:
h2c : Response GET / HTTP/1.1 Host: ariaki.info Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: <<BASE64 ENCODED BINARY>> Request Negotiation
h2c - Direct <<BASE64 ENCODED BINARY>> Response PRI * HTTP/2.0
SM Request Negotiation
h2 - ALPN ClientHello Handshake Message ServerHello ALPN Extention 通信プロトコル候補
ALPN Extention 通信プロトコル決定 Negotiation 暗号化
暗号化 Negotiation h2 - NPN ClientHello Handshake Message ServerHello NPN
Extention 通信プロトコル候補 NPN Extention 通信プロトコル決定
Binary Frame https://developers.google.com/web/fundamentals/performance/http2/
Binary Frame TYPE FRAME DESCRIPTION 0 DATA リクエスト/レスポンスの本文 1 HEADERS
リクエスト/レスポンスのヘッダ情報 2 PRIORITY ストリーム優先順位(※クライアントのみ送信可) 3 RST_STREAM ストリーム終了(※エラー時など) 4 SETTINGS 接続設定の変更 5 PUSH_PROMISE サーバプッシュ予告(※サーバのみ送信可) 6 PING 接続の生存状態を確認 7 GOAWAY 接続終了(※エラー時など) 8 WINDOW_UPDATE ウインドウサイズ変更 9 CONTINUATION サイズの大きい HEADERS / PUSH_PROMISE フレーム断片
リクエストヘッダの基本形 Header Compression GET /index.html HTTP/1.1 Host: ariaki.info : HTTP/1.1
:method GET :path / :scheme https :authority ariaki.info Accept */* : HTTP/2
リクエストヘッダの送信方法 Header Compression - ヘッダ情報はキャッシュ ( Reference Set ) し、2
回目以降は差分送信 - ヘッダ名は別途管理 ( Table ) し、2 回目以降は Index 指定 - Table 最大長は SETTINGS_MAX_HEADER_LIST_SIZE で指定 - 超過した場合は FIFO で削除 - ヘッダは Binary 形式 ( Binary Optimized Header Encoding ) - HPACK 圧縮
リクエストヘッダ テーブル Header Compression - Index, Name, Value を持つテーブル構造 -
静的テーブル - 使用頻度の高いヘッダ - Index ( 1 - 61 ) が規定されている - 動的テーブル - その他のヘッダデータ - Index ( 62 - ) を自動採番する - 2回目以降は Index を使って指定する
静的テーブル ( 一部抜粋 ) Header Compression +-------+-----------------------------+---------------+ | Index |
Header Name | Header Value | +-------+-----------------------------+---------------+ | 1 | :authority | | | 2 | :method | GET | | 3 | :method | POST | | 4 | :path | / | | 5 | :path | /index.html | | 6 | :scheme | http | | 7 | :scheme | https | | 8 | :status | 200 | | 9 | :status | 204 | | 10 | :status | 206 | | 11 | :status | 304 | | 12 | :status | 400 | | 13 | :status | 404 | | 14 | :status | 500 | | 15 | accept-charset | | +-------+-----------------------------+---------------+ | Index | Header Name | Header Value | +-------+-----------------------------+---------------+ | 16 | accept-encoding | gzip, deflate | | 17 | accept-language | | | 18 | accept-ranges | | | 19 | accept | | | 20 | access-control-allow-origin | | | 21 | age | | | 22 | allow | | | 23 | authorization | | | 24 | cache-control | | | 25 | content-disposition | | | 26 | content-encoding | | | 27 | content-language | | | 28 | content-length | | | 29 | content-location | | | 30 | content-range | | https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#appendix-A
テーブル指定 Header Compression +-------+-----------------------------+---------------+ | Index | Header Name |
Header Value | +-------+-----------------------------+---------------+ | 1 | :authority | | | 2 | :method | GET | | 4 | :path | / | | 7 | :scheme | https | :method GET :path / :scheme https :authority ariaki.info x-test-header DEBUG : 2 GET 4 / 7 https 1 ariaki.info x-test-header DEBUG ( ※次回以降は 62 を指定 ) :
概要 Multi Plexing - HTTP/1.1 - セッション毎に 1 リクエストずつ処理 -
同一ドメインに対して同時 6 セッション / Google Chrome - 複数ドメインに対して同時 2 セッション / HTTP 推奨仕様 - サーバはリクエストの順番通りに返却しなければならない - HTTP/2 - 同一セッション内で同時に複数 ( 100+ ) リクエスト可 - リクエスト時にレスポンス優先順位を設定可
Multi Plexing HTTP/1.1 HTTP/2 (1) GET /index.html (2) GET /app.css
(3) GET /app.js (1) GET /index.html (2) GET /app.css (3) GET /app.js (4) GET /logo.png (4) GET /logo.png 1セッション内で 複数リクエスト 複数セッションを 平行リクエスト * Response all
Server Push GET /index.html /index.html /app.css /app.js /logo.png サーバが判断し、必要に応じて追加リソースを一括返却 HTTP/2
HTTP/2 の課題 Problems - Head of Line Blocking 問題 -
レスポンス完了まで後続のリクエストを受け付けられない - 小さなレスポンス圧縮によるサイドチャネル攻撃 - CRIME / BREACH 等 - Server Push: キャッシュ済データを送信する問題 - 103 Early Hints 等で改善中 - Priority: 優先度を喋らないクライアントに対する応答方法がサーバ実装任せ
その他 Otherwise - WEB 界隈はセキュリティ強化がホットな状況 - TLS 1.3 : draft
28 が IETF 正式勧告 ( OpenSSL 等が対応済 ) - DoH : いくつかの Public DNS が対応開始 - QUIC : まだ 1 年以上かかりそう
HTTP/2 Compatibility
https://caniuse.com/#feat=http2
OSS Server Products Compatibility - Apache HTTP Server 2.4.17+ (
mod_http2 ) - nginx 1.9.5+ - OpenSSL 1.0.2+ - NodeJS 9+ ( node-http2 ) - Apache Tomcat 8.5.32+ ( and more )
Now you can use HTTP/2 on your site.
Appendix - https://developers.google.com/web/fundamentals/performance/http2/?hl=ja - https://tools.ietf.org/html/rfc7540 - https://mozilla.github.io/meao/2017/06/26/http2/ - https://developer.mozilla.org/ja/docs/Web/HTTP/Overview -
https://http2.redbox.ne.jp
@ariaki4dev Written by
http://bit.ly/bc2018ariaki に登壇応募 ( CfP ) しています 拡散にご協力ください