HTTP2 期望流按照顺序打开
HTTP2 expects streams to be opened following the sequence
我在官方 HTTP2 规范中没有看到这种说法,但似乎如果您打开 ID 不代表序列号的流,服务器会以包含 ProtocolError 作为原因的 GoAway 帧进行响应。
示例(无效):
=> HEADER{sid: 3}
=> HEADER{sid: 1}
<= GoAway{ProtoclError}
示例(有效):
=> HEADER{sid: 1}
=> HEADER{sid: 3}
<= ... All good ...
这是为什么?有人可以指出规范中的正确部分吗,pelase?
这在 [HTTP/2 规范第 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.
我在官方 HTTP2 规范中没有看到这种说法,但似乎如果您打开 ID 不代表序列号的流,服务器会以包含 ProtocolError 作为原因的 GoAway 帧进行响应。
示例(无效):
=> HEADER{sid: 3}
=> HEADER{sid: 1}
<= GoAway{ProtoclError}
示例(有效):
=> HEADER{sid: 1}
=> HEADER{sid: 3}
<= ... All good ...
这是为什么?有人可以指出规范中的正确部分吗,pelase?
这在 [HTTP/2 规范第 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.