【问题标题】:Should an HTTP server respond with a more specific Content-Type than was requested?HTTP 服务器是否应该使用比请求更具体的 Content-Type 进行响应?
【发布时间】:2018-11-08 23:03:51
【问题描述】:

例如,如果请求是

GET /feed.xml HTTP/1.1
Host: www.nowhere123.com
Accept: application/xml

...服务器是否可以使用标头Content-Type: application/atom+xml 进行响应(即使请求具有Accept: application/xml),还是应该提供相同的主体但使用Content-Type: application/xml

【问题讨论】:

    标签: http mime-types content-negotiation


    【解决方案1】:

    允许服务器忽略标头字段,所以是的,发送更具体的内容是可以的。 HTTP 消息是自描述的是有原因的。 (见https://greenbytes.de/tech/webdav/rfc7231.html#rfc.section.5.3.2.p.7

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-07
      • 1970-01-01
      • 2017-03-02
      • 1970-01-01
      • 2014-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多