Skip to content

Commit

Permalink
Rewrite some of the thorny pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
martinthomson committed Dec 19, 2018
1 parent 120a51b commit 7e7d7b5
Showing 1 changed file with 49 additions and 43 deletions.
92 changes: 49 additions & 43 deletions draft-ietf-quic-qpack.md
Expand Up @@ -251,18 +251,18 @@ header block might reference an entry in the dynamic table that has not yet been
received.

Each header block contains the total number of entries added to the dynamic
table - the Insert Count - which identifies the table state necessary for
decoding (see {{header-prefix}}). If the Insert Count is greater than the number
of dynamic table entries received, the stream is considered "blocked." While
blocked, header field data SHOULD remain in the blocked stream's flow control
window. When the Insert Count is zero, the frame contains no references to the
dynamic table and can always be processed immediately. A stream becomes
unblocked when the number of entries inserted in the dynamic table becomes
greater than or equal to the Insert Count for all header blocks the decoder has
started reading from the stream. If the decoder encounters a header block where
the largest Absolute Index used not equal to the largest value permitted by the
Insert Count, it MAY treat this as a stream error of type
HTTP_QPACK_DECOMPRESSION_FAILED.
table - the Required Insert Count - which identifies the table state necessary
for decoding (see {{header-prefix}}). If the Required Insert Count is greater
than the number of dynamic table entries received, the stream is considered
"blocked." While blocked, header field data SHOULD remain in the blocked
stream's flow control window. When the Required Insert Count is zero, the frame
contains no references to the dynamic table and can always be processed
immediately. A stream becomes unblocked when the number of entries inserted in
the dynamic table becomes greater than or equal to the Required Insert Count for
all header blocks the decoder has started reading from the stream. If the
decoder encounters a header block where the largest Absolute Index used not
equal to the largest value permitted by the Required Insert Count, it MAY treat
this as a stream error of type HTTP_QPACK_DECOMPRESSION_FAILED.

The SETTINGS_QPACK_BLOCKED_STREAMS setting (see {{configuration}}) specifies an
upper bound on the number of streams which can be blocked. An encoder MUST limit
Expand All @@ -283,12 +283,13 @@ encoder becoming blocked on congestion or flow control limits.

### Known Received Count

In order to identify which dynamic table entries can be safely used
without a stream becoming blocked, the encoder tracks the absolute index of the
decoder's Known Received Count entry.
In order to identify which dynamic table entries can be safely used without a
stream becoming blocked, the encoder tracks the number of entries received by
the decoder. TheKnown Received Count tracks the total number of acknowledged
insertions.

When blocking references are permitted, the encoder uses header block
acknowledgement to identify the Known Received Count index, as described in
acknowledgement to identify the Known Received Count, as described in
{{header-acknowledgement}}.

To acknowledge dynamic table entries which are not referenced by header blocks,
Expand Down Expand Up @@ -335,9 +336,9 @@ acknowledged before using it.

### Blocked Decoding

To track blocked streams, the necessary Insert Count value for each stream
can be used. Whenever the decoder processes a table update, it can begin
decoding any blocked streams that now have their dependencies satisfied.
To track blocked streams, the Required Insert Count value for each stream can be
used. Whenever the decoder processes a table update, it can begin decoding any
blocked streams that now have their dependencies satisfied.


# Header Tables
Expand Down Expand Up @@ -475,15 +476,18 @@ d = count of entries dropped
Because frames from request streams can be delivered out of order with
instructions on the encoder stream, relative indices are relative to the Base at
the beginning of the header block (see {{header-prefix}}). The Base is encoded
as a value relative to the Insert Count, so it can be expressed as the number of
entries inserted. The dynamic table entries up to the Base can be referenced.
The most recently inserted entry within the limit set by the Base has a relative
index of 0.
as a value relative to the Required Insert Count. The Base identifies which
dynamic table entries can be referenced using relative indexing, starting with 0
at the last entry added.

Post-base references are used for entries inserted after base, starting at 0 for
the first entry added after Base, see {{post-base}}.

Though new entries could be added while processing a header block, the relative
indices of entries do not change.

~~~~~ drawing
Required
Insert
Count Base
| |
Expand All @@ -499,7 +503,8 @@ d = count of entries dropped
~~~~~
{: title="Example Dynamic Table Indexing - Relative Index on Request Stream"}

### Post-Base Indexing

### Post-Base Indexing {#post-base}

