draft-ietf-quic-qpack-04.txt   draft-ietf-quic-qpack-05.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: June 7, 2019 Akamai Technologies Expires: June 21, 2019 Akamai Technologies
A. Frindell, Ed. A. Frindell, Ed.
Facebook Facebook
December 04, 2018 December 18, 2018
QPACK: Header Compression for HTTP over QUIC QPACK: Header Compression for HTTP over QUIC
draft-ietf-quic-qpack-04 draft-ietf-quic-qpack-05
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 June 7, 2019. This Internet-Draft will expire on June 21, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2018 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
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Conventions and Definitions . . . . . . . . . . . . . . . 4 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 4
1.2. Notational Conventions . . . . . . . . . . . . . . . . . 4 1.2. Notational Conventions . . . . . . . . . . . . . . . . . 5
2. Compression Process Overview . . . . . . . . . . . . . . . . 5 2. Compression Process Overview . . . . . . . . . . . . . . . . 5
2.1. Encoder . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1. Encoder . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1. Reference Tracking . . . . . . . . . . . . . . . . . 6 2.1.1. Reference Tracking . . . . . . . . . . . . . . . . . 6
2.1.2. Blocked Dynamic Table Insertions . . . . . . . . . . 6 2.1.2. Blocked Dynamic Table Insertions . . . . . . . . . . 6
2.1.3. Avoiding Head-of-Line Blocking . . . . . . . . . . . 7 2.1.3. Avoiding Head-of-Line Blocking . . . . . . . . . . . 7
2.1.4. Largest Known Received . . . . . . . . . . . . . . . 7 2.1.4. Largest Known Received . . . . . . . . . . . . . . . 8
2.2. Decoder . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2. Decoder . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1. State Synchronization . . . . . . . . . . . . . . . . 8 2.2.1. State Synchronization . . . . . . . . . . . . . . . . 8
2.2.2. Blocked Decoding . . . . . . . . . . . . . . . . . . 9 2.2.2. Blocked Decoding . . . . . . . . . . . . . . . . . . 9
3. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 9 3. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 9 3.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 9
3.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 9 3.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 9
3.2.1. Maximum Table Size . . . . . . . . . . . . . . . . . 10 3.2.1. Calculating Table Size . . . . . . . . . . . . . . . 10
3.2.2. Calculating Table Size . . . . . . . . . . . . . . . 10 3.2.2. Eviction . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3. Absolute Indexing . . . . . . . . . . . . . . . . . . 11 3.2.3. Maximum Table Size . . . . . . . . . . . . . . . . . 10
3.2.4. Relative Indexing . . . . . . . . . . . . . . . . . . 11 3.2.4. Absolute Indexing . . . . . . . . . . . . . . . . . . 11
3.2.5. Post-Base Indexing . . . . . . . . . . . . . . . . . 12 3.2.5. Relative Indexing . . . . . . . . . . . . . . . . . . 11
3.2.6. Invalid References . . . . . . . . . . . . . . . . . 12 3.2.6. Post-Base Indexing . . . . . . . . . . . . . . . . . 12
3.2.7. Invalid References . . . . . . . . . . . . . . . . . 12
4. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 13 4. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 13 4.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 13
4.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 13 4.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 13
4.1.2. String Literals . . . . . . . . . . . . . . . . . . . 13 4.1.2. String Literals . . . . . . . . . . . . . . . . . . . 13
4.2. Stream Types . . . . . . . . . . . . . . . . . . . . . . 13 4.2. Stream Types . . . . . . . . . . . . . . . . . . . . . . 13
4.3. Encoder Stream . . . . . . . . . . . . . . . . . . . . . 14 4.3. Encoder Stream . . . . . . . . . . . . . . . . . . . . . 14
4.3.1. Insert With Name Reference . . . . . . . . . . . . . 14 4.3.1. Insert With Name Reference . . . . . . . . . . . . . 14
4.3.2. Insert Without Name Reference . . . . . . . . . . . . 15 4.3.2. Insert Without Name Reference . . . . . . . . . . . . 15
4.3.3. Duplicate . . . . . . . . . . . . . . . . . . . . . . 15 4.3.3. Duplicate . . . . . . . . . . . . . . . . . . . . . . 15
4.3.4. Dynamic Table Size Update . . . . . . . . . . . . . . 16 4.3.4. Dynamic Table Size Update . . . . . . . . . . . . . . 15
4.4. Decoder Stream . . . . . . . . . . . . . . . . . . . . . 16 4.4. Decoder Stream . . . . . . . . . . . . . . . . . . . . . 16
4.4.1. Table State Synchronize . . . . . . . . . . . . . . . 16 4.4.1. Table State Synchronize . . . . . . . . . . . . . . . 16
4.4.2. Header Acknowledgement . . . . . . . . . . . . . . . 17 4.4.2. Header Acknowledgement . . . . . . . . . . . . . . . 17
4.4.3. Stream Cancellation . . . . . . . . . . . . . . . . . 18 4.4.3. Stream Cancellation . . . . . . . . . . . . . . . . . 18
4.5. Request and Push Streams . . . . . . . . . . . . . . . . 18 4.5. Request and Push Streams . . . . . . . . . . . . . . . . 18
4.5.1. Header Data Prefix . . . . . . . . . . . . . . . . . 18 4.5.1. Header Data Prefix . . . . . . . . . . . . . . . . . 18
4.5.2. Indexed Header Field . . . . . . . . . . . . . . . . 20 4.5.2. Indexed Header Field . . . . . . . . . . . . . . . . 20
4.5.3. Indexed Header Field With Post-Base Index . . . . . . 21 4.5.3. Indexed Header Field With Post-Base Index . . . . . . 21
4.5.4. Literal Header Field With Name Reference . . . . . . 21 4.5.4. Literal Header Field With Name Reference . . . . . . 21
4.5.5. Literal Header Field With Post-Base Name Reference . 22 4.5.5. Literal Header Field With Post-Base Name Reference . 22
skipping to change at page 3, line 30 skipping to change at page 3, line 30
8.1. Settings Registration . . . . . . . . . . . . . . . . . . 24 8.1. Settings Registration . . . . . . . . . . . . . . . . . . 24
8.2. Stream Type Registration . . . . . . . . . . . . . . . . 24 8.2. Stream Type Registration . . . . . . . . . . . . . . . . 24
8.3. Error Code Registration . . . . . . . . . . . . . . . . . 24 8.3. Error Code Registration . . . . . . . . . . . . . . . . . 24
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 25 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1. Normative References . . . . . . . . . . . . . . . . . . 25 9.1. Normative References . . . . . . . . . . . . . . . . . . 25
9.2. Informative References . . . . . . . . . . . . . . . . . 26 9.2. Informative References . . . . . . . . . . . . . . . . . 26
9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 26 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Appendix A. Static Table . . . . . . . . . . . . . . . . . . . . 26 Appendix A. Static Table . . . . . . . . . . . . . . . . . . . . 26
Appendix B. Sample One Pass Encoding Algorithm . . . . . . . . . 31 Appendix B. Sample One Pass Encoding Algorithm . . . . . . . . . 31
Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 33 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 33
C.1. Since draft-ietf-quic-qpack-03 . . . . . . . . . . . . . 33 C.1. Since draft-ietf-quic-qpack-04 . . . . . . . . . . . . . 33
C.2. Since draft-ietf-quic-qpack-02 . . . . . . . . . . . . . 33 C.2. Since draft-ietf-quic-qpack-03 . . . . . . . . . . . . . 33
C.3. Since draft-ietf-quic-qpack-01 . . . . . . . . . . . . . 33 C.3. Since draft-ietf-quic-qpack-02 . . . . . . . . . . . . . 33
C.4. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 33 C.4. Since draft-ietf-quic-qpack-01 . . . . . . . . . . . . . 33
C.5. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 34 C.5. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 33
C.6. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 34
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 34 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 34
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 34 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 35
1. Introduction 1. Introduction
The QUIC transport protocol was designed from the outset to support The QUIC transport protocol was designed from the outset 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. HTTP/2 uses HPACK ([RFC7541]) for header compression, but HTTP/2. HTTP/2 uses HPACK ([RFC7541]) for header compression, but
QUIC's stream multiplexing comes into some conflict with HPACK. A QUIC's stream multiplexing comes into some conflict with HPACK. A
key goal of the design of QUIC is to improve stream multiplexing key goal of the design of QUIC is to improve stream multiplexing
relative to HTTP/2 by reducing head-of-line blocking. If HPACK were relative to HTTP/2 by reducing head-of-line blocking. If HPACK were
used for HTTP/3, it would induce head-of-line blocking due to built- used for HTTP/3, it would induce head-of-line blocking due to built-
skipping to change at page 9, line 40 skipping to change at page 9, line 48
the encoder stream, this MUST be treated as a connection error of the encoder stream, this MUST be treated as a connection error of
type "HTTP_QPACK_ENCODER_STREAM_ERROR". type "HTTP_QPACK_ENCODER_STREAM_ERROR".
3.2. Dynamic Table 3.2. Dynamic Table
The dynamic table consists of a list of header fields maintained in The dynamic table consists of a list of header fields maintained in
first-in, first-out order. The dynamic table is initially empty. first-in, first-out order. The dynamic table is initially empty.
Entries are added by instructions on the encoder stream (see Entries are added by instructions on the encoder stream (see
Section 4.3). Section 4.3).
The maximum size of the dynamic table can be modified by the encoder, The dynamic table can contain duplicate entries (i.e., entries with
subject to a decoder-controlled limit (see Section 5 and the same name and same value). Therefore, duplicate entries MUST NOT
Section 4.3.4). The initial maximum size is determined by the be treated as an error by the decoder.
corresponding setting when HTTP requests or responses are first
permitted to be sent. For clients using 0-RTT data in HTTP/3, the 3.2.1. Calculating Table Size
table size is the remembered value of the setting, even if the server
later specifies a larger maximum in its SETTINGS frame. For HTTP/3 The size of the dynamic table is the sum of the size of its entries.
servers and HTTP/3 clients when 0-RTT is not attempted or is
rejected, the initial maximum table size is the value of the setting The size of an entry is the sum of its name's length in bytes (as
in the peer's SETTINGS frame. defined in Section 4.1.2), its value's length in bytes, and 32.
The size of an entry is calculated using the length of its name and
value without any Huffman encoding applied.
3.2.2. Eviction
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 (maximum size - new entry size) or until the is less than or equal to (maximum size - new entry size) or until the
table is empty. The encoder MUST NOT evict a dynamic table entry table is empty. The encoder MUST NOT evict a dynamic table entry
unless it has first been acknowledged by the decoder. unless it has first been acknowledged by the decoder.
If the size of the new entry is less than or equal to the maximum If the size of the new entry is less than or equal to the maximum
size, that entry is added to the table. It is an error to attempt to size, that entry is added to the table. It is an error to attempt to
add an entry that is larger than the maximum size; this MUST be add an entry that is larger than the maximum size; this MUST be
treated as a connection error of type treated as a connection error of type
"HTTP_QPACK_ENCODER_STREAM_ERROR". "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
if the referenced entry is evicted from the dynamic table prior to if the referenced entry is evicted from the dynamic table prior to
inserting the new entry. inserting the new entry.
The dynamic table can contain duplicate entries (i.e., entries with Whenever the maximum size for the dynamic table is reduced by the
the same name and same value). Therefore, duplicate entries MUST NOT encoder, entries are evicted from the end of the dynamic table until
be treated as an error by the decoder. the size of the dynamic table is less than or equal to the new
maximum size. This mechanism can be used to completely clear entries
3.2.1. Maximum Table Size from the dynamic table by setting a maxiumum size of 0, which can
subsequently be restored.
The encoder decides how to update the dynamic table and as such can
control how much memory is used by the dynamic table. To limit the
memory requirements of the decoder, the dynamic table size is
strictly bounded.
The decoder determines the maximum size that the encoder is permitted
to use for the dynamic table. In HTTP/3, this value is determined by
the SETTINGS_HEADER_TABLE_SIZE setting (see Section 5).
An encoder can choose to use less capacity than this maximum size
(see Section 4.3.4), but the chosen size MUST stay lower than or
equal to the maximum set by the decoder. Whenever the maximum size
for the dynamic table is reduced, entries are evicted from the end of
the dynamic table until the size of the dynamic table is less than or
equal to the maximum size.
This mechanism can be used to completely clear entries from the
dynamic table by setting a maximum size of 0, which can subsequently
be restored.
3.2.2. Calculating Table Size
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
defined in Section 4.1.2), its value's length in bytes, and 32.
The size of an entry is calculated using the length of its name and
value without any Huffman encoding applied.
"MaxEntries" is the maximum number of entries that the dynamic table 3.2.3. Maximum Table Size
can have. The smallest entry has empty name and value strings and
has the size of 32. The MaxEntries is calculated as
MaxEntries = floor( MaxTableSize / 32 ) The encoder decides how to update the dynamic table size and as such
can control how much memory is used by the dynamic table. To limit
the memory requirements of the decoder, the dynamic table size is
strictly bounded. The decoder determines the maximum size that the
encoder is permitted to set for the dynamic table. In HTTP/3, this
value is determined by the SETTINGS_HEADER_TABLE_SIZE setting (see
Section 5). The encoder MUST not set a dynamic table size that
exceeds this maximum, but it can choose to use a lower dynamic table
size (see Section 4.3.4).
MaxTableSize is the maximum size of the dynamic table as specified by The initial maximum size is determined by the corresponding setting
the decoder (see Section 3.2.1). when HTTP requests or responses are first permitted to be sent. For
clients using 0-RTT data in HTTP/3, the table size is the remembered
value of the setting, even if the server later specifies a larger
maximum in its SETTINGS frame. For HTTP/3 servers and HTTP/3 clients
when 0-RTT is not attempted or is rejected, the initial maximum table
size is the value of the setting in the peer's SETTINGS frame.
3.2.3. Absolute Indexing 3.2.4. Absolute Indexing
Each entry possesses both an absolute index which is fixed for the Each entry possesses both an absolute index which is fixed for the
lifetime of that entry and a relative index which changes based on lifetime of that entry and a relative index which changes based on
the context of the reference. The first entry inserted has an the context of the reference. The first entry inserted has an
absolute index of "1"; indices increase sequentially with each absolute index of "1"; indices increase sequentially with each
insertion. insertion.
3.2.4. Relative Indexing 3.2.5. Relative Indexing
The relative index begins at zero and increases in the opposite The relative index begins at zero and increases in the opposite
direction from the absolute index. Determining which entry has a direction from the absolute index. Determining which entry has a
relative index of "0" depends on the context of the reference. relative index of "0" depends on the context of the reference.
On the encoder stream, a relative index of "0" always refers to the On the encoder stream, a relative index of "0" always refers to the
most recently inserted value in the dynamic table. Note that this most recently inserted value in the dynamic table. Note that this
means the entry referenced by a given relative index will change means the entry referenced by a given relative index will change
while interpreting instructions on the encoder stream. while interpreting instructions on the encoder stream.
skipping to change at page 12, line 23 skipping to change at page 12, line 19
| n | n-1 | n-2 | ... | d+1 | Absolute Index | n | n-1 | n-2 | ... | d+1 | 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
Example Dynamic Table Indexing - Relative Index on Request Stream Example Dynamic Table Indexing - Relative Index on Request Stream
3.2.5. Post-Base Indexing 3.2.6. Post-Base Indexing
A header block on the request stream can reference entries added A header block on the request stream can reference entries added
after the entry identified by the Base Index. This allows an encoder after the entry identified by the Base Index. This allows an encoder
to process a header block in a single pass and include references to to process a header block in a single pass and include references to
entries added while processing this (or other) header blocks. Newly entries added while processing this (or other) header blocks. Newly
added entries are referenced using Post-Base instructions. Indices added entries are referenced using Post-Base instructions. Indices
for Post-Base instructions increase in the same direction as absolute for Post-Base instructions increase in the same direction as absolute
indices, but the zero value is one higher than the Base Index. indices, but the zero value is one higher than the Base Index.
Base Index Base Index
skipping to change at page 12, line 47 skipping to change at page 12, line 43
| n | n-1 | n-2 | ... | d+1 | Absolute Index | n | n-1 | n-2 | ... | d+1 | 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
Example Dynamic Table Indexing - Post-Base Index on Request Stream Example Dynamic Table Indexing - Post-Base Index on Request Stream
3.2.6. Invalid References 3.2.7. Invalid References
If the decoder encounters a reference on a request or push stream to If the decoder encounters a reference on a request or push stream to
a dynamic table entry which has already been evicted or which has an a dynamic table entry which has already been evicted or which has an
absolute index greater than the declared Largest Reference (see absolute index greater than the declared Largest Reference (see
Section 4.5.1), it MUST treat this as a stream error of type Section 4.5.1), it MUST treat this as a stream error of type
"HTTP_QPACK_DECOMPRESSION_FAILED". "HTTP_QPACK_DECOMPRESSION_FAILED".
If the decoder encounters a reference on the encoder stream to a If the decoder encounters a reference on the encoder stream to a
dynamic table entry which has already been dropped, it MUST treat dynamic table entry which has already been dropped, it MUST treat
this as a connection error of type "HTTP_QPACK_ENCODER_STREAM_ERROR". this as a connection error of type "HTTP_QPACK_ENCODER_STREAM_ERROR".
skipping to change at page 16, line 23 skipping to change at page 16, line 13
with a 5-bit prefix (see Section 5.1 of [RFC7541]). with a 5-bit prefix (see Section 5.1 of [RFC7541]).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | Max size (5+) | | 0 | 0 | 1 | Max size (5+) |
+---+---+---+-------------------+ +---+---+---+-------------------+
Figure 3: Maximum Dynamic Table Size Change Figure 3: Maximum Dynamic Table Size Change
The new maximum size MUST be lower than or equal to the limit The new maximum size MUST be lower than or equal to the limit
determined by the protocol using QPACK. A value that exceeds this described in Section 3.2.3. In HTTP/3, this limit is the value of
limit MUST be treated as a connection error of type the SETTINGS_HEADER_TABLE_SIZE parameter (see Section 5) received
"HTTP_QPACK_ENCODER_STREAM_ERROR". In HTTP/3, this limit is the from the decoder. The decoder MUST treat a value that exceeds this
value of the SETTINGS_HEADER_TABLE_SIZE parameter (see Section 5) limit as a connection error of type
received from the decoder. "HTTP_QPACK_ENCODER_STREAM_ERROR".
Reducing the maximum size of the dynamic table can cause entries to Reducing the maximum size of the dynamic table can cause entries to
be evicted (see Section 4.3 of [RFC7541]). This MUST NOT cause the be evicted (see Section 4.3 of [RFC7541]). This MUST NOT cause the
eviction of entries with outstanding references (see Section 2.1.1). eviction of entries with outstanding references (see Section 2.1.1).
Changing the size of the dynamic table is not acknowledged as this Changing the size of the dynamic table is not acknowledged as this
instruction does not insert an entry. instruction does not insert an entry.
4.4. Decoder Stream 4.4. Decoder Stream
The decoder stream carries information used to ensure consistency of The decoder stream carries information used to ensure consistency of
skipping to change at page 18, line 35 skipping to change at page 18, line 28
Figure 6: Stream Cancellation Figure 6: Stream Cancellation
A stream that is reset might have multiple outstanding header blocks A stream that is reset might have multiple outstanding header blocks
with dynamic table references. When an endpoint receives a stream with dynamic table references. When an endpoint receives a stream
reset before the end of a stream, it generates a Stream Cancellation reset before the end of a stream, it generates a Stream Cancellation
instruction on the decoder stream. Similarly, when an endpoint instruction on the decoder stream. Similarly, when an endpoint
abandons reading of a stream it needs to signal this using the Stream abandons reading of a stream it needs to signal this using the Stream
Cancellation instruction. This signals to the encoder that all Cancellation instruction. This signals to the encoder that all
references to the dynamic table on that stream are no longer references to the dynamic table on that stream are no longer
outstanding. A decoder with a maximum dynamic table size equal to outstanding. A decoder with a maximum dynamic table size equal to
zero MAY omit sending Stream Cancellations, because the encoder zero (see Section 3.2.3) MAY omit sending Stream Cancellations,
cannot have any dynamic table references. because the encoder cannot have any dynamic table references.
An encoder cannot infer from this instruction that any updates to the An encoder cannot infer from this instruction that any updates to the
dynamic table have been received. dynamic table have been received.
4.5. Request and Push Streams 4.5. Request and Push Streams
HEADERS and PUSH_PROMISE frames on request and push streams reference HEADERS and PUSH_PROMISE frames on request and push streams reference
the dynamic table in a particular state without modifying it. Frames the dynamic table in a particular state without modifying it. Frames
on these streams emit the headers for an HTTP request or response. on these streams emit the headers for an HTTP request or response.
skipping to change at page 19, line 26 skipping to change at page 19, line 26
4.5.1.1. Largest Reference 4.5.1.1. Largest Reference
"Largest Reference" identifies the largest absolute dynamic index "Largest Reference" identifies the largest absolute dynamic index
referenced in the block. Blocking decoders use the Largest Reference referenced in the block. Blocking decoders use the Largest Reference
to determine when it is safe to process the rest of the block. If to determine when it is safe to process the rest of the block. If
Largest Reference is greater than zero, the encoder transforms it as Largest Reference is greater than zero, the encoder transforms it as
follows before encoding: follows before encoding:
LargestReference = (LargestReference mod (2 * MaxEntries)) + 1 LargestReference = (LargestReference mod (2 * MaxEntries)) + 1
Here "MaxEntries" is the maximum number of entries that the dynamic
table can have. The smallest entry has empty name and value strings
and has the size of 32. Hence "MaxEntries" is calculated as
MaxEntries = floor( MaxTableSize / 32 )
"MaxTableSize" is the maximum size of the dynamic table as specified
by the decoder (see Section 3.2.3).
The decoder reconstructs the Largest Reference using the following The decoder reconstructs the Largest Reference using the following
algorithm: algorithm:
if LargestReference > 0: if LargestReference > 0:
LargestReference -= 1 LargestReference -= 1
CurrentWrapped = TotalNumberOfInserts mod (2 * MaxEntries) CurrentWrapped = TotalNumberOfInserts mod (2 * MaxEntries)
if CurrentWrapped >= LargestReference + MaxEntries: if CurrentWrapped >= LargestReference + MaxEntries:
# Largest Reference wrapped around 1 extra time # Largest Reference wrapped around 1 extra time
LargestReference += 2 * MaxEntries LargestReference += 2 * MaxEntries
skipping to change at page 19, line 49 skipping to change at page 20, line 12
LargestReference += TotalNumberOfInserts - CurrentWrapped LargestReference += TotalNumberOfInserts - CurrentWrapped
TotalNumberOfInserts is the total number of inserts into the TotalNumberOfInserts is the total number of inserts into the
decoder's dynamic table. This encoding limits the length of the decoder's dynamic table. This encoding limits the length of the
prefix on long-lived connections. prefix on long-lived connections.
4.5.1.2. Base Index 4.5.1.2. Base Index
"Base Index" is used to resolve references in the dynamic table as "Base Index" is used to resolve references in the dynamic table as
described in Section 3.2.4. described in Section 3.2.5.
To save space, Base Index is encoded relative to Largest Reference To save space, Base Index is encoded relative to Largest Reference
using a one-bit sign and the "Delta Base Index" value. A sign bit of using a one-bit sign and the "Delta Base Index" value. A sign bit of
0 indicates that the Base Index has an absolute index that is greater 0 indicates that the Base Index has an absolute index that is greater
than or equal to the Largest Reference; the value of Delta Base Index than or equal to the Largest Reference; the value of Delta Base Index
is added to the Largest Reference to determine the absolute value of is added to the Largest Reference to determine the absolute value of
the Base Index. A sign bit of 1 indicates that the Base Index is the Base Index. A sign bit of 1 indicates that the Base Index is
less than the Largest Reference. That is: less than the Largest Reference. That is:
if sign == 0: if sign == 0:
baseIndex = largestReference + deltaBaseIndex baseIndex = largestReference + deltaBaseIndex
else: else:
baseIndex = largestReference - deltaBaseIndex baseIndex = largestReference - deltaBaseIndex - 1
A single-pass encoder determines the absolute value of Base Index A single-pass encoder determines the absolute value of Base Index
before encoding a header block. If the encoder inserted entries in before encoding a header block. If the encoder inserted entries in
the dynamic table while encoding the header block, Largest Reference the dynamic table while encoding the header block, Largest Reference
will be greater than Base Index, so the encoded difference is will be greater than Base Index, so the encoded difference is
negative and the sign bit is set to 1. If the header block did not negative and the sign bit is set to 1. If the header block did not
reference the most recent entry in the table and did not insert any reference the most recent entry in the table and did not insert any
new entries, Base Index will be greater than the Largest Reference, new entries, Base Index will be greater than the Largest Reference,
so the delta will be positive and the sign bit is set to 0. so the delta will be 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 Largest Reference and Base Index to the same value. When might set Largest Reference and Base Index to the same value. In
Largest Reference and Base Index are equal, the Delta Base Index is such case, both the sign bit and the Delta Base Index will be set to
encoded with a zero sign bit. A sign bit set to 1 when the Delta zero.
Base Index is 0 MUST be treated as a decoder error.
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 Base Index; setting both Largest Reference and Base Index value for Base Index; setting both Largest Reference and Base Index
to zero is the most efficient encoding. to zero is the most efficient encoding.
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 either
the static table or the dynamic table and causes that header field to the static table or the dynamic table and causes that header field to
be added to the decoded header list, as described in Section 3.2 of be added to the decoded header list, as described in Section 3.2 of
skipping to change at page 21, line 12 skipping to change at page 21, line 24
starts with the '1' 1-bit pattern, followed by the "S" bit indicating starts with the '1' 1-bit pattern, followed by the "S" bit indicating
whether the reference is into the static (S=1) or dynamic (S=0) whether the reference is into the static (S=1) or dynamic (S=0)
table. Finally, the relative index of the matching header field is table. Finally, the relative index of the matching header field is
represented as an integer with a 6-bit prefix (see Section 5.1 of represented as an integer with a 6-bit prefix (see Section 5.1 of
[RFC7541]). [RFC7541]).
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 If the entry is in the dynamic table with an absolute index greater
than Base Index, the representation starts with the '0001' 4-bit than Base Index, the representation starts with the '0001' 4-bit
pattern, followed by the post-base index (see Section 3.2.5) of the pattern, followed by the post-base index (see Section 3.2.6) of the
matching header field, represented as an integer with a 4-bit prefix matching header field, represented as an integer with a 4-bit prefix
(see Section 5.1 of [RFC7541]). (see Section 5.1 of [RFC7541]).
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
skipping to change at page 22, line 27 skipping to change at page 22, line 30
absolute index less than or equal to Base Index, the header field absolute index less than or equal to Base Index, the header field
name is represented using the relative index of that entry, which is name is represented using the relative index of that entry, which is
represented as an integer with a 4-bit prefix (see Section 5.1 of represented as an integer with a 4-bit prefix (see Section 5.1 of
[RFC7541]). The "S" bit indicates whether the reference is to the [RFC7541]). The "S" bit indicates whether the reference is to the
static (S=1) or dynamic (S=0) table. static (S=1) or dynamic (S=0) table.
4.5.5. Literal Header Field With Post-Base Name Reference 4.5.5. Literal Header Field With Post-Base Name Reference
For entries in the dynamic table with an absolute index greater than For entries in the dynamic table with an absolute index greater than
Base Index, the header field name is represented using the post-base Base Index, the header field name is represented using the post-base
index of that entry (see Section 3.2.5) encoded as an integer with a index of that entry (see Section 3.2.6) encoded as an integer with a
3-bit prefix. 3-bit prefix.
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) |
+-------------------------------+ +-------------------------------+
skipping to change at page 25, line 28 skipping to change at page 25, line 28
| HTTP_QPACK_DECODER_STREAM_ER | TBD | Error on the | Section 6 | | HTTP_QPACK_DECODER_STREAM_ER | TBD | Error on the | Section 6 |
| ROR | | decoder | | | ROR | | 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-16 (work in progress), (HTTP/3)", draft-ietf-quic-http-17 (work in progress),
December 2018. December 2018.
[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-16 (work in progress), December 2018. transport-16 (work in progress), December 2018.
[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,
skipping to change at page 33, line 10 skipping to change at page 33, 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-03 C.1. Since draft-ietf-quic-qpack-04
Substantial editorial reorganization; no technical changes. o Changed calculation of Delta Base Index to avoid an illegal value
(#2002, #2005)
C.2. Since draft-ietf-quic-qpack-02 C.2. Since draft-ietf-quic-qpack-03
o Change HTTP settings defaults (#2038)
o Substantial editorial reorganization
C.3. 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 33, line 36 skipping to change at page 33, line 43
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.3. Since draft-ietf-quic-qpack-01 C.4. 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.4. Since draft-ietf-quic-qpack-00 C.5. 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.5. Since draft-ietf-quic-qcram-00 C.6. 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. 36 change blocks. 
98 lines changed or deleted 101 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/