gpt4 book ai didi

http - 403响应可以吗?

转载 作者:可可西里 更新时间:2023-11-01 16:18:33 26 4
gpt4 key购买 nike

在 HTTP 中,我知道标准的 200 响应结尾是“OK”。但我似乎找不到其他代码(例如 403)是否需要 OK。

例如(来自维基百科):

HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Etag: "3f80f-1b6-3e1cb03b"
Content-Type: text/html; charset=UTF-8
Content-Length: 131
Connection: close

<html>
<head>
<title>An Example Page</title>
</head>
<body>
Hello World, this is a very simple HTML document.
</body>
</html>

所以在 403 响应中它会以:

HTTP/1.1 403 OK

或者:

HTTP/1.1 403 FORBIDDEN

或者只是:

HTTP/1.1 403

最佳答案

最有可能开始于

HTTP/1.1 403 Forbidden

基本上,您的问题的答案是“403 响应不行,但您可以在那里写任何您想要的内容。”

这一行的格式定义为:

Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF

这是 spec 的内容说:

The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.

The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.

但通常没有理由这样做(没有理由替换原因;)。

状态代码及其推荐原因的列表也是 here .

关于http - 403响应可以吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16906340/

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