draft-ietf-quic-qpack-10.txt   draft-ietf-quic-qpack-11.txt 
QUIC C. Krasic QUIC C. Krasic
Internet-Draft Netflix Internet-Draft Netflix
Intended status: Standards Track M. Bishop Intended status: Standards Track M. Bishop
Expires: March 15, 2020 Akamai Technologies Expires: May 7, 2020 Akamai Technologies
A. Frindell, Ed. A. Frindell, Ed.
Facebook Facebook
September 12, 2019 November 04, 2019
QPACK: Header Compression for HTTP/3 QPACK: Header Compression for HTTP/3
draft-ietf-quic-qpack-10 draft-ietf-quic-qpack-11
Abstract Abstract
This specification defines QPACK, a compression format for This specification defines QPACK, a compression format for
efficiently representing HTTP header fields, to be used in HTTP/3. efficiently representing HTTP header fields, to be used in HTTP/3.
This is a variation of HPACK header compression that seeks to reduce This is a variation of HPACK header compression that seeks to reduce
head-of-line blocking. head-of-line blocking.
Note to Readers Note to Readers
skipping to change at page 1, line 46 skipping to change at page 1, line 46
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on March 15, 2020. This Internet-Draft will expire on May 7, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 43 skipping to change at page 2, line 43
2.2.2. State Synchronization . . . . . . . . . . . . . . . . 9 2.2.2. State Synchronization . . . . . . . . . . . . . . . . 9
2.2.3. Invalid References . . . . . . . . . . . . . . . . . 10 2.2.3. Invalid References . . . . . . . . . . . . . . . . . 10
3. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 10 3. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 10 3.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 10
3.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 11 3.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 11
3.2.1. Dynamic Table Size . . . . . . . . . . . . . . . . . 11 3.2.1. Dynamic Table Size . . . . . . . . . . . . . . . . . 11
3.2.2. Dynamic Table Capacity and Eviction . . . . . . . . . 11 3.2.2. Dynamic Table Capacity and Eviction . . . . . . . . . 11
3.2.3. Maximum Dynamic Table Capacity . . . . . . . . . . . 12 3.2.3. Maximum Dynamic Table Capacity . . . . . . . . . . . 12
3.2.4. Absolute Indexing . . . . . . . . . . . . . . . . . . 12 3.2.4. Absolute Indexing . . . . . . . . . . . . . . . . . . 12
3.2.5. Relative Indexing . . . . . . . . . . . . . . . . . . 12 3.2.5. Relative Indexing . . . . . . . . . . . . . . . . . . 12
3.2.6. Post-Base Indexing . . . . . . . . . . . . . . . . . 14 3.2.6. Post-Base Indexing . . . . . . . . . . . . . . . . . 13
4. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 14 4. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 14 4.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 14
4.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 14 4.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 14
4.1.2. String Literals . . . . . . . . . . . . . . . . . . . 14 4.1.2. String Literals . . . . . . . . . . . . . . . . . . . 14
4.2. Encoder and Decoder Streams . . . . . . . . . . . . . . . 15 4.2. Encoder and Decoder Streams . . . . . . . . . . . . . . . 15
4.3. Encoder Instructions . . . . . . . . . . . . . . . . . . 15 4.3. Encoder Instructions . . . . . . . . . . . . . . . . . . 15
4.3.1. Set Dynamic Table Capacity . . . . . . . . . . . . . 16 4.3.1. Set Dynamic Table Capacity . . . . . . . . . . . . . 16
4.3.2. Insert With Name Reference . . . . . . . . . . . . . 16 4.3.2. Insert With Name Reference . . . . . . . . . . . . . 16
4.3.3. Insert Without Name Reference . . . . . . . . . . . . 17 4.3.3. Insert Without Name Reference . . . . . . . . . . . . 17
4.3.4. Duplicate . . . . . . . . . . . . . . . . . . . . . . 17 4.3.4. Duplicate . . . . . . . . . . . . . . . . . . . . . . 17
4.4. Decoder Instructions . . . . . . . . . . . . . . . . . . 18 4.4. Decoder Instructions . . . . . . . . . . . . . . . . . . 18
4.4.1. Header Acknowledgement . . . . . . . . . . . . . . . 18 4.4.1. Header Acknowledgement . . . . . . . . . . . . . . . 18
4.4.2. Stream Cancellation . . . . . . . . . . . . . . . . . 18 4.4.2. Stream Cancellation . . . . . . . . . . . . . . . . . 18
4.4.3. Insert Count Increment . . . . . . . . . . . . . . . 19 4.4.3. Insert Count Increment . . . . . . . . . . . . . . . 19
4.5. Header Block Representations . . . . . . . . . . . . . . 19 4.5. Header Block Representations . . . . . . . . . . . . . . 19
4.5.1. Header Block Prefix . . . . . . . . . . . . . . . . . 19 4.5.1. Header Block Prefix . . . . . . . . . . . . . . . . . 19
4.5.2. Indexed Header Field . . . . . . . . . . . . . . . . 22 4.5.2. Indexed Header Field . . . . . . . . . . . . . . . . 22
4.5.3. Indexed Header Field With Post-Base Index . . . . . . 23 4.5.3. Indexed Header Field With Post-Base Index . . . . . . 22
4.5.4. Literal Header Field With Name Reference . . . . . . 23 4.5.4. Literal Header Field With Name Reference . . . . . . 23
4.5.5. Literal Header Field With Post-Base Name Reference . 24 4.5.5. Literal Header Field With Post-Base Name Reference . 24
4.5.6. Literal Header Field Without Name Reference . . . . . 24 4.5.6. Literal Header Field Without Name Reference . . . . . 24
5. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 25 5. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 25
6. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 25 6. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 25
7. Security Considerations . . . . . . . . . . . . . . . . . . . 25 7. Security Considerations . . . . . . . . . . . . . . . . . . . 26
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26
8.1. Settings Registration . . . . . . . . . . . . . . . . . . 26 8.1. Settings Registration . . . . . . . . . . . . . . . . . . 26
8.2. Stream Type Registration . . . . . . . . . . . . . . . . 26 8.2. Stream Type Registration . . . . . . . . . . . . . . . . 26
8.3. Error Code Registration . . . . . . . . . . . . . . . . . 26 8.3. Error Code Registration . . . . . . . . . . . . . . . . . 27
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1. Normative References . . . . . . . . . . . . . . . . . . 27 9.1. Normative References . . . . . . . . . . . . . . . . . . 27
9.2. Informative References . . . . . . . . . . . . . . . . . 28 9.2. Informative References . . . . . . . . . . . . . . . . . 28
9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 28 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Appendix A. Static Table . . . . . . . . . . . . . . . . . . . . 28 Appendix A. Static Table . . . . . . . . . . . . . . . . . . . . 28
Appendix B. Sample One Pass Encoding Algorithm . . . . . . . . . 33 Appendix B. Sample One Pass Encoding Algorithm . . . . . . . . . 33
Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 35 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 35
C.1. Since draft-ietf-quic-qpack-09 . . . . . . . . . . . . . 35 C.1. Since draft-ietf-quic-qpack-10 . . . . . . . . . . . . . 35
C.2. Since draft-ietf-quic-qpack-08 . . . . . . . . . . . . . 35 C.2. Since draft-ietf-quic-qpack-09 . . . . . . . . . . . . . 35
C.3. Since draft-ietf-quic-qpack-06 . . . . . . . . . . . . . 35 C.3. Since draft-ietf-quic-qpack-08 . . . . . . . . . . . . . 35
C.4. Since draft-ietf-quic-qpack-05 . . . . . . . . . . . . . 35 C.4. Since draft-ietf-quic-qpack-06 . . . . . . . . . . . . . 35
C.5. Since draft-ietf-quic-qpack-04 . . . . . . . . . . . . . 35 C.5. Since draft-ietf-quic-qpack-05 . . . . . . . . . . . . . 35
C.6. Since draft-ietf-quic-qpack-03 . . . . . . . . . . . . . 35 C.6. Since draft-ietf-quic-qpack-04 . . . . . . . . . . . . . 35
C.7. Since draft-ietf-quic-qpack-02 . . . . . . . . . . . . . 36 C.7. Since draft-ietf-quic-qpack-03 . . . . . . . . . . . . . 35
C.8. Since draft-ietf-quic-qpack-01 . . . . . . . . . . . . . 36 C.8. Since draft-ietf-quic-qpack-02 . . . . . . . . . . . . . 36
C.9. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 36 C.9. Since draft-ietf-quic-qpack-01 . . . . . . . . . . . . . 36
C.10. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 36 C.10. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 36
C.11. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 36
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 37 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 37
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 37 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 37
1. Introduction 1. Introduction
The QUIC transport protocol [QUIC-TRANSPORT] is designed to support The QUIC transport protocol [QUIC-TRANSPORT] is designed to support
HTTP semantics, and its design subsumes many of the features of HTTP semantics, and its design subsumes many of the features of
HTTP/2 [RFC7540]. HTTP/2 uses HPACK ([RFC7541]) for header HTTP/2 [RFC7540]. HTTP/2 uses HPACK [RFC7541] for header
compression. If HPACK were used for HTTP/3 [HTTP3], it would induce compression. If HPACK were used for HTTP/3 [HTTP3], it would induce
head-of-line blocking due to built-in assumptions of a total ordering head-of-line blocking due to built-in assumptions of a total ordering
across frames on all streams. across frames on all streams.
QPACK reuses core concepts from HPACK, but is redesigned to allow QPACK reuses core concepts from HPACK, but is redesigned to allow
correctness in the presence of out-of-order delivery, with correctness in the presence of out-of-order delivery, with
flexibility for implementations to balance between resilience against flexibility for implementations to balance between resilience against
head-of-line blocking and optimal compression ratio. The design head-of-line blocking and optimal compression ratio. The design
goals are to closely approach the compression ratio of HPACK with goals are to closely approach the compression ratio of HPACK with
substantially less head-of-line blocking under the same loss substantially less head-of-line blocking under the same loss
skipping to change at page 5, line 52 skipping to change at page 5, line 52
list. An encoder MUST emit header field representations in the order list. An encoder MUST emit header field representations in the order
they appear in the input header list. they appear in the input header list.
QPACK is designed to contain the more complex state tracking to the QPACK is designed to contain the more complex state tracking to the
encoder, while the decoder is relatively simple. encoder, while the decoder is relatively simple.
2.1.1. Reference Tracking 2.1.1. Reference Tracking
An encoder MUST ensure that a header block which references a dynamic An encoder MUST ensure that a header block which references a dynamic
table entry is not processed by the decoder after the referenced table entry is not processed by the decoder after the referenced
entry has been evicted. Hence the encoder needs to track information entry has been evicted. Hence the encoder needs to retain
about each compressed header block that references the dynamic table information about each compressed header block that references the
until that header block is acknowledged by the decoder (see dynamic table until that header block is acknowledged by the decoder
Section 4.4.1). (see Section 4.4.1).
2.1.2. Blocked Dynamic Table Insertions 2.1.2. Blocked Dynamic Table Insertions
A dynamic table entry is considered blocking and cannot be evicted A dynamic table entry is considered blocking and cannot be evicted
until its insertion has been acknowledged and there are no until its insertion has been acknowledged and there are no
outstanding unacknowledged references to the entry. In particular, a outstanding unacknowledged references to the entry. In particular, a
dynamic table entry that has never been referenced can still be dynamic table entry that has never been referenced can still be
blocking. blocking.
Note: A blocking entry is unrelated to a blocked stream, which is a
stream that a decoder cannot decode as a result of references to
entries that are not yet available. An encoder that uses the
dynamic table has to keep track of blocked entries.
An encoder MUST NOT insert an entry into the dynamic table (or An encoder MUST NOT insert an entry into the dynamic table (or
duplicate an existing entry) if doing so would evict a blocking duplicate an existing entry) if doing so would evict a blocking
entry. entry. In order to avoid this, an encoder that uses the dynamic
table has to keep track of blocking entries.
Note: A blocking entry is unrelated to a blocked stream, see
Section 2.1.3.
2.1.2.1. Avoiding Blocked Insertions 2.1.2.1. Avoiding Blocked Insertions
To ensure that the encoder is not prevented from adding new entries, To ensure that the encoder is not prevented from adding new entries,
the encoder can avoid referencing entries that are close to eviction. the encoder can avoid referencing entries that are close to eviction.
Rather than reference such an entry, the encoder can emit a Duplicate Rather than reference such an entry, the encoder can emit a Duplicate
instruction (see Section 4.3.4), and reference the duplicate instead. instruction (see Section 4.3.4), and reference the duplicate instead.
Determining which entries are too close to eviction to reference is Determining which entries are too close to eviction to reference is
an encoder preference. One heuristic is to target a fixed amount of an encoder preference. One heuristic is to target a fixed amount of
skipping to change at page 7, line 32 skipping to change at page 7, line 32
Each header block contains a Required Insert Count (see Each header block contains a Required Insert Count (see
Section 4.5.1), the lowest possible value for the Insert Count with Section 4.5.1), the lowest possible value for the Insert Count with
which the header block can be decoded. For a header block with which the header block can be decoded. For a header block with
references to the dynamic table, the Required Insert Count is one references to the dynamic table, the Required Insert Count is one
larger than the largest absolute index of all referenced dynamic larger than the largest absolute index of all referenced dynamic
table entries. For a header block with no references to the dynamic table entries. For a header block with no references to the dynamic
table, the Required Insert Count is zero. table, the Required Insert Count is zero.
When the decoder receives a header block with a Required Insert Count When the decoder receives a header block with a Required Insert Count
greater than its own Insert Count, the stream cannot be processed greater than its own Insert Count, the stream cannot be processed
immediately, and is considered "blocked" (see {blocked-decoding}). immediately, and is considered "blocked" (see Section 2.2.1).
The decoder specifies an upper bound on the number of streams which The decoder specifies an upper bound on the number of streams which
can be blocked using the SETTINGS_QPACK_BLOCKED_STREAMS setting (see can be blocked using the SETTINGS_QPACK_BLOCKED_STREAMS setting (see
Section 5). An encoder MUST limit the number of streams which could Section 5). An encoder MUST limit the number of streams which could
become blocked to the value of SETTINGS_QPACK_BLOCKED_STREAMS at all become blocked to the value of SETTINGS_QPACK_BLOCKED_STREAMS at all
times. If an decoder encounters more blocked streams than it times. If a decoder encounters more blocked streams than it promised
promised to support, it MUST treat this as a connection error of type to support, it MUST treat this as a connection error of type
HTTP_QPACK_DECOMPRESSION_FAILED. HTTP_QPACK_DECOMPRESSION_FAILED.
Note that the decoder might not become blocked on every stream which Note that the decoder might not become blocked on every stream which
risks becoming blocked. risks becoming blocked.
An encoder can decide whether to risk having a stream become blocked. An encoder can decide whether to risk having a stream become blocked.
If permitted by the value of SETTINGS_QPACK_BLOCKED_STREAMS, If permitted by the value of SETTINGS_QPACK_BLOCKED_STREAMS,
compression efficiency can often be improved by referencing dynamic compression efficiency can often be improved by referencing dynamic
table entries that are still in transit, but if there is loss or table entries that are still in transit, but if there is loss or
reordering the stream can become blocked at the decoder. An encoder reordering the stream can become blocked at the decoder. An encoder
avoids the risk of blocking by only referencing dynamic table entries can avoid the risk of blocking by only referencing dynamic table
which have been acknowledged, but this could mean using literals. entries which have been acknowledged, but this could mean using
literals. Since literals make the header block larger, this can
Since literals make the header block larger, this can result in the result in the encoder becoming blocked on congestion or flow control
encoder becoming blocked on congestion or flow control limits. limits.
2.1.4. Known Received Count 2.1.4. Known Received Count
In order to identify which dynamic table entries can be safely used The Known Received Count is the total number of dynamic table
without a stream becoming blocked, the encoder tracks the number of insertions and duplications acknowledged by the decoder. The encoder
entries received by the decoder. The Known Received Count tracks the tracks the Known Received Count in order to identify which dynamic
total number of acknowledged insertions. table entries can be referenced without potentially blocking a
stream. The decoder tracks the Known Received Count in order to be
able to send Insert Count Increment instructions (see Section 4.4.3).
When blocking references are permitted, the encoder uses Header If a header block was potentially blocking, the encoder infers from
Acknowledgement instructions (Section 4.4.1) to maintain the Known receiving a Header Acknowledgement instruction (Section 4.4.1) that
Received Count. If a header block was potentially blocking, the the decoder has received all dynamic table state necessary to process
acknowledgement implies that the decoder has received all dynamic that header block. If the Required Insert Count of the acknowledged
table state necessary to process the header block. If the Required header block is greater than the current Known Received Count, the
Insert Count of an acknowledged header block was greater than the encoder updates the Known Received Count to the value of the Required
encoder's current Known Received Count, the block's Required Insert Insert Count of the acknowledged header block.
Count becomes the new Known Received Count.
To acknowledge dynamic table entries which are not referenced by To acknowledge dynamic table entries which are not referenced by
header blocks, for example because the encoder or the decoder have header blocks, for example because the encoder or the decoder have
chosen not to risk blocked streams, the decoder sends an Insert Count chosen not to risk blocked streams, the decoder sends an Insert Count
Increment instruction (see Section 4.4.3). Increment instruction (see Section 4.4.3).
2.2. Decoder 2.2. Decoder
As in HPACK, the decoder processes header blocks and emits the As in HPACK, the decoder processes header blocks and emits the
corresponding header lists. It also processes dynamic table corresponding header lists. It also processes instructions received
modifications from encoder instructions received on the encoder on the encoder stream that modify the dynamic table. Note that
stream. header blocks and encoder stream instructions arrive on separate
streams. This is unlike HPACK, where header blocks can contain
instructions that modify the dynamic table, and there is no dedicated
stream of HPACK instructions.
The decoder MUST emit header fields in the order their The decoder MUST emit header fields in the order their
representations appear in the input header block. representations appear in the input header block.
2.2.1. Blocked Decoding 2.2.1. Blocked Decoding
Upon receipt of a header block, the decoder examines the Required Upon receipt of a header block, the decoder examines the Required
Insert Count. When the Required Insert Count is less than or equal Insert Count. When the Required Insert Count is less than or equal
to the decoder's Insert Count, the header block can be processed to the decoder's Insert Count, the header block can be processed
immediately. Otherwise, the stream on which the header block was immediately. Otherwise, the stream on which the header block was
skipping to change at page 10, line 40 skipping to change at page 10, line 47
3.1. Static Table 3.1. Static Table
The static table consists of a predefined static list of header The static table consists of a predefined static list of header
fields, each of which has a fixed index over time. Its entries are fields, each of which has a fixed index over time. Its entries are
defined in Appendix A. defined in Appendix A.
All entries in the static table have a name and a value. However, All entries in the static table have a name and a value. However,
values can be empty (that is, have a length of 0). Each entry is values can be empty (that is, have a length of 0). Each entry is
identified by a unique index. identified by a unique index.
Note the QPACK static table is indexed from 0, whereas the HPACK Note that the QPACK static table is indexed from 0, whereas the HPACK
static table is indexed from 1. static table is indexed from 1.
When the decoder encounters an invalid static table index in a header When the decoder encounters an invalid static table index in a header
block representation it MUST treat this as a connection error of type block representation it MUST treat this as a connection error of type
"HTTP_QPACK_DECOMPRESSION_FAILED". If this index is received on the "HTTP_QPACK_DECOMPRESSION_FAILED". If this index is received on the
encoder stream, this MUST be treated as a connection error of type encoder stream, this MUST be treated as a connection error of type
"HTTP_QPACK_ENCODER_STREAM_ERROR". "HTTP_QPACK_ENCODER_STREAM_ERROR".
3.2. Dynamic Table 3.2. Dynamic Table
skipping to change at page 11, line 22 skipping to change at page 11, line 24
The dynamic table can contain duplicate entries (i.e., entries with The dynamic table can contain duplicate entries (i.e., entries with
the same name and same value). Therefore, duplicate entries MUST NOT the same name and same value). Therefore, duplicate entries MUST NOT
be treated as an error by the decoder. be treated as an error by the decoder.
Dynamic table entries can have empty values. Dynamic table entries can have empty values.
3.2.1. Dynamic Table Size 3.2.1. Dynamic Table Size
The size of the dynamic table is the sum of the size of its entries. The size of the dynamic table is the sum of the size of its entries.
The size of an entry is the sum of its name's length in bytes (as The size of an entry is the sum of its name's length in bytes, its
defined in Section 4.1.2), its value's length in bytes, and 32. value's length in bytes, and 32. The size of an entry is calculated
using the length of its name and value without Huffman encoding
The size of an entry is calculated using the length of its name and applied.
value without Huffman encoding applied.
3.2.2. Dynamic Table Capacity and Eviction 3.2.2. Dynamic Table Capacity and Eviction
The encoder sets the capacity of the dynamic table, which serves as The encoder sets the capacity of the dynamic table, which serves as
the upper limit on its size. The initial capacity of the dynamic the upper limit on its size. The initial capacity of the dynamic
table is zero. The encoder sends a Set Dynamic Table Capacity table is zero. The encoder sends a Set Dynamic Table Capacity
instruction (Section 4.3.1) with a non-zero capacity to begin using instruction (Section 4.3.1) with a non-zero capacity to begin using
the dynamic table. the dynamic table.
Before a new entry is added to the dynamic table, entries are evicted Before a new entry is added to the dynamic table, entries are evicted
from the end of the dynamic table until the size of the dynamic table from the end of the dynamic table until the size of the dynamic table
is less than or equal to (table capacity - size of new entry). The is less than or equal to (table capacity - size of new entry). The
encoder MUST NOT evict a blocking dynamic table entry (see encoder MUST NOT cause a blocking dynamic table entry to be evicted
Section 2.1.2). The entry is then added to the table. It is an (see Section 2.1.2). The new entry is then added to the table. It
error if the encoder attempts to add an entry that is larger than the is an error if the encoder attempts to add an entry that is larger
dynamic table capacity; the decoder MUST treat this as a connection than the dynamic table capacity; the decoder MUST treat this as a
error of type "HTTP_QPACK_ENCODER_STREAM_ERROR". connection error of type "HTTP_QPACK_ENCODER_STREAM_ERROR".
A new entry can reference an entry in the dynamic table that will be A new entry can reference an entry in the dynamic table that will be
evicted when adding this new entry into the dynamic table. evicted when adding this new entry into the dynamic table.
Implementations are cautioned to avoid deleting the referenced name Implementations are cautioned to avoid deleting the referenced name
or value if the referenced entry is evicted from the dynamic table or value if the referenced entry is evicted from the dynamic table
prior to inserting the new entry. prior to inserting the new entry.
Whenever the dynamic table capacity is reduced by the encoder (see Whenever the dynamic table capacity is reduced by the encoder (see
Section 4.3.1), entries are evicted from the end of the dynamic table Section 4.3.1), entries are evicted from the end of the dynamic table
until the size of the dynamic table is less than or equal to the new until the size of the dynamic table is less than or equal to the new
skipping to change at page 12, line 22 skipping to change at page 12, line 25
the maximum value the encoder is permitted to set for the dynamic the maximum value the encoder is permitted to set for the dynamic
table capacity. In HTTP/3, this limit is determined by the value of table capacity. In HTTP/3, this limit is determined by the value of
SETTINGS_QPACK_MAX_TABLE_CAPACITY sent by the decoder (see SETTINGS_QPACK_MAX_TABLE_CAPACITY sent by the decoder (see
Section 5). The encoder MUST not set a dynamic table capacity that Section 5). The encoder MUST not set a dynamic table capacity that
exceeds this maximum, but it can choose to use a lower dynamic table exceeds this maximum, but it can choose to use a lower dynamic table
capacity (see Section 4.3.1). capacity (see Section 4.3.1).
For clients using 0-RTT data in HTTP/3, the server's maximum table For clients using 0-RTT data in HTTP/3, the server's maximum table
capacity is the remembered value of the setting, or zero if the value capacity is the remembered value of the setting, or zero if the value
was not previously sent. When the client's 0-RTT value of the was not previously sent. When the client's 0-RTT value of the
SETTING is 0, the server MAY set it to a non-zero value in its SETTING is zero, the server MAY set it to a non-zero value in its
SETTINGS frame. If the remembered value is non-zero, the server MUST SETTINGS frame. If the remembered value is non-zero, the server MUST
send the same non-zero value in its SETTINGS frame. If it specifies send the same non-zero value in its SETTINGS frame. If it specifies
any other value, or omits SETTINGS_QPACK_MAX_TABLE_CAPACITY from any other value, or omits SETTINGS_QPACK_MAX_TABLE_CAPACITY from
SETTINGS, the encoder must treat this as a connection error of type SETTINGS, the encoder must treat this as a connection error of type
"HTTP_QPACK_DECODER_STREAM_ERROR". "HTTP_QPACK_DECODER_STREAM_ERROR".
For HTTP/3 servers and HTTP/3 clients when 0-RTT is not attempted or For HTTP/3 servers and HTTP/3 clients when 0-RTT is not attempted or
is rejected, the maximum table capacity is 0 until the encoder is rejected, the maximum table capacity is 0 until the encoder
processes a SETTINGS frame with a non-zero value of processes a SETTINGS frame with a non-zero value of
SETTINGS_QPACK_MAX_TABLE_CAPACITY. SETTINGS_QPACK_MAX_TABLE_CAPACITY.
When the maximum table capacity is 0, the encoder MUST NOT insert When the maximum table capacity is zero, the encoder MUST NOT insert
entries into the dynamic table, and MUST NOT send any encoder entries into the dynamic table, and MUST NOT send any encoder
instructions on the encoder stream. instructions on the encoder stream.
3.2.4. Absolute Indexing 3.2.4. Absolute Indexing
Each entry possesses both an absolute index which is fixed for the Each entry possesses an absolute index which is fixed for the
lifetime of that entry and a relative index which changes based on lifetime of that entry. The first entry inserted has an absolute
the context of the reference. The first entry inserted has an index of "0"; indices increase by one with each insertion.
absolute index of "0"; indices increase by one with each insertion.
3.2.5. Relative Indexing 3.2.5. Relative Indexing
Relative indices begin at zero and increase in the opposite direction Relative indices begin at zero and increase in the opposite direction
from the absolute index. Determining which entry has a relative from the absolute index. Determining which entry has a relative
index of "0" depends on the context of the reference. index of "0" depends on the context of the reference.
In encoder instructions, a relative index of "0" always refers to the In encoder instructions (see Section 4.3), a relative index of "0"
most recently inserted value in the dynamic table. Note that this refers to the most recently inserted value in the dynamic table.
means the entry referenced by a given relative index will change Note that this means the entry referenced by a given relative index
while interpreting instructions on the encoder stream. will change while interpreting instructions on the encoder stream.
+-----+---------------+-------+ +-----+---------------+-------+
| n-1 | ... | d | Absolute Index | n-1 | ... | d | Absolute Index
+ - - +---------------+ - - - + + - - +---------------+ - - - +
| 0 | ... | n-d-1 | Relative Index | 0 | ... | n-d-1 | Relative Index
+-----+---------------+-------+ +-----+---------------+-------+
^ | ^ |
| V | V
Insertion Point Dropping Point Insertion Point Dropping Point
n = count of entries inserted n = count of entries inserted
d = count of entries dropped d = count of entries dropped
Example Dynamic Table Indexing - Encoder Stream Example Dynamic Table Indexing - Encoder Stream
Unlike encoder instructions, relative indices in header block Unlike in encoder instructions, relative indices in header block
representations are relative to the Base at the beginning of the representations are relative to the Base at the beginning of the
header block (see Section 4.5.1). This ensures that references are header block (see Section 4.5.1). This ensures that references are
stable even if header blocks and dynamic table updates are processed stable even if header blocks and dynamic table updates are processed
out of order. out of order.
In a header block a relative index of "0" refers to the entry with In a header block a relative index of "0" refers to the entry with
absolute index equal to Base - 1. absolute index equal to Base - 1.
Required Base
Insert |
Count Base V
| |
V V
+-----+-----+-----+-----+-------+ +-----+-----+-----+-----+-------+
| n-1 | n-2 | n-3 | ... | d | Absolute Index | n-1 | n-2 | n-3 | ... | d | Absolute Index
+-----+-----+ - +-----+ - + +-----+-----+ - +-----+ - +
| 0 | ... | n-d-3 | Relative Index | 0 | ... | n-d-3 | Relative Index
+-----+-----+-------+ +-----+-----+-------+
n = count of entries inserted n = count of entries inserted
d = count of entries dropped d = count of entries dropped
In this example, Base = n - 2
Example Dynamic Table Indexing - Relative Index in Header Block Example Dynamic Table Indexing - Relative Index in Header Block
3.2.6. Post-Base Indexing 3.2.6. Post-Base Indexing
Post-Base indices are used for entries with absolute indexes greater Post-Base indices are used in header block instructions for entries
than or equal to Base, starting at 0 for the entry with absolute with absolute indices greater than or equal to Base, starting at 0
index equal to Base, and increasing in the same direction as the for the entry with absolute index equal to Base, and increasing in
absolute index. the same direction as the absolute index.
Post-Base indices allow an encoder to process a header block in a Post-Base indices allow an encoder to process a header block in a
single pass and include references to entries added while processing single pass and include references to entries added while processing
this (or other) header blocks. this (or other) header blocks.
Base Base
| |
V V
+-----+-----+-----+-----+-----+ +-----+-----+-----+-----+-----+
| n-1 | n-2 | n-3 | ... | d | Absolute Index | n-1 | n-2 | n-3 | ... | d | Absolute Index
+-----+-----+-----+-----+-----+ +-----+-----+-----+-----+-----+
| 1 | 0 | Post-Base Index | 1 | 0 | Post-Base Index
+-----+-----+ +-----+-----+
n = count of entries inserted n = count of entries inserted
d = count of entries dropped d = count of entries dropped
In this example, Base = n - 2
Example Dynamic Table Indexing - Post-Base Index in Header Block Example Dynamic Table Indexing - Post-Base Index in Header Block
4. Wire Format 4. Wire Format
4.1. Primitives 4.1. Primitives
4.1.1. Prefixed Integers 4.1.1. Prefixed Integers
The prefixed integer from Section 5.1 of [RFC7541] is used heavily The prefixed integer from Section 5.1 of [RFC7541] is used heavily
throughout this document. The format from [RFC7541] is used throughout this document. The format from [RFC7541] is used
unmodified. QPACK implementations MUST be able to decode integers up unmodified. Note, however, that QPACK uses some prefix sizes not
to 62 bits long. actually used in HPACK.
QPACK implementations MUST be able to decode integers up to and
including 62 bits long.
4.1.2. String Literals 4.1.2. String Literals
The string literal defined by Section 5.2 of [RFC7541] is also used The string literal defined by Section 5.2 of [RFC7541] is also used
throughout. This string format includes optional Huffman encoding. throughout. This string format includes optional Huffman encoding.
HPACK defines string literals to begin on a byte boundary. They HPACK defines string literals to begin on a byte boundary. They
begin with a single flag (indicating whether the string is Huffman- begin with a single bit flag, denoted as 'H' in this document
coded), followed by the Length encoded as a 7-bit prefix integer, and (indicating whether the string is Huffman-coded), followed by the
finally Length bytes of data. When Huffman encoding is enabled, the Length encoded as a 7-bit prefix integer, and finally Length bytes of
Huffman table from Appendix B of [RFC7541] is used without data. When Huffman encoding is enabled, the Huffman table from
modification. Appendix B of [RFC7541] is used without modification.
This document expands the definition of string literals and permits This document expands the definition of string literals and permits
them to begin other than on a byte boundary. An "N-bit prefix string them to begin other than on a byte boundary. An "N-bit prefix string
literal" begins with the same Huffman flag, followed by the length literal" begins with the same Huffman flag, followed by the length
encoded as an (N-1)-bit prefix integer. The remainder of the string encoded as an (N-1)-bit prefix integer. The prefix size, N, can have
a value between 2 and 8 inclusive. The remainder of the string
literal is unmodified. literal is unmodified.
A string literal without a prefix length noted is an 8-bit prefix A string literal without a prefix length noted is an 8-bit prefix
string literal and follows the definitions in [RFC7541] without string literal and follows the definitions in [RFC7541] without
modification. modification.
4.2. Encoder and Decoder Streams 4.2. Encoder and Decoder Streams
QPACK defines two unidirectional stream types: QPACK defines two unidirectional stream types:
skipping to change at page 15, line 35 skipping to change at page 15, line 36
to encoder. to encoder.
HTTP/3 endpoints contain a QPACK encoder and decoder. Each endpoint HTTP/3 endpoints contain a QPACK encoder and decoder. Each endpoint
MUST initiate at most one encoder stream and at most one decoder MUST initiate at most one encoder stream and at most one decoder
stream. Receipt of a second instance of either stream type MUST be stream. Receipt of a second instance of either stream type MUST be
treated as a connection error of type HTTP_STREAM_CREATION_ERROR. treated as a connection error of type HTTP_STREAM_CREATION_ERROR.
These streams MUST NOT be closed. Closure of either unidirectional These streams MUST NOT be closed. Closure of either unidirectional
stream type MUST be treated as a connection error of type stream type MUST be treated as a connection error of type
HTTP_CLOSED_CRITICAL_STREAM. HTTP_CLOSED_CRITICAL_STREAM.
An endpoint MAY avoid creating its own encoder stream if it's not An endpoint MAY avoid creating an encoder stream if it's not going to
going to be used (for example if the endpoint doesn't wish to use the be used (for example if its encoder doesn't wish to use the dynamic
dynamic table, or if the maximum size of the dynamic table permitted table, or if the maximum size of the dynamic table permitted by the
by the peer is zero). peer is zero).
An endpoint MAY avoid creating its own decoder stream if the maximum An endpoint MAY avoid creating a decoder stream if its decoder sets
size of its own dynamic table is zero. the maximum capacity of the dynamic table to zero.
An endpoint MUST allow its peer to create both encoder and decoder An endpoint MUST allow its peer to create an encoder stream and a
streams even if the connection's settings prevent their use. decoder stream even if the connection's settings prevent their use.
4.3. Encoder Instructions 4.3. Encoder Instructions
An encoder sends encoder instructions on the encoder stream to set An encoder sends encoder instructions on the encoder stream to set
the capacity of the dynamic table and add dynamic table entries. the capacity of the dynamic table and add dynamic table entries.
Instructions adding table entries can use existing entries to avoid Instructions adding table entries can use existing entries to avoid
transmitting redundant information. The name can be transmitted as a transmitting redundant information. The name can be transmitted as a
reference to an existing entry in the static or the dynamic table or reference to an existing entry in the static or the dynamic table or
as a string literal. For entries which already exist in the dynamic as a string literal. For entries which already exist in the dynamic
table, the full entry can also be used by reference, creating a table, the full entry can also be used by reference, creating a
skipping to change at page 16, line 42 skipping to change at page 16, line 43
(see Section 3.2.2). This MUST NOT cause the eviction of blocking (see Section 3.2.2). This MUST NOT cause the eviction of blocking
entries (see Section 2.1.2). Changing the capacity of the dynamic entries (see Section 2.1.2). Changing the capacity of the dynamic
table is not acknowledged as this instruction does not insert an table is not acknowledged as this instruction does not insert an
entry. entry.
4.3.2. Insert With Name Reference 4.3.2. Insert With Name Reference
An encoder adds an entry to the dynamic table where the header field An encoder adds an entry to the dynamic table where the header field
name matches the header field name of an entry stored in the static name matches the header field name of an entry stored in the static
or the dynamic table using an instruction that starts with the '1' or the dynamic table using an instruction that starts with the '1'
one-bit pattern. The second ("S") bit indicates whether the one-bit pattern. The second ('T') bit indicates whether the
reference is to the static or dynamic table. The 6-bit prefix reference is to the static or dynamic table. The 6-bit prefix
integer (see Section 4.1.1) that follows is used to locate the table integer (see Section 4.1.1) that follows is used to locate the table
entry for the header name. When S=1, the number represents the entry for the header name. When T=1, the number represents the
static table index; when S=0, the number is the relative index of the static table index; when T=0, the number is the relative index of the
entry in the dynamic table. entry in the dynamic table.
The header name reference is followed by the header field value The header name reference is followed by the header field value
represented as a string literal (see Section 4.1.2). represented as a string literal (see Section 4.1.2).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 1 | S | Name Index (6+) | | 1 | T | Name Index (6+) |
+---+---+-----------------------+ +---+---+-----------------------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
| Value String (Length bytes) | | Value String (Length bytes) |
+-------------------------------+ +-------------------------------+
Insert Header Field -- Indexed Name Insert Header Field -- Indexed Name
4.3.3. Insert Without Name Reference 4.3.3. Insert Without Name Reference
skipping to change at page 18, line 6 skipping to change at page 18, line 6
an integer with a 5-bit prefix (see Section 4.1.1. an integer with a 5-bit prefix (see Section 4.1.1.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | Index (5+) | | 0 | 0 | 0 | Index (5+) |
+---+---+---+-------------------+ +---+---+---+-------------------+
Figure 3: Duplicate Figure 3: Duplicate
The existing entry is re-inserted into the dynamic table without The existing entry is re-inserted into the dynamic table without
resending either the name or the value. This is useful to mitigate resending either the name or the value. This is useful to avoid
the eviction of older entries which are frequently referenced, both adding a reference to an older entry, which might block inserting new
to avoid the need to resend the header and to avoid the entry in the entries.
table blocking the ability to insert new headers.
4.4. Decoder Instructions 4.4. Decoder Instructions
Decoder instructions provide information used to ensure consistency A decoder sends decoder instructions on the decoder stream to inform
of the dynamic table. They are sent from the decoder to the encoder the encoder about the processing of header blocks and table updates
on a decoder stream; that is, the server informs the client about the to ensure consistency of the dynamic table.
processing of the client's header blocks and table updates, and the
client informs the server about the processing of the server's header
blocks and table updates.
This section specifies the following decoder instructions. This section specifies the following decoder instructions.
4.4.1. Header Acknowledgement 4.4.1. Header Acknowledgement
After processing a header block whose declared Required Insert Count After processing a header block whose declared Required Insert Count
is not zero, the decoder emits a Header Acknowledgement instruction. is not zero, the decoder emits a Header Acknowledgement instruction.
The instruction begins with the '1' one-bit pattern which is followed The instruction begins with the '1' one-bit pattern which is followed
by the header block's associated stream ID encoded as a 7-bit prefix by the header block's associated stream ID encoded as a 7-bit prefix
integer (see Section 4.1.1). integer (see Section 4.1.1).
skipping to change at page 19, line 30 skipping to change at page 19, line 30
instruction. The encoder uses this value to update the Known instruction. The encoder uses this value to update the Known
Received Count, as described in Section 2.2.2. Received Count, as described in Section 2.2.2.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | Increment (6+) | | 0 | 0 | Increment (6+) |
+---+---+-----------------------+ +---+---+-----------------------+
Figure 6: Insert Count Increment Figure 6: Insert Count Increment
An encoder that receives an Increment field equal to zero or one that An encoder that receives an Increment field equal to zero, or one
increases the Known Received Count beyond what the encoder has sent that increases the Known Received Count beyond what the encoder has
MUST treat this as a connection error of type sent MUST treat this as a connection error of type
"HTTP_QPACK_DECODER_STREAM_ERROR". "HTTP_QPACK_DECODER_STREAM_ERROR".
4.5. Header Block Representations 4.5. Header Block Representations
A header block consists of a prefix and a possibly empty sequence of A header block consists of a prefix and a possibly empty sequence of
representations defined in this section. Each representation representations defined in this section. Each representation
corresponds to a single header field. These representations corresponds to a single header field. These representations
reference the static table or the dynamic table in a particular reference the static table or the dynamic table in a particular
state, but do not modify that state. state, but do not modify that state.
Header blocks are carried in frames on streams defined by the Header blocks are carried in frames on streams defined by the
enclosing protocol. enclosing protocol.
4.5.1. Header Block Prefix 4.5.1. Header Block Prefix
Each header block is prefixed with two integers. The Required Insert Each header block is prefixed with two integers. The Required Insert
Count is encoded as an integer with an 8-bit prefix after the Count is encoded as an integer with an 8-bit prefix after the
encoding described in Section 4.5.1.1). The Base is encoded as sign- encoding described in Section 4.5.1.1). The Base is encoded as a
and-modulus integer, using a single sign bit and a value with a 7-bit sign bit ('S') and a Delta Base value with a 7-bit prefix (see
prefix (see Section 4.5.1.2). Section 4.5.1.2).
These two values are followed by representations for compressed
headers.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| Required Insert Count (8+) | | Required Insert Count (8+) |
+---+---------------------------+ +---+---------------------------+
| S | Delta Base (7+) | | S | Delta Base (7+) |
+---+---------------------------+ +---+---------------------------+
| Compressed Headers ... | Compressed Headers ...
+-------------------------------+ +-------------------------------+
skipping to change at page 21, line 42 skipping to change at page 21, line 39
For example, if the dynamic table is 100 bytes, then the Required For example, if the dynamic table is 100 bytes, then the Required
Insert Count will be encoded modulo 6. If a decoder has received 10 Insert Count will be encoded modulo 6. If a decoder has received 10
inserts, then an encoded value of 3 indicates that the Required inserts, then an encoded value of 3 indicates that the Required
Insert Count is 9 for the header block. Insert Count is 9 for the header block.
4.5.1.2. Base 4.5.1.2. Base
The "Base" is used to resolve references in the dynamic table as The "Base" is used to resolve references in the dynamic table as
described in Section 3.2.5. described in Section 3.2.5.
To save space, the Base is encoded relative to the Insert Count using To save space, the Base is encoded relative to the Required Insert
a one-bit sign and the "Delta Base" value. A sign bit of 0 indicates Count using a one-bit sign ('S') and the "Delta Base" value. A sign
that the Base is greater than or equal to the value of the Insert bit of 0 indicates that the Base is greater than or equal to the
Count; the value of Delta Base is added to the Insert Count to value of the Required Insert Count; the decoder adds the value of
determine the value of the Base. A sign bit of 1 indicates that the Delta Base to the Required Insert Count to determine the value of the
Base is less than the Insert Count. That is: Base. A sign bit of 1 indicates that the Base is less than the
Required Insert Count; the decoder subtracts the value of Delta Base
from the Required Insert Count and also subtracts one to determine
the value of the Base. That is:
if S == 0: if S == 0:
Base = ReqInsertCount + DeltaBase Base = ReqInsertCount + DeltaBase
else: else:
Base = ReqInsertCount - DeltaBase - 1 Base = ReqInsertCount - DeltaBase - 1
A single-pass encoder determines the Base before encoding a header A single-pass encoder determines the Base before encoding a header
block. If the encoder inserted entries in the dynamic table while block. If the encoder inserted entries in the dynamic table while
encoding the header block, Required Insert Count will be greater than encoding the header block, Required Insert Count will be greater than
the Base, so the encoded difference is negative and the sign bit is the Base, so the encoded difference is negative and the sign bit is
set to 1. If the header block did not reference the most recent set to 1. If the header block did not reference the most recent
entry in the table and did not insert any new entries, the Base will entry in the table and did not insert any new entries, the Base will
be greater than the Required Insert Count, so the delta will be be greater than the Required Insert Count, so the delta will be
positive and the sign bit is set to 0. positive and the sign bit is set to 0.
An encoder that produces table updates before encoding a header block An encoder that produces table updates before encoding a header block
might set Required Insert Count and the Base to the same value. In might set Base to the value of Required Insert Count. In such case,
such case, both the sign bit and the Delta Base will be set to zero. both the sign bit and the Delta Base will be set to zero.
A header block that does not reference the dynamic table can use any A header block that does not reference the dynamic table can use any
value for the Base; setting Delta Base to zero is the most efficient value for the Base; setting Delta Base to zero is one of the most
encoding. efficient encodings.
For example, with a Required Insert Count of 9, a decoder receives a For example, with a Required Insert Count of 9, a decoder receives an
S bit of 1 and a Delta Base of 2. This sets the Base to 6 and S bit of 1 and a Delta Base of 2. This sets the Base to 6 and
enables post-base indexing for three entries. In this example, a enables post-base indexing for three entries. In this example, a
relative index of 1 refers to the 5th entry that was added to the relative index of 1 refers to the 5th entry that was added to the
table; a post-base index of 1 refers to the 8th entry. table; a post-base index of 1 refers to the 8th entry.
4.5.2. Indexed Header Field 4.5.2. Indexed Header Field
An indexed header field representation identifies an entry in either An indexed header field representation identifies an entry in the
the static table or the dynamic table and causes that header field to static table, or an entry in the dynamic table with an absolute index
be added to the decoded header list, as described in Section 3.2 of less than the Base.
[RFC7541].
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 1 | S | Index (6+) | | 1 | T | Index (6+) |
+---+---+-----------------------+ +---+---+-----------------------+
Indexed Header Field Indexed Header Field
If the entry is in the static table, or in the dynamic table with an This representation starts with the '1' 1-bit pattern, followed by
absolute index less than the Base, this representation starts with the 'T' bit indicating whether the reference is into the static or
the '1' 1-bit pattern, followed by the "S" bit indicating whether the dynamic table. The 6-bit prefix integer (see Section 4.1.1) that
reference is into the static or dynamic table. The 6-bit prefix follows is used to locate the table entry for the header field. When
integer (see Section 4.1.1) that follows is used to locate the table T=1, the number represents the static table index; when T=0, the
entry for the header field. When S=1, the number represents the number is the relative index of the entry in the dynamic table.
static table index; when S=0, the number is the relative index of the
entry in the dynamic table.
4.5.3. Indexed Header Field With Post-Base Index 4.5.3. Indexed Header Field With Post-Base Index
If the entry is in the dynamic table with an absolute index greater An indexed header field with post-base index representation
than or equal to the Base, the representation starts with the '0001' identifies an entry in the dynamic table with an absolute index
4-bit pattern, followed by the post-base index (see Section 3.2.6) of greater than or equal to the Base.
the matching header field, represented as an integer with a 4-bit
prefix (see Section 4.1.1).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | Index (4+) | | 0 | 0 | 0 | 1 | Index (4+) |
+---+---+---+---+---------------+ +---+---+---+---+---------------+
Indexed Header Field with Post-Base Index Indexed Header Field with Post-Base Index
4.5.4. Literal Header Field With Name Reference This representation starts with the '0001' 4-bit pattern. This is
followed by the post-base index (see Section 3.2.6) of the matching
A literal header field with a name reference represents a header header field, represented as an integer with a 4-bit prefix (see
where the header field name matches the header field name of an entry Section 4.1.1).
stored in the static table or the dynamic table.
If the entry is in the static table, or in the dynamic table with an 4.5.4. Literal Header Field With Name Reference
absolute index less than the Base, this representation starts with
the '01' two-bit pattern.
The following bit, 'N', indicates whether an intermediary is A literal header field with name reference representation encodes a
permitted to add this header to the dynamic header table on header field where the header field name matches the header field
subsequent hops. When the 'N' bit is set, the encoded header MUST name of an entry in the static table, or the header field name of an
always be encoded with a literal representation. In particular, when entry in the dynamic table with an absolute index less than the Base.
a peer sends a header field that it received represented as a literal
header field with the 'N' bit set, it MUST use a literal
representation to forward this header field. This bit is intended
for protecting header field values that are not to be put at risk by
compressing them (see Section 7 for more details).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 1 | N | S |Name Index (4+)| | 0 | 1 | N | T |Name Index (4+)|
+---+---+---+---+---------------+ +---+---+---+---+---------------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
| Value String (Length bytes) | | Value String (Length bytes) |
+-------------------------------+ +-------------------------------+
Literal Header Field With Name Reference Literal Header Field With Name Reference
The fourth ("S") bit indicates whether the reference is to the static This representation starts with the '01' two-bit pattern. The
following bit, 'N', indicates whether an intermediary is permitted to
add this header to the dynamic header table on subsequent hops. When
the 'N' bit is set, the encoded header MUST always be encoded with a
literal representation. In particular, when a peer sends a header
field that it received represented as a literal header field with the
'N' bit set, it MUST use a literal representation to forward this
header field. This bit is intended for protecting header field
values that are not to be put at risk by compressing them (see
Section 7 for more details).
The fourth ('T') bit indicates whether the reference is to the static
or dynamic table. The 4-bit prefix integer (see Section 4.1.1) that or dynamic table. The 4-bit prefix integer (see Section 4.1.1) that
follows is used to locate the table entry for the header name. When follows is used to locate the table entry for the header name. When
S=1, the number represents the static table index; when S=0, the T=1, the number represents the static table index; when T=0, the
number is the relative index of the entry in the dynamic table. number is the relative index of the entry in the dynamic table.
Only the header field name is taken from the dynamic table entry; the Only the header field name is taken from the dynamic table entry; the
header field value is encoded as an 8-bit prefix string literal (see header field value is encoded as an 8-bit prefix string literal (see
Section 4.1.2). Section 4.1.2).
4.5.5. Literal Header Field With Post-Base Name Reference 4.5.5. Literal Header Field With Post-Base Name Reference
A literal header field with post-base name reference represents a A literal header field with post-base name reference representation
header field where the name matches the header field name of a encodes a header field where the header field name matches the header
dynamic table entry with an absolute index greater than or equal to field name of a dynamic table entry with an absolute index greater
the Base. than or equal to the Base.
This representation starts with the '0000' four-bit pattern. The
fifth bit is the 'N' bit as described in Section 4.5.4. This is
followed by a post-base index of the dynamic table entry (see
Section 3.2.6) encoded as an integer with a 3-bit prefix (see
Section 4.1.1).
Only the header field name is taken from the dynamic table entry; the
header field value is encoded as an 8-bit prefix string literal (see
Section 4.1.2).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | N |NameIdx(3+)| | 0 | 0 | 0 | 0 | N |NameIdx(3+)|
+---+---+---+---+---+-----------+ +---+---+---+---+---+-----------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
| Value String (Length bytes) | | Value String (Length bytes) |
+-------------------------------+ +-------------------------------+
Literal Header Field With Post-Base Name Reference Literal Header Field With Post-Base Name Reference
This representation starts with the '0000' four-bit pattern. The
fifth bit is the 'N' bit as described in Section 4.5.4. This is
followed by a post-base index of the dynamic table entry (see
Section 3.2.6) encoded as an integer with a 3-bit prefix (see
Section 4.1.1).
Only the header field name is taken from the dynamic table entry; the
header field value is encoded as an 8-bit prefix string literal (see
Section 4.1.2).
4.5.6. Literal Header Field Without Name Reference 4.5.6. Literal Header Field Without Name Reference
The literal header field without name reference representation The literal header field without name reference representation
encodes a header field name and header field value as string encodes a header field name and a header field value as string
literals. literals.
This representation begins with the '001' three-bit pattern. The
fourth bit is the 'N' bit as described in Section 4.5.4. The name
follows, represented as a 4-bit prefix string literal, then the
value, represented as an 8-bit prefix string literal (see
Section 4.1.2).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | N | H |NameLen(3+)| | 0 | 0 | 1 | N | H |NameLen(3+)|
+---+---+---+---+---+-----------+ +---+---+---+---+---+-----------+
| Name String (Length bytes) | | Name String (Length bytes) |
+---+---------------------------+ +---+---------------------------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
| Value String (Length bytes) | | Value String (Length bytes) |
+-------------------------------+ +-------------------------------+
Literal Header Field Without Name Reference Literal Header Field Without Name Reference
This representation begins with the '001' three-bit pattern. The
fourth bit is the 'N' bit as described in Section 4.5.4. The name
follows, represented as a 4-bit prefix string literal, then the
value, represented as an 8-bit prefix string literal (see
Section 4.1.2).
5. Configuration 5. Configuration
QPACK defines two settings which are included in the HTTP/3 SETTINGS QPACK defines two settings which are included in the HTTP/3 SETTINGS
frame. frame.
SETTINGS_QPACK_MAX_TABLE_CAPACITY (0x1): The default value is zero. SETTINGS_QPACK_MAX_TABLE_CAPACITY (0x1): The default value is zero.
See Section 3.2 for usage. This is the equivalent of the See Section 3.2 for usage. This is the equivalent of the
SETTINGS_HEADER_TABLE_SIZE from HTTP/2. SETTINGS_HEADER_TABLE_SIZE from HTTP/2.
SETTINGS_QPACK_BLOCKED_STREAMS (0x7): The default value is zero. SETTINGS_QPACK_BLOCKED_STREAMS (0x7): The default value is zero.
skipping to change at page 25, line 47 skipping to change at page 26, line 7
header block. header block.
HTTP_QPACK_ENCODER_STREAM_ERROR (0x201): The decoder failed to HTTP_QPACK_ENCODER_STREAM_ERROR (0x201): The decoder failed to
interpret an encoder instruction received on the encoder stream. interpret an encoder instruction received on the encoder stream.
HTTP_QPACK_DECODER_STREAM_ERROR (0x202): The encoder failed to HTTP_QPACK_DECODER_STREAM_ERROR (0x202): The encoder failed to
interpret a decoder instruction received on the decoder stream. interpret a decoder instruction received on the decoder stream.
7. Security Considerations 7. Security Considerations
TBD. TBD. Also see Section 7.1 of [RFC7541].
While the negotiated limit on the dynamic table size accounts for While the negotiated limit on the dynamic table size accounts for
much of the memory that can be consumed by a QPACK implementation, much of the memory that can be consumed by a QPACK implementation,
data which cannot be immediately sent due to flow control is not data which cannot be immediately sent due to flow control is not
affected by this limit. Implementations should limit the size of affected by this limit. Implementations should limit the size of
unsent data, especially on the decoder stream where flexibility to unsent data, especially on the decoder stream where flexibility to
choose what to send is limited. Possible responses to an excess of choose what to send is limited. Possible responses to an excess of
unsent data might include limiting the ability of the peer to open unsent data might include limiting the ability of the peer to open
new streams, reading only from the encoder stream, or closing the new streams, reading only from the encoder stream, or closing the
connection. connection.
skipping to change at page 27, line 28 skipping to change at page 27, line 34
| HTTP_QPACK_DECODER_STREAM_E | 0x202 | Error on the | Section 6 | | HTTP_QPACK_DECODER_STREAM_E | 0x202 | Error on the | Section 6 |
| RROR | | decoder | | | RROR | | decoder | |
| | | stream | | | | | stream | |
+-----------------------------+-------+--------------+--------------+ +-----------------------------+-------+--------------+--------------+
9. References 9. References
9.1. Normative References 9.1. Normative References
[HTTP3] Bishop, M., Ed., "Hypertext Transfer Protocol Version 3 [HTTP3] Bishop, M., Ed., "Hypertext Transfer Protocol Version 3
(HTTP/3)", draft-ietf-quic-http-23 (work in progress), (HTTP/3)", draft-ietf-quic-http-24 (work in progress),
September 2019. November 2019.
[QUIC-TRANSPORT] [QUIC-TRANSPORT]
Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based
Multiplexed and Secure Transport", draft-ietf-quic- Multiplexed and Secure Transport", draft-ietf-quic-
transport-23 (work in progress), September 2019. transport-24 (work in progress), November 2019.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC7541] Peon, R. and H. Ruellan, "HPACK: Header Compression for [RFC7541] Peon, R. and H. Ruellan, "HPACK: Header Compression for
HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015, HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015,
<https://www.rfc-editor.org/info/rfc7541>. <https://www.rfc-editor.org/info/rfc7541>.
skipping to change at page 35, line 10 skipping to change at page 35, line 10
encodeInteger(prefixBuffer, 0x80, encodeInteger(prefixBuffer, 0x80,
largestReference - baseIndex, 7) largestReference - baseIndex, 7)
return controlBuffer, prefixBuffer + streamBuffer return controlBuffer, prefixBuffer + streamBuffer
Appendix C. Change Log Appendix C. Change Log
*RFC Editor's Note:* Please remove this section prior to *RFC Editor's Note:* Please remove this section prior to
publication of a final version of this document. publication of a final version of this document.
C.1. Since draft-ietf-quic-qpack-09 C.1. Since draft-ietf-quic-qpack-10
Editorial changes
C.2. Since draft-ietf-quic-qpack-09
o Decoders MUST emit Header Acknowledgements (#2939) o Decoders MUST emit Header Acknowledgements (#2939)
o Updated error code for multiple encoder or decoder streams (#2970) o Updated error code for multiple encoder or decoder streams (#2970)
o Added explicit defaults for new SETTINGS (#2974) o Added explicit defaults for new SETTINGS (#2974)
C.2. Since draft-ietf-quic-qpack-08 C.3. Since draft-ietf-quic-qpack-08
o Endpoints are permitted to create encoder and decoder streams even o Endpoints are permitted to create encoder and decoder streams even
if they can't use them (#2100, #2529) if they can't use them (#2100, #2529)
o Maximum values for settings removed (#2766, #2767) o Maximum values for settings removed (#2766, #2767)
C.3. Since draft-ietf-quic-qpack-06 C.4. Since draft-ietf-quic-qpack-06
o Clarify initial dynamic table capacity maximums (#2276, #2330, o Clarify initial dynamic table capacity maximums (#2276, #2330,
#2330) #2330)
C.4. Since draft-ietf-quic-qpack-05 C.5. Since draft-ietf-quic-qpack-05
o Introduced the terms dynamic table capacity and maximum dynamic o Introduced the terms dynamic table capacity and maximum dynamic
table capacity. table capacity.
o Renamed SETTINGS_HEADER_TABLE_SIZE to o Renamed SETTINGS_HEADER_TABLE_SIZE to
SETTINGS_QPACK_MAX_TABLE_CAPACITY. SETTINGS_QPACK_MAX_TABLE_CAPACITY.
C.5. Since draft-ietf-quic-qpack-04 C.6. Since draft-ietf-quic-qpack-04
o Changed calculation of Delta Base Index to avoid an illegal value o Changed calculation of Delta Base Index to avoid an illegal value
(#2002, #2005) (#2002, #2005)
C.6. Since draft-ietf-quic-qpack-03 C.7. Since draft-ietf-quic-qpack-03
o Change HTTP settings defaults (#2038) o Change HTTP settings defaults (#2038)
o Substantial editorial reorganization o Substantial editorial reorganization
C.7. Since draft-ietf-quic-qpack-02 C.8. Since draft-ietf-quic-qpack-02
o Largest Reference encoded modulo MaxEntries (#1763) o Largest Reference encoded modulo MaxEntries (#1763)
o New Static Table (#1355) o New Static Table (#1355)
o Table Size Update with Insert Count=0 is a connection error o Table Size Update with Insert Count=0 is a connection error
(#1762) (#1762)
o Stream Cancellations are optional when o Stream Cancellations are optional when
SETTINGS_HEADER_TABLE_SIZE=0 (#1761) SETTINGS_HEADER_TABLE_SIZE=0 (#1761)
skipping to change at page 36, line 27 skipping to change at page 36, line 27
o Implementations must handle 62 bit integers (#1760) o Implementations must handle 62 bit integers (#1760)
o Different error types for each QPACK stream, other changes to o Different error types for each QPACK stream, other changes to
error handling (#1726) error handling (#1726)
o Preserve header field order (#1725) o Preserve header field order (#1725)
o Initial table size is the maximum permitted when table is first o Initial table size is the maximum permitted when table is first
usable (#1642) usable (#1642)
C.8. Since draft-ietf-quic-qpack-01 C.9. Since draft-ietf-quic-qpack-01
o Only header blocks that reference the dynamic table are o Only header blocks that reference the dynamic table are
acknowledged (#1603, #1605) acknowledged (#1603, #1605)
C.9. Since draft-ietf-quic-qpack-00 C.10. Since draft-ietf-quic-qpack-00
o Renumbered instructions for consistency (#1471, #1472) o Renumbered instructions for consistency (#1471, #1472)
o Decoder is allowed to validate largest reference (#1404, #1469) o Decoder is allowed to validate largest reference (#1404, #1469)
o Header block acknowledgments also acknowledge the associated o Header block acknowledgments also acknowledge the associated
largest reference (#1370, #1400) largest reference (#1370, #1400)
o Added an acknowledgment for unread streams (#1371, #1400) o Added an acknowledgment for unread streams (#1371, #1400)
o Removed framing from encoder stream (#1361,#1467) o Removed framing from encoder stream (#1361,#1467)
o Control streams use typed unidirectional streams rather than fixed o Control streams use typed unidirectional streams rather than fixed
stream IDs (#910,#1359) stream IDs (#910,#1359)
C.10. Since draft-ietf-quic-qcram-00 C.11. Since draft-ietf-quic-qcram-00
o Separate instruction sets for table updates and header blocks o Separate instruction sets for table updates and header blocks
(#1235, #1142, #1141) (#1235, #1142, #1141)
o Reworked indexing scheme (#1176, #1145, #1136, #1130, #1125, o Reworked indexing scheme (#1176, #1145, #1136, #1130, #1125,
#1314) #1314)
o Added mechanisms that support one-pass encoding (#1138, #1320) o Added mechanisms that support one-pass encoding (#1138, #1320)
o Added a setting to control the number of blocked decoders (#238, o Added a setting to control the number of blocked decoders (#238,
 End of changes. 76 change blocks. 
206 lines changed or deleted 210 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/