Skip to content

Instantly share code, notes, and snippets.

@Jxck
Last active December 22, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jxck/6475366 to your computer and use it in GitHub Desktop.
Save Jxck/6475366 to your computer and use it in GitHub Desktop.
HPAC の Encoding 戦略の考察
全て Without Indexing で送るパターン
HT を更新しない。
結果的には :scheme, :method くらいしか使いまわさないパターン。
[1]
HeaderSet
:scheme: https
:host: jxck.io
:path: /
:method: GET
user-agent: http2cat
cookie: xxxxxxx1
x-hello: world
Encode
indexed header index=1
literal header without indexing, name index=2 value="jxck.io"
indexed header index=3
indexed header index=4
literal header without indexing, name index=12 vaelu="http2cat"
literal header without indexing, name index=9 vaelu="xxxxxxx1"
literal header without indexing, new name name="x-hello" value="world"
RefSet
:scheme: https
:method: GET
:path: /
[2]
HeaderSet
:scheme: https
:host: jxck.io
:path: /labs/http2cat (changed)
:method: GET
user-agent: http2cat
cookie: xxxxxxx2 (changed)
(x-hello: world) (removed)
Encode
literal header without indexing, name index=2 value="jxck.io"
indexed header index=3 removal from reference set
literal header without indexing, name index=3 value="/labs/http2cat"
literal header without indexing, name index=12 vaelu="http2cat"
literal header without indexing, name index=9 vaelu="xxxxx2"
RefSet
:scheme: https
:method: GET
全て With Incremental Indexing で送るパターン
HT に追記していく。 HT のサイズは伸びていく。
[1]
HeaderSet
:scheme: https
:host: jxck.io
:path: /
:method: GET
user-agent: http2cat
cookie: xxxxxxx1
x-hello: world
Encode
indexed header index=1
literal header with incremental indexing, name index=2 value="jxck.io"
indexed header index=3
indexed header index=4
literal header with incremental indexing, name index=12 vaelu="http2cat"
literal header with incremental indexing, name index=9 vaelu="xxxxxxx1"
literal header with incremental indexing, new name="x-hello" value="world"
RefSet
:scheme: https
:host: jxck.io
:path: /
:method: GET
user-agent: http2cat
cookie: xxxxxxx1
x-hello: world
HT
| 30 | :host | jxck.io |
| 31 | :user-agent | http2cat |
| 32 | cookie | xxxxxxx1 |
| 33 | x-hello | world |
+----+--------------+------------+
[2]
HeaderSet
:scheme: https
:host: jxck.io
:path: /labs/http2cat (changed)
:method: GET
user-agent: http2cat
cookie: xxxxxxx2 (changed)
(x-hello: world) (removed)
Encode
indexed header index=3 removal from reference set
literal header with incremental indexing, name index=3 value="/labs/http2cat"
indexed header index=32 removal from reference set
literal header with incremental indexing, name index=32 vaelu="xxxxxxx2"
indexed header index=33 removal from reference set
RefSet
:scheme: https
:host: jxck.io
:path: /labs/http2cat
:method: GET
user-agent: http2cat
cookie: xxxxxxx2
HT
| 30 | :host | jxck.io |
| 31 | :user-agent | http2cat |
| 32 | cookie | xxxxxxx1 |
| 33 | x-hello | world |
| 34 | :path | /labs/http2cat |
| 35 | cookie | xxxxxx2 |
+----+--------------+------------+
With Substitution Indexing も使うパターン
HT に追記していく。 HT のサイズは小さくて済みそう。
使い分けは
Substitution
:host, user-agent など滅多に変わらないもの
cookie, date など変わるけどどうせ使いまわせないもの
Incremental
:path, referer など変わるけど使いまわせる率が高いもの
[1]
HeaderSet
:scheme: https
:host: jxck.io
:path: /
:method: GET
user-agent: http2cat
cookie: xxxxxxx1
x-hello: world
Encode
indexed header index=1
literal header with substitution indexing, name index=2 value="jxck.io"
indexed header index=3
indexed header index=4
literal header with substitution indexing, name index=12 vaelu="http2cat"
literal header with substitution indexing, name index=9 vaelu="xxxxxxx1"
literal header with incremental indexing, new name="x-hello" value="world"
RefSet
:scheme: https
:host: jxck.io
:path: /
:method: GET
user-agent: http2cat
cookie: xxxxxxx1
x-hello: world
HT
| 2 | :host | jxck.io |
| 9 | cookie | xxxxxxx1 |
| 12 | :user-agent | http2cat |
| 30 | x-hello | world |
+----+--------------+------------+
[2]
HeaderSet
:scheme: https
:host: jxck.io
:path: /labs/http2cat (changed)
:method: GET
user-agent: http2cat
cookie: xxxxxxx2 (changed)
(x-hello: world) (removed)
Encode
indexed header index=3 removal from reference set
literal header with incremental indexing, name index=3 value="/labs/http2cat"
indexed header index=9 removal from reference set
literal header with substitution indexing, name index=9 vaelu="xxxxxxx2"
indexed header index=30 removal from reference set
RefSet
:scheme: https
:host: jxck.io
:path: /labs/http2cat
:method: GET
user-agent: http2cat
cookie: xxxxxxx2
HT
| 2 | :host | jxck.io |
| 9 | cookie | xxxxxxx2 |
| 12 | :user-agent | http2cat |
| 30 | x-hello | world |
| 31 | :path | /labs/http2cat |
+----+--------------+------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment