HTTP 块:所有块都是连续且不间断发送的吗?

发布于 2024-08-16 08:27:51 字数 321 浏览 4 评论 0原文

我能否确保分块 HTTP 响应的发送不会被其他任何事情中断?我需要区分响应(和请求),这不是读取内容长度、查看关闭连接或无人响应代码的简单情况。

我可以读取每个块吗?一旦 chunk-size 为 0,我将恰好读取一个响应(或请求)吗?即是否有可能交错发送任何其他响应的一部分?我怀疑它是连续且不间断地发送的,因为在分块传输的规范中似乎没有任何类型的标识,那么如何重新组装多个呢?

最后,如果响应被分块发送,客户端是否会发送比原始请求更多的内容?我正在考虑流量控制和错误检查,但这都是在较低层处理的,所以我怀疑客户端不会再发送任何内容。

谢谢!

Can I be sure that a chunked HTTP response will be sent uninterrupted by anything else? I need to differentiate responses (and requests) and this isn't a simple case of reading content length, seeing a closed connection or a no-body response code.

Can I read each chunk and once chunk-size is 0 I will have read exactly one response (or request)? i.e. is it possible for part of any other response to have been sent interleaved? I suspect it is sent consecutively and uninterrupted as there doesn't appear to be any kind of identification in the spec for chunked transfer, so how could more than one be reassembled?

Finally, if a response is sent chunked, does the client send anything more than its original request? I'm thinking along the lines of flow control and error checking but that is all handled at lower layers, so I suspect that the client does not send anything more.

Thanks!

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

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

发布评论

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

评论(1

烟燃烟灭 2024-08-23 08:27:51

“交错”到底是什么? HTTP 不允许在同一连接上同时发送多个响应。即使使用管道,响应仍然会依次发送。也就是说,您将在响应任何其他请求之前看到所有块按顺序出现。

至于你的最后一个问题,不,客户端不会发送除原始请求之外的任何内容。

"Interleaved" with what exactly? HTTP doesn't allow to send several responses concurrently on the same connection. Even with pipelining responses are still sent after each other. That is, you will see all the chunks coming in order before the response to any other request.

As for your final question, no, the client doesn't send anything more than the original request.

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