A header block on the request stream can reference entries added after the entry
identified by the Base. This allows an encoder to process a header block in a
Expand Down Expand Up @@ -529,8 +534,9 @@ d = count of entries dropped

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 absolute index
greater than allowed by the declared Insert Count (see {{header-prefix}}), it
MUST treat this as a stream error of type `HTTP_QPACK_DECOMPRESSION_FAILED`.
greater than allowed by the declared Required Insert Count (see
{{header-prefix}}), it MUST treat this as a stream error of type
`HTTP_QPACK_DECOMPRESSION_FAILED`.

If the decoder encounters a reference on the encoder stream to a dynamic table
entry which has already been dropped, it MUST treat this as a connection error
Expand Down Expand Up @@ -733,12 +739,12 @@ connection error of type `HTTP_QPACK_DECODER_STREAM_ERROR`.

### Header Acknowledgement

After processing a header block whose declared Insert Count is not zero, the
decoder emits a Header Acknowledgement instruction on the decoder stream. The
instruction begins with the '1' one-bit pattern and includes the request
stream's stream ID, encoded as a 7-bit prefix integer. It is used by the peer's
encoder to know when it is safe to evict an entry, and possibly update the Known
Received Count.
After processing a header block whose declared Required Insert Count is not
zero, the decoder emits a Header Acknowledgement instruction on the decoder
stream. The instruction begins with the '1' one-bit pattern and includes the
request stream's stream ID, encoded as a 7-bit prefix integer. It is used by
the peer's encoder to know when it is safe to evict an entry, and possibly
update the Known Received Count.

~~~~~~~~~~ drawing
0 1 2 3 4 5 6 7
Expand All @@ -755,17 +761,17 @@ processed in order, this gives the encoder precise feedback on which header
blocks within a stream have been fully processed.

If an encoder receives a Header Acknowledgement instruction referring to a
stream on which every header block with a non-zero Insert Count has already been
acknowledged, that MUST be treated as a connection error of type
stream on which every header block with a non-zero Required Insert Count has
already been acknowledged, that MUST be treated as a connection error of type
`HTTP_QPACK_DECODER_STREAM_ERROR`.

When blocking references are permitted, the encoder uses acknowledgement of
header blocks to update the Known Received Count. If a header block was
potentially blocking, the acknowledgement implies that the decoder has received
all dynamic table state necessary to process the header block. If the Insert
Count of an acknowledged header block was greater than the encoder's current
Known Received Count, the block's Insert Count becomes the new Known Received
Count.
all dynamic table state necessary to process the header block. If the Required
Insert Count of an acknowledged header block was greater than the encoder's
current Known Received Count, the block's Required Insert Count becomes the new
Known Received Count.


### Stream Cancellation
Expand Down Expand Up @@ -804,12 +810,12 @@ streams emit the headers for an HTTP request or response.

### Header Data Prefix {#header-prefix}

Header data is prefixed with two integers, `Insert Count` and `Base`.
Header data is prefixed with two integers, `Required Insert Count` and `Base`.

~~~~~~~~~~ drawing
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| Insert Count (8+) |
| Required Insert Count (8+) |
+---+---------------------------+
| S | Delta Base (7+) |
+---+---------------------------+
Expand Down Expand Up @@ -922,8 +928,8 @@ field is represented as an integer with a 6-bit prefix (see Section 5.1 of

If the entry is in the dynamic table with an absolute index greater than Base,
the representation starts with the '0001' 4-bit pattern, followed by the
post-base index (see {{post-base-indexing}}) of the matching header field,
represented as an integer with a 4-bit prefix (see Section 5.1 of [RFC7541]).
post-base index (see {{post-base}}) of the matching header field, represented as
an integer with a 4-bit prefix (see Section 5.1 of [RFC7541]).

~~~~~~~~~~ drawing
0 1 2 3 4 5 6 7
Expand Down Expand Up @@ -976,7 +982,7 @@ static (S=1) or dynamic (S=0) table.

For entries in the dynamic table with an absolute index greater than the Base,
the header field name is represented using the post-base index of that entry
(see {{post-base-indexing}}) encoded as an integer with a 3-bit prefix.
(see {{post-base}}) encoded as an integer with a 3-bit prefix.

~~~~~~~~~~ drawing
0 1 2 3 4 5 6 7
Expand Down

0 comments on commit 7e7d7b5

Please sign in to comment.