📜  HTTP 标头 |警告

📅  最后修改于: 2022-05-13 01:56:30.090000             🧑  作者: Mango

HTTP 标头 |警告

HTTP 标头允许客户和服务器通过 HTTP 请求或响应传递附加信息。警告通用 HTTP 标头包含有关可能未反映在消息中的消息状态的潜在问题的信息。该字段本身由警告代码、警告代理、警告文本和可选警告日期组成。响应中可能会显示多个警告标头。警告标头字段可以应用于任何消息,但是,用于警告缓存操作可能缺乏语义透明度,并且只能应用于转换消息。

句法:

Warning: <3-DIGIT-warn-code>   [< SP warn-date>]

指令:此标头接受上述四个指令,如下所述:

三位数的警告编号,应该用自然语言书写,其中第一位表示是否需要在批准后从存储的响应中删除警告。警告代码为 SIP 响应消息中的状态代码提供数据补充。 1xx 和 2xx 范围内的警告代码特定于 HTTP。

  • 1xx warn-codes:描述响应的新鲜度或重新验证状态,重新验证成功后必须删除。仅在批准缓存条目时由缓存生成。不得由客户产生。
  • 2xx警告代码:它描述了表示的某些方面,该方面没有被验证纠正,并且在批准后不会被缓存删除,除非发送了完整的响应。

表示哪个服务器添加/插入了头域。添加警告标头的服务器或软件的名称或化名(代理未知时可能为“-”)。

用引号括起来(warn-text = quoted-string),显示错误的建议文本最有可能被接收响应的用户理解。

它是可选的。如果发送了多个警告标头,请合并一个与 Date 标头匹配的日期(warn-date = HTTP-date)。

下表列出了警告代码和推荐的警告文本:

Warn-CodeWarn-TextDescription
110

Response is Stale

It must be included whenever a sent response is stale.
111

Revalidation Failed

It must be incorporated if a cache returns a stale response because an endeavor to approve the failed response, due to an powerlessness to reach the server.
112

Disconnected Operation

It ought to be incorporated if the cache is deliberately disengaged from the rest of the server network for a period of time.
113

Heuristic Expiration

It must be encapsulated if a cache heuristically picks a caching freshness lifetime greater than 24 hours and the response’s age is more than 24 hours.
199

Miscellaneous Warning

The warning-text may include whimsical information to be introduced to a client. A framework accepting this sort of caution must not make any automated step, other than introducing the caution to the client.
214

Transformation Applied

It ought to be incorporated by a proxy or cache on the off chance that it applies any change to response, for example, changing the content-coding, media-type of the response, or the entity-body of the response, unless this caution code already appears in the response. 
 
299

Miscellaneous Persistent Warning

This is same as warn-code 199, yet illustrate a obstinate warning message to the user.

例子

Warning: 246 - "Embedded Warning" "sat, 05 Oct 2019 10:47:47 GMT"
Warning: 199 -"Miscellaneous warning" "sun, 18 Oct 2015 07:28:00 GMT"

支持的浏览器: HTTP头警告支持的浏览器如下:

  • 谷歌浏览器
  • IE浏览器
  • 火狐
  • 苹果浏览器
  • 歌剧
  • 边缘