动态表中的HTTP2重复条目

发布于 2025-01-18 15:16:21 字数 460 浏览 0 评论 0 原文

在 hpack 的 RFC 中,它这样说...

The dynamic table can contain duplicate entries (i.e., entries with the same name and same value). Therefore, duplicate entries MUST NOT be treated as an error by a decoder

在表中,由于静态表和动态表是一个(通过 RFC 中的索引地址空间),这是否意味着如果我在索引 75 中有 header: headername: headervalue,那么我在新请求中遇到它,我还应该将它添加到动态表中,尽管它已经位于索引 75 处?如果是这样,我会参考哪一个,索引 75 还是最新索引?那么,如果我遇到具有相同名称但每个请求都有新值的标头,会发生什么情况,我可以在动态表中保留永不更改的标头名称,然后使用该索引仅解码标头名称吗?

in the RFC for hpack, it says this...

The dynamic table can contain duplicate entries (i.e., entries with the same name and same value). Therefore, duplicate entries MUST NOT be treated as an error by a decoder

in the table, since the static and dynamic table are one (via index address space in RFC), does this mean if i have the header: headername: headervalue in index 75, then i encounter it in a new request, i should also add it to the dynamic table although its already at index 75? If so, which one would i reference, index 75 or the newest index? Then, what happens if i encounter a header that has the same name but with each request has a new value, can i keep the header name that never changes in the dynamic table then use that index to decode the header name only?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铁轨上的流浪者 2025-01-25 15:16:21

这是否意味着如果我有标题:natherame:index 75中的Headervalue,那么我在新请求中遇到它,我还应该将其添加到动态表中,尽管它已经在索引75?

理想情况下,您不应该。这样做是浪费空间。但是,如果您愿意,也可以做到这一点,并且也有充分的理由。

如果是这样,我将引用哪一个,索引75或最新索引?

您可以使用任何一个。每个都是同样有效的。
实际上,Web浏览器有时如此问题所示,有时以不同的方式实现此目的:怪异2在Firefox中编码的HPACK

那么,如果我遇到具有相同名称但每个请求具有新值的标头,会发生什么,我可以保留永远不会在动态表中更改的标题名称,然后使用该索引仅解码标题名称?

是的,你可以。理想情况下,将使用 nofollow noreferrer“防止他们用无用的一次性值填充动态表。但是,这也意味着标题名称也不会被索引,因此您无法按照您希望的那样看待。

does this mean if i have the header: headername: headervalue in index 75, then i encounter it in a new request, i should also add it to the dynamic table although its already at index 75?

Ideally you shouldn’t. It’s a waste of space to do that. But you CAN do that if you want to and have a good reason too.

If so, which one would i reference, index 75 or the newest index?

You can use either one. Each is equally valid.
And in fact web browsers sometimes implement this differently as illustrated in this question: Weird HTTP/2 HPACK encoding in Firefox

Then, what happens if i encounter a header that has the same name but with each request has a new value, can i keep the header name that never changes in the dynamic table then use that index to decode the header name only?

Yes you could. Ideally such fields would be sent with Literal Header Field without Indexing (or the similar Literal Header Field Never Indexed) syntax to prevent them filling up the dynamic table with useless, single-use values. However, that would also mean the header name would also not be indexed so you couldn’t look just that up as you hoped.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文