gpt4 book ai didi

http - 单个 HTTP 响应中是否允许多个状态代码 header ?

转载 作者:行者123 更新时间:2023-12-05 01:44:03 25 4
gpt4 key购买 nike

我有一个发送 HTTP 状态代码的网络应用程序。在某些情况下,404 代码作为 header 发送,但随后也会在同一响应中发送 200 错误。

HTTP/1.0 404 Not Found
HTTP/1.0 200 Ok

我无法更改执行顺序以阻止发送第一个状态代码,因此第二个代码试图覆盖它。

Chrome 忽略第一个代码并假定状态为 Ok。这是否符合 HTTP 标准,我应该依赖它吗?

最佳答案

不,它不符合标准,你不应该依赖它。参见 https://www.greenbytes.de/tech/webdav/rfc7230.html#rfc.section.5.6 :

More than one response message per request only occurs when one or more informational responses (1xx, see Section 6.2 of [RFC7231]) precede a final answer to the same request.

关于http - 单个 HTTP 响应中是否允许多个状态代码 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47540851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com