HTTP2 期望按照顺序打开流

发布于 2025-01-14 18:19:38 字数 336 浏览 2 评论 0原文

我在官方 HTTP2 规范中没有看到这种说法,但似乎如果您打开 ID 不代表序列号的流,服务器会以 ProtocolError 作为原因以 GoAway 帧进行响应。

示例(无效):

=> HEADER{sid: 3}
=> HEADER{sid: 1}
<= GoAway{ProtoclError}

示例(有效):

=> HEADER{sid: 1}
=> HEADER{sid: 3}
<= ... All good ...

这是为什么?有人可以指出我在规范中的正确部分吗?

I haven't seen this claim in the official HTTP2 spec but it seems that if you open streams with IDs that do not represent sequential numbers, the server responds with a GoAway frame having ProtocolError as a reason.

Example (INVALID):

=> HEADER{sid: 3}
=> HEADER{sid: 1}
<= GoAway{ProtoclError}

Example (VALID):

=> HEADER{sid: 1}
=> HEADER{sid: 3}
<= ... All good ...

Why is that? Can someone point me to the right section in the spec, pelase?

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

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

发布评论

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

评论(1

油焖大侠 2025-01-21 18:19:38

这在 [HTTP/2 规范第 5.1.1 节] 中进行了说明:(https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.1

新建立的流的标识符必须是数字
大于发起端点已打开的所有流或
保留。
...
一个端点
接收到意外的流标识符必须用
PROTOCOL_ERROR 类型的连接错误(第 5.4.1 节)。

This is stated in the [HTTP/2 specification, section 5.1.1]:(https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.1)

The identifier of a newly established stream MUST be numerically
greater than all streams that the initiating endpoint has opened or
reserved.
...
An endpoint that
receives an unexpected stream identifier MUST respond with a
connection error (Section 5.4.1) of type PROTOCOL_ERROR.

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