HTTP 状态码 510 用法

use*_*259 5 http http-status-codes

我开始了解 http 状态代码并且有点卡在 510 Not Extended 上。

它在维基百科等许多网站上都有提及,但未在非官方代码下提及。但是,当我阅读rfc2774 时,它被标记为“实验性”。

  • 那么我应该假设它(不是?)被使用了吗?是否有任何服务器/站点支持/使用它?

我也想知道状态码应该如何工作

  • 您是否仅在客户端尝试发送服务器不支持的 Man 或 C-Man 时使用 510?

    • (更新) 看来 apache http 服务器 htaccess ErrorDocument 返回"A mandatory extension policy in the request is not accepted by the server for this resource." askapache.com
    • (更新) OTOHServers can force the use of the HTTP Extension Framework by using the 510 "Not Extended" HTTP status code. 简单对象访问协议 (SOAP) 1.1
  • 服务器如何发回客户端发出扩展请求所需的所有信息?

rfc 说

请求中未满足访问资源的策略。服务器应该发回客户端发出扩展请求所需的所有信息。我t是不在此规范的范围,以指定的扩展如何通知客户。

这是什么意思?

我认为它的工作原理类似于

(必须在资源 /html 和扩展名“x”上使用 GET)

HTTP/1.1 510 Extended
M-GET /html
Man : "http://www.company.com/extension"; ns=11
11-ext : "x"

HTTP/1.1 510 Extended
M-GET /html
C-Man : "http://www.company.com/extension"; ns=11
11-ext : "x"
Connection: C-Man, 11-ext
Run Code Online (Sandbox Code Playgroud)

但是第 6 节说这个

服务器不得在 HTTP 响应中包含强制扩展声明,除非它正在响应一个强制 HTTP 请求,该请求的定义允许强制响应,或者服务器有一些先验知识,即接收者可以处理扩展响应。服务器可以在任何 HTTP 响应中包含可选的扩展声明(参见第 4 节)。

作为注释。我读到“ext”和“c-ext”在这里不相关,因为

扩展响应头域专门用作扩展确认,不能携带任何其他信息。

(更新)第 6.4 节 SOAP HTTP 示例中的示例 4 使用 HTTP 扩展框架的SOAP看起来与我的示例相似?

M-POST /StockQuote HTTP/1.1
Man: "http://schemas.xmlsoap.org/soap/envelope/"; ns=NNNN
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
NNNN-SOAPAction: "http://electrocommerce.org/abc#MyMessage"

<SOAP-ENV:Envelope...

HTTP/1.1 200 OK
Ext:
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn

<SOAP-ENV:Envelope...
Run Code Online (Sandbox Code Playgroud)