draft-ietf-quic-qpack-01.txt   draft-ietf-quic-qpack-02.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: December 30, 2018 Akamai Technologies Expires: February 16, 2019 Akamai Technologies
A. Frindell, Ed. A. Frindell, Ed.
Facebook Facebook
June 28, 2018 August 15, 2018
QPACK: Header Compression for HTTP over QUIC QPACK: Header Compression for HTTP over QUIC
draft-ietf-quic-qpack-01 draft-ietf-quic-qpack-02
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 over efficiently representing HTTP header fields, to be used in HTTP over
QUIC. This is a variation of HPACK header compression that seeks to QUIC. This is a variation of HPACK header compression that seeks to
reduce head-of-line blocking. reduce 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 December 30, 2018. This Internet-Draft will expire on February 16, 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
2. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Header Tables . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 4 2.1. Static Table . . . . . . . . . . . . . . . . . . . . . . 4
2.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 4 2.2. Dynamic Table . . . . . . . . . . . . . . . . . . . . . . 4
2.2.1. Absolute and Relative Indexing . . . . . . . . . . . 5 2.2.1. Absolute and Relative Indexing . . . . . . . . . . . 5
2.2.2. Post-Base Indexing . . . . . . . . . . . . . . . . . 6 2.2.2. Post-Base Indexing . . . . . . . . . . . . . . . . . 6
2.3. Avoiding Head-of-Line Blocking in HTTP/QUIC . . . . . . . 7 2.3. Avoiding Head-of-Line Blocking in HTTP/QUIC . . . . . . . 7
2.3.1. State Synchronization . . . . . . . . . . . . . . . . 8 2.3.1. State Synchronization . . . . . . . . . . . . . . . . 8
3. Conventions and Definitions . . . . . . . . . . . . . . . . . 8 3. Conventions and Definitions . . . . . . . . . . . . . . . . . 9
3.1. Notational Conventions . . . . . . . . . . . . . . . . . 9 3.1. Notational Conventions . . . . . . . . . . . . . . . . . 9
4. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 9 4. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 9
5. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 9 5. Wire Format . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 10 5.1. Primitives . . . . . . . . . . . . . . . . . . . . . . . 10
5.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 10 5.1.1. Prefixed Integers . . . . . . . . . . . . . . . . . . 10
5.1.2. String Literals . . . . . . . . . . . . . . . . . . . 10 5.1.2. String Literals . . . . . . . . . . . . . . . . . . . 10
5.2. QPACK Encoder Stream . . . . . . . . . . . . . . . . . . 11 5.2. QPACK Encoder Stream . . . . . . . . . . . . . . . . . . 11
5.2.1. Insert With Name Reference . . . . . . . . . . . . . 11 5.2.1. Insert With Name Reference . . . . . . . . . . . . . 11
5.2.2. Insert Without Name Reference . . . . . . . . . . . . 11 5.2.2. Insert Without Name Reference . . . . . . . . . . . . 12
5.2.3. Duplicate . . . . . . . . . . . . . . . . . . . . . . 12 5.2.3. Duplicate . . . . . . . . . . . . . . . . . . . . . . 12
5.2.4. Dynamic Table Size Update . . . . . . . . . . . . . . 12 5.2.4. Dynamic Table Size Update . . . . . . . . . . . . . . 13
5.3. QPACK Decoder Stream . . . . . . . . . . . . . . . . . . 13 5.3. QPACK Decoder Stream . . . . . . . . . . . . . . . . . . 13
5.3.1. Table State Synchronize . . . . . . . . . . . . . . . 13 5.3.1. Table State Synchronize . . . . . . . . . . . . . . . 13
5.3.2. Header Acknowledgement . . . . . . . . . . . . . . . 14 5.3.2. Header Acknowledgement . . . . . . . . . . . . . . . 14
5.3.3. Stream Cancellation . . . . . . . . . . . . . . . . . 14 5.3.3. Stream Cancellation . . . . . . . . . . . . . . . . . 15
5.4. Request and Push Streams . . . . . . . . . . . . . . . . 15 5.4. Request and Push Streams . . . . . . . . . . . . . . . . 15
5.4.1. Header Data Prefix . . . . . . . . . . . . . . . . . 15 5.4.1. Header Data Prefix . . . . . . . . . . . . . . . . . 15
5.4.2. Instructions . . . . . . . . . . . . . . . . . . . . 16 5.4.2. Instructions . . . . . . . . . . . . . . . . . . . . 17
6. Encoding Strategies . . . . . . . . . . . . . . . . . . . . . 19 6. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 19
6.1. Single Pass Encoding . . . . . . . . . . . . . . . . . . 19 7. Encoding Strategies . . . . . . . . . . . . . . . . . . . . . 20
6.2. Preventing Eviction Races . . . . . . . . . . . . . . . . 19 7.1. Single Pass Encoding . . . . . . . . . . . . . . . . . . 20
6.3. Reference Tracking . . . . . . . . . . . . . . . . . . . 19 7.2. Preventing Eviction Races . . . . . . . . . . . . . . . . 20
6.3.1. Blocked Eviction . . . . . . . . . . . . . . . . . . 20 7.3. Reference Tracking . . . . . . . . . . . . . . . . . . . 20
6.3.2. Blocked Decoding . . . . . . . . . . . . . . . . . . 20 7.3.1. Blocked Eviction . . . . . . . . . . . . . . . . . . 20
6.4. Speculative table updates . . . . . . . . . . . . . . . . 20 7.3.2. Blocked Decoding . . . . . . . . . . . . . . . . . . 21
6.5. Sample One Pass Encoding Algorithm . . . . . . . . . . . 20 7.4. Speculative table updates . . . . . . . . . . . . . . . . 21
7. Security Considerations . . . . . . . . . . . . . . . . . . . 22 7.5. Sample One Pass Encoding Algorithm . . . . . . . . . . . 21
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22 8. Security Considerations . . . . . . . . . . . . . . . . . . . 23
8.1. Settings Registration . . . . . . . . . . . . . . . . . . 22 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23
8.2. Stream Type Registration . . . . . . . . . . . . . . . . 22 9.1. Settings Registration . . . . . . . . . . . . . . . . . . 23
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 9.2. Stream Type Registration . . . . . . . . . . . . . . . . 23
9.1. Normative References . . . . . . . . . . . . . . . . . . 22 9.3. Error Code Registration . . . . . . . . . . . . . . . . . 23
9.2. Informative References . . . . . . . . . . . . . . . . . 23 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 23 10.1. Normative References . . . . . . . . . . . . . . . . . . 24
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 23 10.2. Informative References . . . . . . . . . . . . . . . . . 24
A.1. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 23 10.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 24
A.2. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 24 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 25
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 24 A.1. Since draft-ietf-quic-qpack-01 . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 A.2. Since draft-ietf-quic-qpack-00 . . . . . . . . . . . . . 25
A.3. Since draft-ietf-quic-qcram-00 . . . . . . . . . . . . . 25
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26
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 used 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/QUIC, it would induce head-of-line blocking due to used for HTTP/QUIC, it would induce head-of-line blocking due to
built-in assumptions of a total ordering across frames on all built-in assumptions of a total ordering across frames on all
streams. streams.
QUIC is described in [QUIC-TRANSPORT]. The HTTP/QUIC mapping is QUIC is described in [QUIC-TRANSPORT]. The HTTP/QUIC mapping is
described in [QUIC-HTTP]. For a full description of HTTP/2, see described in [QUIC-HTTP]. For a full description of HTTP/2, see
[RFC7540]. The description of HPACK is [RFC7541], with important [RFC7540]. The description of HPACK is [RFC7541].
terminology in Section 1.3.
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
conditions. conditions.
2. Header Tables 2. Header Tables
skipping to change at page 4, line 25 skipping to change at page 4, line 30
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 of [RFC7541]. Note that because HPACK did not defined in Appendix A of [RFC7541]. Note that because HPACK did not
use zero-based references, there is no value at index zero of the use zero-based references, there is no value at index zero of the
static table. static table.
2.2. Dynamic Table 2.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 5.2). Section 5.2).
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. table is empty.
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
skipping to change at page 5, line 7 skipping to change at page 5, line 12
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 a decoder. be treated as an error by a decoder.
The encoder decides how to update the dynamic table and as such can 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 control how much memory is used by the dynamic table. To limit the
memory requirements of the decoder, the dynamic table size is memory requirements of the decoder, the dynamic table size is
strictly bounded. strictly bounded.
The decoder determines the maximum size that the encoder is permitted The decoder determines the maximum size that the encoder is permitted
to use for the dynamic table. In HTTP/QUIC, this value is determined to use for the dynamic table. In HTTP/QUIC, this value is determined
by the SETTINGS_HEADER_TABLE_SIZE setting (see Section 4.2.5.2 of by the SETTINGS_HEADER_TABLE_SIZE setting (see Section 4).
[QUIC-HTTP]).
An encoder can choose to use less capacity than this maximum size An encoder can choose to use less capacity than this maximum size
(see Section 5.2.4), but the chosen size MUST stay lower than or (see Section 5.2.4), but the chosen size MUST stay lower than or
equal to the maximum set by the decoder. Whenever the maximum size 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 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 the dynamic table until the size of the dynamic table is less than or
equal to the maximum size. equal to the maximum size.
This mechanism can be used to completely clear entries from the This mechanism can be used to completely clear entries from the
dynamic table by setting a maximum size of 0, which can subsequently dynamic table by setting a maximum size of 0, which can subsequently
skipping to change at page 5, line 33 skipping to change at page 5, line 37
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 over time lifetime of that entry and a relative index which changes over time
based on the context of the reference. The first entry inserted has based on the context of the reference. The first entry inserted has
an absolute index of "1"; indices increase sequentially with each an absolute index of "1"; indices increase sequentially with each
insertion. insertion.
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 control 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.
+---+---------------+-----------+ +---+---------------+-----------+
| n | ... | d + 1 | Absolute Index | n | ... | d + 1 | 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 - Control Stream Example Dynamic Table Indexing - Control Stream
Because frames from request streams can be delivered out of order Because frames from request streams can be delivered out of order
with instructions on the control stream, relative indices are with instructions on the encoder stream, relative indices are
relative to the Base Index at the beginning of the header block (see relative to the Base Index at the beginning of the header block (see
Section 5.4.1). The Base Index is an absolute index. When Section 5.4.1). The Base Index is an absolute index. When
interpreting the rest of the frame, the entry identified by Base interpreting the rest of the frame, the entry identified by Base
Index has a relative index of zero. The relative indices of entries Index has a relative index of zero. The relative indices of entries
do not change while interpreting headers on a request or push stream. do not change while interpreting headers on a request or push stream.
Base Index Base Index
| |
V V
+---+-----+-----+-----+-------+ +---+-----+-----+-----+-------+
skipping to change at page 7, line 6 skipping to change at page 7, line 23
n = count of entries inserted n = count of entries inserted
d = count of entries dropped d = count of entries dropped
Dynamic Table Indexing - Post-Base References Dynamic Table Indexing - Post-Base References
If the decoder encounters a reference to an entry which has already If the decoder encounters a reference to an entry which has already
been dropped from the table or which is greater than the declared been dropped from the table or which is greater than the declared
Largest Reference (see Section 5.4.1), this MUST be treated as a Largest Reference (see Section 5.4.1), this MUST be treated as a
stream error of type "HTTP_QPACK_DECOMPRESSION_FAILED" error code. stream error of type "HTTP_QPACK_DECOMPRESSION_FAILED" error code.
If this reference occurs on the control stream, this MUST be treated If this reference occurs on the encoder stream, this MUST be treated
as a session error. as a session error.
2.3. Avoiding Head-of-Line Blocking in HTTP/QUIC 2.3. Avoiding Head-of-Line Blocking in HTTP/QUIC
Because QUIC does not guarantee order between data on different Because QUIC does not guarantee order between data on different
streams, a header block might reference an entry in the dynamic table streams, a header block might reference an entry in the dynamic table
that has not yet been received. that has not yet been received.
Each header block contains a Largest Reference which identifies the Each header block contains a Largest Reference which identifies the
table state necessary for decoding. If the greatest absolute index table state necessary for decoding. If the greatest absolute index
skipping to change at page 8, line 10 skipping to change at page 8, line 24
Note that the decoder might not actually become blocked on every Note that the decoder might not actually become blocked on every
stream which risks becoming blocked. If the decoder encounters more stream which risks becoming blocked. If the decoder encounters more
blocked streams than it promised to support, it SHOULD treat this as blocked streams than it promised to support, it SHOULD treat this as
a stream error of type HTTP_QPACK_DECOMPRESSION_FAILED. a stream error of type HTTP_QPACK_DECOMPRESSION_FAILED.
2.3.1. State Synchronization 2.3.1. State Synchronization
The decoder stream signals key events at the decoder that permit the The decoder stream signals key events at the decoder that permit the
encoder to track the decoder's state. These events are: encoder to track the decoder's state. These events are:
o Successful processing of a header block o Complete processing of a header block
o Abandonment of a stream which might have remaining header blocks o Abandonment of a stream which might have remaining header blocks
o Receipt of new dynamic table entries o Receipt of new dynamic table entries
Regardless of whether a header block contained blocking references, Regardless of whether a header block contained blocking references,
the knowledge that it was processed successfully permits the encoder the knowledge that it has been processed permits the encoder to evict
to avoid evicting entries while references remain outstanding; see entries to which no unacknowledged references remain; see
Section 6.3.1. When a stream is reset or abandoned, the indication Section 7.3.1. When a stream is reset or abandoned, the indication
that these header blocks will never be processed serves a similar that these header blocks will never be processed serves a similar
function; see Section 5.3.3. function; see Section 5.3.3.
For the encoder to identify which dynamic table entries can be safely For the encoder to identify which dynamic table entries can be safely
used without a stream becoming blocked, the encoder tracks the used without a stream becoming blocked, the encoder tracks the
absolute index of the decoder's Largest Known Received entry. absolute index of the decoder's Largest Known Received entry.
When blocking references are permitted, the encoder uses When blocking references are permitted, the encoder uses
acknowledgement of header blocks to identify the Largest Known acknowledgement of header blocks to identify the Largest Known
Received index, as described in Section 5.3.2. Received index, as described in Section 5.3.2.
skipping to change at page 9, line 32 skipping to change at page 9, line 49
x ... Indicates that x is variable-length and extends to the end of x ... Indicates that x is variable-length and extends to the end of
the region. the region.
4. Configuration 4. Configuration
QPACK defines two settings which are included in the HTTP/QUIC QPACK defines two settings which are included in the HTTP/QUIC
SETTINGS frame. SETTINGS frame.
SETTINGS_HEADER_TABLE_SIZE (0x1): An integer with a maximum value of SETTINGS_HEADER_TABLE_SIZE (0x1): An integer with a maximum value of
2^30 - 1. The default value is 4,096 bytes. See (TODO: reference 2^30 - 1. The default value is 4,096 bytes. See Section 2.2 for
PR#1357) for usage. usage.
SETTINGS_QPACK_BLOCKED_STREAMS (0x7): An integer with a maximum SETTINGS_QPACK_BLOCKED_STREAMS (0x7): An integer with a maximum
value of 2^16 - 1. The default value is 100. See Section 2.3. value of 2^16 - 1. The default value is 100. See Section 2.3.
5. Wire Format 5. Wire Format
QPACK instructions occur in three locations, each of which uses a QPACK instructions occur in three locations, each of which uses a
separate instruction space: separate instruction space:
o The encoder stream is a unidirectional stream of type "0x48" o The encoder stream is a unidirectional stream of type "0x48"
skipping to change at page 11, line 23 skipping to change at page 11, line 37
The contents of the encoder stream are an unframed sequence of the The contents of the encoder stream are an unframed sequence of the
following instructions. following instructions.
5.2.1. Insert With Name Reference 5.2.1. Insert With Name Reference
An addition to the header table where the header field name matches An addition to the header table where the header field name matches
the header field name of an entry stored in the static table or the the header field name of an entry stored in the static table or the
dynamic table starts with the '1' one-bit pattern. The "S" bit dynamic table starts with the '1' one-bit pattern. The "S" bit
indicates whether the reference is to the static (S=1) or dynamic indicates whether the reference is to the static (S=1) or dynamic
(S=0) table. The header field name is represented using the relative (S=0) table. The 6-bit prefix integer (see Section 5.1 of [RFC7541])
index of that entry, which is represented as an integer with a 6-bit that follows is used to locate the table entry for the header name.
prefix (see Section 5.1 of [RFC7541]). When S=1, the number represents the static table index; when S=0, the
number is the relative index of the 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 5.2 of [RFC7541]). represented as a string literal (see Section 5.2 of [RFC7541]).
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 1 | S | Name Index (6+) | | 1 | S | Name Index (6+) |
+---+---+-----------------------+ +---+---+-----------------------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
skipping to change at page 13, line 10 skipping to change at page 13, line 30
Figure 2: Maximum Dynamic Table Size Change Figure 2: 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 determined by the protocol using QPACK. A value that exceeds this
limit MUST be treated as a decoding error. In HTTP/QUIC, this limit limit MUST be treated as a decoding error. In HTTP/QUIC, this limit
is the value of the SETTINGS_HEADER_TABLE_SIZE parameter (see is the value of the SETTINGS_HEADER_TABLE_SIZE parameter (see
Section 4) received from the decoder. Section 4) received from the decoder.
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 6.3). eviction of entries with outstanding references (see Section 7.3).
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.
5.3. QPACK Decoder Stream 5.3. QPACK Decoder Stream
The decoder stream carries information used to ensure consistency of The decoder stream carries information used to ensure consistency of
the dynamic table. Information is sent from the QPACK decoder to the the dynamic table. Information is sent from the QPACK decoder to the
QPACK encoder; that is, the server informs the client about the QPACK encoder; that is, the server informs the client about the
processing of the client's header blocks and table updates, and the processing of the client's header blocks and table updates, and the
client informs the server about the processing of the server's header client informs the server about the processing of the server's header
skipping to change at page 14, line 7 skipping to change at page 14, line 27
table entry will provide the most timely feedback to the encoder, but table entry will provide the most timely feedback to the encoder, but
could be redundant with other decoder feedback. By delaying a could be redundant with other decoder feedback. By delaying a
Table State Synchronize, a decoder might be able to coalesce multiple Table State Synchronize, a decoder might be able to coalesce multiple
Table State Synchronize instructions, or replace them entirely with Table State Synchronize instructions, or replace them entirely with
Header Acknowledgements. However, delaying too long may lead to Header Acknowledgements. However, delaying too long may lead to
compression inefficiencies if the encoder waits for an entry to be compression inefficiencies if the encoder waits for an entry to be
acknowledged before using it. acknowledged before using it.
5.3.2. Header Acknowledgement 5.3.2. Header Acknowledgement
After processing a header block on a request or push stream, the After processing a header block whose declared Largest Reference is
decoder emits a Header Acknowledgement instruction on the decoder not zero, the decoder emits a Header Acknowledgement instruction on
stream. The instruction begins with the '1' one-bit pattern and the decoder stream. The instruction begins with the '1' one-bit
includes the request stream's stream ID, encoded as a 7-bit prefix pattern and includes the request stream's stream ID, encoded as a
integer. It is used by the peer's QPACK encoder to know when it is 7-bit prefix integer. It is used by the peer's QPACK encoder to know
safe to evict an entry. when it is safe to evict an entry.
The same Stream ID can be identified multiple times, as multiple The same Stream ID can be identified multiple times, as multiple
header blocks can be sent on a single stream in the case of header blocks can be sent on a single stream in the case of
intermediate responses, trailers, and pushed requests. Since header intermediate responses, trailers, and pushed requests. Since header
frames on each stream are received and processed in order, this gives frames on each stream are received and processed in order, this gives
the encoder precise feedback on which header blocks within a stream the encoder precise feedback on which header blocks within a stream
have been fully processed. have been fully processed.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
skipping to change at page 17, line 9 skipping to change at page 17, line 37
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]).
5.4.2.2. Indexed Header Field With Post-Base Index 5.4.2.2. 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 2.2.1) of the pattern, followed by the post-base index (see Section 2.2.2) 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 18, line 16 skipping to change at page 18, line 43
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.
5.4.2.4. Literal Header Field With Post-Base Name Reference 5.4.2.4. 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 2.2.1) encoded as an integer with a index of that entry (see Section 2.2.2) 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 octets) | | Value String (Length octets) |
+-------------------------------+ +-------------------------------+
skipping to change at page 19, line 18 skipping to change at page 19, line 48
+---+---+---+---+---+-----------+ +---+---+---+---+---+-----------+
| Name String (Length octets) | | Name String (Length octets) |
+---+---------------------------+ +---+---------------------------+
| H | Value Length (7+) | | H | Value Length (7+) |
+---+---------------------------+ +---+---------------------------+
| Value String (Length octets) | | Value String (Length octets) |
+-------------------------------+ +-------------------------------+
Literal Header Field Without Name Reference Literal Header Field Without Name Reference
6. Encoding Strategies 6. Error Handling
6.1. Single Pass Encoding The following error code is defined for HTTP/QUIC to indicate all
failures of QPACK which prevent the stream or connection from
continuing:
HTTP_QPACK_DECOMPRESSION_FAILED (0x06): QPACK failed to decompress a
frame and cannot continue.
7. Encoding Strategies
7.1. Single Pass Encoding
An encoder making a single pass over a list of headers must choose An encoder making a single pass over a list of headers must choose
Base Index before knowing Largest Reference. When trying to Base Index before knowing Largest Reference. When trying to
reference a header inserted to the table after encoding has begun, reference a header inserted to the table after encoding has begun,
the entry is encoded with different instructions that tell the the entry is encoded with different instructions that tell the
decoder to use an absolute index greater than the Base Index. decoder to use an absolute index greater than the Base Index.
6.2. Preventing Eviction Races 7.2. Preventing Eviction Races
Due to out-of-order arrival, QPACK's eviction algorithm requires Due to out-of-order arrival, QPACK's eviction algorithm requires
changes (relative to HPACK) to avoid the possibility that an indexed changes (relative to HPACK) to avoid the possibility that an indexed
representation is decoded after the referenced entry has already been representation is decoded after the referenced entry has already been
evicted. QPACK employs a two-phase eviction algorithm, in which the evicted. QPACK employs a two-phase eviction algorithm, in which the
encoder will not evict entries that have outstanding (unacknowledged) encoder will not evict entries that have outstanding (unacknowledged)
references. references.
6.3. Reference Tracking 7.3. 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 received by the decoder after the referenced entry table entry is not received by the decoder after the referenced entry
has already been evicted. An encoder also respects the limit set by has already been evicted. An encoder also respects the limit set by
the decoder on the number of streams that are allowed to become the decoder on the number of streams that are allowed to become
blocked. Even if the decoder is willing to tolerate blocked streams, blocked. Even if the decoder is willing to tolerate blocked streams,
the encoder might choose to avoid them in certain cases. the encoder might choose to avoid them in certain cases.
In order to enable this, the encoder will need to track outstanding In order to enable this, the encoder will need to track outstanding
(unacknowledged) header blocks and table updates using feedback (unacknowledged) header blocks and table updates using feedback
received from the decoder. received from the decoder.
6.3.1. Blocked Eviction 7.3.1. Blocked Eviction
The encoder MUST NOT permit an entry to be evicted while a reference The encoder MUST NOT permit an entry to be evicted while a reference
to that entry remains unacknowledged. If a new header to be inserted to that entry remains unacknowledged. If a new header to be inserted
into the dynamic table would cause the eviction of such an entry, the into the dynamic table would cause the eviction of such an entry, the
encoder MUST NOT emit the insert instruction until the reference has encoder MUST NOT emit the insert instruction until the reference has
been processed by the decoder and acknowledged. been processed by the decoder and acknowledged.
The encoder can emit a literal representation for the new header in The encoder can emit a literal representation for the new header in
order to avoid encoding delays, and MAY insert the header into the order to avoid encoding delays, and MAY insert the header into the
table later if desired. table later if desired.
To ensure that the blocked eviction case is rare, references to the To ensure that the blocked eviction case is rare, references to the
oldest entries in the dynamic table SHOULD be avoided. When one of oldest entries in the dynamic table SHOULD be avoided. When one of
the oldest entries in the table is still actively used for the oldest entries in the table is still actively used for
references, the encoder SHOULD emit an Duplicate representation references, the encoder SHOULD emit an Duplicate representation
instead (see Section 5.2.3). instead (see Section 5.2.3).
6.3.2. Blocked Decoding 7.3.2. Blocked Decoding
For header blocks encoded in non-blocking mode, the encoder needs to For header blocks encoded in non-blocking mode, the encoder needs to
forego indexed representations that refer to table updates which have forego indexed representations that refer to table updates which have
not yet been acknowledged with Section 5.3. Since all table updates not yet been acknowledged with Section 5.3. Since all table updates
are processed in sequence on the control stream, an index into the are processed in sequence on the encoder stream, an index into the
dynamic table is sufficient to track which entries have been dynamic table is sufficient to track which entries have been
acknowledged. acknowledged.
To track blocked streams, the necessary Base Index value for each To track blocked streams, the necessary Base Index value for each
stream can be used. Whenever the decoder processes a table update, stream can be used. Whenever the decoder processes a table update,
it can begin decoding any blocked streams that now have their it can begin decoding any blocked streams that now have their
dependencies satisfied. dependencies satisfied.
6.4. Speculative table updates 7.4. Speculative table updates
Implementations can _speculatively_ send header frames on the HTTP Implementations can _speculatively_ send header frames on the HTTP
Control Streams which are not needed for any current HTTP request or Control Streams which are not needed for any current HTTP request or
response. Such headers could be used strategically to improve response. Such headers could be used strategically to improve
performance. For instance, the encoder might decide to _refresh_ by performance. For instance, the encoder might decide to _refresh_ by
sending Duplicate representations for popular header fields sending Duplicate representations for popular header fields
(Section 5.2.3), ensuring they have small indices and hence minimal (Section 5.2.3), ensuring they have small indices and hence minimal
size on the wire. size on the wire.
6.5. Sample One Pass Encoding Algorithm 7.5. Sample One Pass Encoding Algorithm
Pseudo-code for single pass encoding, excluding handling of Pseudo-code for single pass encoding, excluding handling of
duplicates, non-blocking mode, and reference tracking. duplicates, non-blocking mode, and reference tracking.
baseIndex = dynamicTable.baseIndex baseIndex = dynamicTable.baseIndex
largestReference = 0 largestReference = 0
for header in headers: for header in headers:
staticIdx = staticTable.getIndex(header) staticIdx = staticTable.getIndex(header)
if staticIdx: if staticIdx:
encodeIndexReference(streamBuffer, staticIdx) encodeIndexReference(streamBuffer, staticIdx)
skipping to change at page 22, line 5 skipping to change at page 23, line 5
# encode the prefix # encode the prefix
encodeInteger(prefixBuffer, 0x00, largestReference, 8) encodeInteger(prefixBuffer, 0x00, largestReference, 8)
if baseIndex >= largestReference: if baseIndex >= largestReference:
encodeInteger(prefixBuffer, 0, baseIndex - largestReference, 7) encodeInteger(prefixBuffer, 0, baseIndex - largestReference, 7)
else: else:
encodeInteger(prefixBuffer, 0x80, encodeInteger(prefixBuffer, 0x80,
largestReference - baseIndex, 7) largestReference - baseIndex, 7)
return controlBuffer, prefixBuffer + streamBuffer return controlBuffer, prefixBuffer + streamBuffer
7. Security Considerations 8. Security Considerations
TBD. TBD.
8. IANA Considerations 9. IANA Considerations
8.1. Settings Registration 9.1. Settings Registration
This document creates two new settings in the "HTTP/QUIC Settings" This document creates two new settings in the "HTTP/QUIC Settings"
registry established in [QUIC-HTTP]. registry established in [QUIC-HTTP].
The entries in the following table are registered by this document. The entries in the following table are registered by this document.
+-----------------------+------+---------------+ +-----------------------+------+---------------+
| Setting Name | Code | Specification | | Setting Name | Code | Specification |
+-----------------------+------+---------------+ +-----------------------+------+---------------+
| HEADER_TABLE_SIZE | 0x1 | Section 4 | | HEADER_TABLE_SIZE | 0x1 | Section 4 |
| | | | | | | |
| QPACK_BLOCKED_STREAMS | 0x7 | Section 4 | | QPACK_BLOCKED_STREAMS | 0x7 | Section 4 |
+-----------------------+------+---------------+ +-----------------------+------+---------------+
8.2. Stream Type Registration 9.2. Stream Type Registration
This document creates two new settings in the "HTTP/QUIC Stream Type" This document creates two new settings in the "HTTP/QUIC Stream Type"
registry established in [QUIC-HTTP]. registry established in [QUIC-HTTP].
The entries in the following table are registered by this document. The entries in the following table are registered by this document.
+----------------------+------+---------------+--------+ +----------------------+------+---------------+--------+
| Stream Type | Code | Specification | Sender | | Stream Type | Code | Specification | Sender |
+----------------------+------+---------------+--------+ +----------------------+------+---------------+--------+
| QPACK Encoder Stream | 0x48 | Section 5 | Both | | QPACK Encoder Stream | 0x48 | Section 5 | Both |
| | | | | | | | | |
| QPACK Decoder Stream | 0x68 | Section 5 | Both | | QPACK Decoder Stream | 0x68 | Section 5 | Both |
+----------------------+------+---------------+--------+ +----------------------+------+---------------+--------+
9. References 9.3. Error Code Registration
9.1. Normative References This document establishes one new error code in the "HTTP/QUIC Error
Code" registry established in [QUIC-HTTP].
Name: HTTP_QPACK_DECOMPRESSION_FAILED
Code: 0x06
Description: QPACK failed to interpret an instruction and cannot
continue.
10. References
10.1. Normative References
[QUIC-HTTP] [QUIC-HTTP]
Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over
QUIC", draft-ietf-quic-http-13 (work in progress), June QUIC", draft-ietf-quic-http-14 (work in progress), August
2018. 2018.
[QUIC-TRANSPORT]
Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based
Multiplexed and Secure Transport", draft-ietf-quic-
transport-13 (work in progress), August 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,
<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>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
9.2. Informative References 10.2. Informative References
[QUIC-TRANSPORT]
Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed
and Secure Transport", draft-ietf-quic-transport-12 (work
in progress), May 2018.
[RFC2360] Scott, G., "Guide for Internet Standards Writers", BCP 22, [RFC2360] Scott, G., "Guide for Internet Standards Writers", BCP 22,
RFC 2360, DOI 10.17487/RFC2360, June 1998, RFC 2360, DOI 10.17487/RFC2360, June 1998,
<https://www.rfc-editor.org/info/rfc2360>. <https://www.rfc-editor.org/info/rfc2360>.
[RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext
Transfer Protocol Version 2 (HTTP/2)", RFC 7540, Transfer Protocol Version 2 (HTTP/2)", RFC 7540,
DOI 10.17487/RFC7540, May 2015, DOI 10.17487/RFC7540, May 2015,
<https://www.rfc-editor.org/info/rfc7540>. <https://www.rfc-editor.org/info/rfc7540>.
9.3. URIs 10.3. URIs
[1] https://mailarchive.ietf.org/arch/search/?email_list=quic [1] https://mailarchive.ietf.org/arch/search/?email_list=quic
[2] https://github.com/quicwg [2] https://github.com/quicwg
[3] https://github.com/quicwg/base-drafts/labels/-qpack [3] https://github.com/quicwg/base-drafts/labels/-qpack
Appendix A. Change Log Appendix A. 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.
A.1. Since draft-ietf-quic-qpack-00 A.1. Since draft-ietf-quic-qpack-01
o Only header blocks that reference the dynamic table are
acknowledged (#1603, #1605)
A.2. 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)
skipping to change at page 24, line 14 skipping to change at page 25, line 31
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)
A.2. Since draft-ietf-quic-qcram-00 A.3. 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. 48 change blocks. 
84 lines changed or deleted 113 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/