Subject: Could someone clarify these sentences in HPACK RFC 7541?

From: Jingcheng Zhang <[email-masked]>
Date: Mon, 17 Jan 2022 11:40:28 +0800

When reading HPACK RFC 7541, I am confused on these sentences, in section
4.2:

"This dynamic table size update MUST occur at the beginning of the first
header block following the change to the dynamic table size. In HTTP/2,
this follows a settings acknowledgment (see Section 6.5.3
<https://tools.ietf.org/html/rfc7540#section-6.5.3> of [HTTP2]
<https://httpwg.org/specs/rfc7541.html#HTTP2>)."

I'm not a English native speaker, and I have difficulty in understanding
these two sentences. Could someone kindly elaborate the detailed sequences
on this, like what happens first, what happens later, making it more clear
to understand?

Thank you in advance!

-- 
Best regards,
Jingcheng Zhang
Beijing, P.R.China

---

From: "Martin Thomson" <[email-masked]>
Date: Mon, 17 Jan 2022 22:10:59 +1100

You might find the updated text in our revision of HTTP/2 helpful here:

https://httpwg.org/http2-spec/initial-table-size/draft-ietf-httpbis-http2bis.html#name-compression-state

The maximum size of the dynamic table is declared by an endpoint using SETTINGS_HEADER_TABLE_SIZE.  This sets a maximum size their decoder is willing to handle.

An encoder uses a Dynamic Table Size Update to declare the size of the dynamic table.  The endpoint that receives the SETTINGS_HEADER_TABLE_SIZE setting must tell their encoder not to exceed this number.

Both the maximum size (that is, SETTINGS_HEADER_TABLE_SIZE) and the current size of the dynamic table start at 4096 (4k) bytes.

When an endpoint processes the SETTINGS_HEADER_TABLE_SIZE setting, they then acknowledge the setting (SETTINGS with ACK flag set).  After that, the maximum applies.  If the size of the dynamic table at the encoder is larger than the maximum when this happens, the encoder MUST start the next header block (or field block in new terms) with a Dynamic Table Size Update instruction with a value less than or equal to the setting.

On Mon, Jan 17, 2022, at 14:40, Jingcheng Zhang wrote:
> When reading HPACK RFC 7541, I am confused on these sentences, in section 4.2:
>
> "This dynamic table size update MUST occur at the beginning of the 
> first header block following the change to the dynamic table size. In 
> HTTP/2, this follows a settings acknowledgment (see Section 6.5.3 
> I'm not a English native speaker, and I have difficulty in 
> understanding these two sentences. Could someone kindly elaborate the 
> detailed sequences on this, like what happens first, what happens 
> later, making it more clear to understand?
>
> Thank you in advance!
>
> -- 
> Best regards,
> Jingcheng Zhang
> Beijing, P.R.China

---

From: Jingcheng Zhang <[email-masked]>
Date: Tue, 18 Jan 2022 11:41:07 +0800

Hi Martin,

Thanks for your detailed description! I know the sequence of the behaviors
now.
I have two questions:

1. Some defined settings, like SETTINGS_INITIAL_WINDOW_SIZE and
SETTINGS_MAX_CONCURRENT_STREAMS, take effect immediately after the receiver
sends ACK, as the sentences described in RFC 7540:

"When the value of SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST
adjust the size of all stream flow-control windows that it maintains by the
difference between the new value and the old value."
"An endpoint that wishes to reduce the value of
SETTINGS_MAX_CONCURRENT_STREAMS to a value that is below the current number
of open streams can either close streams that exceed the new value or allow
streams to complete."

I thought the SETTINGS_HEADER_TABLE_SIZE setting follows the same design,
that is, the receiver of this defined setting changes the dynamic table
immediately after it receives this defined setting if the value is smaller
than previous one. So why does it need to send additional Dynamic Table
Size Update?

2. Current RFC seems to lack a description on a change to
SETTINGS_MAX_FRAME_SIZE, especially a reduction on frame size. Should it be
added to keep it consistent with descriptions of changes to other defined
settings?

On Mon, Jan 17, 2022 at 7:14 PM Martin Thomson <[email-masked]> wrote:

> The maximum size of the dynamic table is declared by an endpoint using
> SETTINGS_HEADER_TABLE_SIZE.  This sets a maximum size their decoder is
> willing to handle.
>
> An encoder uses a Dynamic Table Size Update to declare the size of the
> dynamic table.  The endpoint that receives the SETTINGS_HEADER_TABLE_SIZE
> setting must tell their encoder not to exceed this number.
>
> Both the maximum size (that is, SETTINGS_HEADER_TABLE_SIZE) and the
> current size of the dynamic table start at 4096 (4k) bytes.
>
> When an endpoint processes the SETTINGS_HEADER_TABLE_SIZE setting, they
> then acknowledge the setting (SETTINGS with ACK flag set).  After that, the
> maximum applies.  If the size of the dynamic table at the encoder is larger
> than the maximum when this happens, the encoder MUST start the next header
> block (or field block in new terms) with a Dynamic Table Size Update
> instruction with a value less than or equal to the setting.
>
>

-- 
Best regards,
Jingcheng Zhang
Beijing, P.R.China

---

From: "Martin Thomson" <[email-masked]>
Date: Tue, 18 Jan 2022 15:41:22 +1100

On Tue, Jan 18, 2022, at 14:41, Jingcheng Zhang wrote:
> I thought the SETTINGS_HEADER_TABLE_SIZE setting follows the same 
> design, that is, the receiver of this defined setting changes the 
> dynamic table immediately after it receives this defined setting if the 
> value is smaller than previous one. So why does it need to send 
> additional Dynamic Table Size Update?

The maximum still takes effect when the setting is acknowledged.  However, we decided that it would be better if the current size of the dynamic table was always signaled with Dynamic Table Size Update.  If we did not require the instruction, then there would be an implicit dependency on the state of SETTINGS+ACK frames.  A HPACK decoder would then need a second source of information about the state of the table.

> SETTINGS_MAX_FRAME_SIZE, especially a reduction on frame size. Should 
> it be added to keep it consistent with descriptions of changes to other 
> defined settings?

My opinion is that the general rules cover changes to SETTINGS_MAX_FRAME_SIZE.  That doesn't require special handling - an endpoint that wants to reduce the value just has to tolerate larger values until the acknowledgment.

---

From: Jingcheng Zhang <[email-masked]>
Date: Tue, 18 Jan 2022 15:07:51 +0800

Got it. Thanks!

On Tue, Jan 18, 2022 at 12:41 PM Martin Thomson <[email-masked]> wrote:

> The maximum still takes effect when the setting is acknowledged.  However,
> we decided that it would be better if the current size of the dynamic table
> was always signaled with Dynamic Table Size Update.  If we did not require
> the instruction, then there would be an implicit dependency on the state of
> SETTINGS+ACK frames.  A HPACK decoder would then need a second source of
> information about the state of the table.
>
> My opinion is that the general rules cover changes to
> SETTINGS_MAX_FRAME_SIZE.  That doesn't require special handling - an
> endpoint that wants to reduce the value just has to tolerate larger values
> until the acknowledgment.
>

-- 
Best regards,
Jingcheng Zhang
Beijing, China