“刷新” HTTP 标头

发布于 2024-07-09 06:34:29 字数 481 浏览 7 评论 0 原文

我正在自动化一个 Web 应用程序(Mantis 错误跟踪器),并且从中得到一个有趣的响应标头,称为“刷新”:

HTTP/1.x 200 OK
...
Refresh: 0;url=my_view_page.php

它的行为方式似乎与 元刷新 确实如此,元刷新技术意味着它相当于 HTTP 中的标头。

问题是,我在 HTTP 标准< 中找不到任何有关 Refresh 标头的提及/a> 或任何其他关于如何解析它以及浏览器遇到它时应该做什么的明确文档。

这里发生了什么?

I'm automating a web application (the Mantis bug tracker) and I'm getting an interesting response header from it, called Refresh:

HTTP/1.x 200 OK
...
Refresh: 0;url=my_view_page.php

It seems to be acting the same way that meta refresh does, and the meta refresh technique implies that it is an equivalent of a header in HTTP.

Problem is, I can't find any mention of the Refresh header in the HTTP standard or any other definitive documentation on how it should be parsed and what the browser should do when it encounters it.

What's going on here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

画尸师 2024-07-16 06:34:29

据我所知,Refresh(以及 Set-Cookie 和可能的其他一些专有伪标头)是由 Netscape 在互联网的早期创建的,从那时起就基本上(但不完全是)标准。 因为几乎所有浏览器都支持 Refresh,所以使用起来非常安全——而且通常也是如此。

我想它永远不会成为官方标准的一部分,因为他们已经有了状态代码的规定。

As far as I know, Refresh (along with Set-Cookie and possibly some other proprietary pseudo-headers) were created by Netscape in the very early days of the internet and have been basically (but not quite) standard since then. Because just about every browser supports it, Refresh is pretty safe to use -- and commonly is.

I guess it never became part of the official standards because they already had provisions for that with the status codes.

只涨不跌 2024-07-16 06:34:29

来自 W3C HTML 4.01 规范,引用:

META 和 HTTP 标头

http-equiv 属性可以用来代替 name 属性,并且在通过超文本传输​​协议 (HTTP) 检索文档时具有特殊意义。 HTTP 服务器可以使用 http-equiv 属性指定的属性名称在 HTTP 响应中创建 [RFC822] 样式标头。 有关有效 HTTP 标头的详细信息,请参阅 HTTP 规范 ([RFC2616])。

这意味着当您使用 标记时,您实际上是在指示浏览器表现得好像有正在发送 Refresh 标头。

有关其历史的详细概述,请访问 http://www.securiteam.com/securityreviews /6Z00320HFQ.html

from the W3C HTML 4.01 specification, quote:

META and HTTP headers

The http-equiv attribute can be used in place of the name attribute and has a special significance when documents are retrieved via the Hypertext Transfer Protocol (HTTP). HTTP servers may use the property name specified by the http-equiv attribute to create an [RFC822]-style header in the HTTP response. Please see the HTTP specification ([RFC2616]) for details on valid HTTP headers.

What this means is that when you use the <meta http-equiv="refresh" url="..."/> tag, you are actually instructing the browser to act as if there were a Refresh header being sent.

a good overview of the history of it can be found at http://www.securiteam.com/securityreviews/6Z00320HFQ.html

情绪少女 2024-07-16 06:34:29

根据 维基百科:URL 重定向

这是专有/非标准
Netscape 的扩展。 支持
大多数网络浏览器都支持。

According to Wikipedia: URL Redirection:

This is a proprietary/non-standard
extension by Netscape. It is supported
by most web browsers.

书间行客 2024-07-16 06:34:29

“刷新”HTTP 响应标头已标准化(对于 Web 浏览器,
无论如何)在 HTML 中:

https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents%3Ashared-declarative-refresh-steps

该网址看起来不太稳定,所以这是截至目前的相关步骤
2019-12-03:

  • 如果响应具有Refresh标头,则:
    1. value为标头值的同构解码。
    2. 使用文档运行共享声明性刷新步骤。
  • The "Refresh" HTTP response header has been standardized (for web browsers,
    anyway) in HTML:

    https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents%3Ashared-declarative-refresh-steps

    That URL doesn't look so stable, so here are the relevant steps as of
    2019-12-03:

    1. If response has a Refresh header, then:
      1. Let value be the isomorphic decoding of the value of the header.
      2. Run the shared declarative refresh steps with document and value.
    甩你一脸翔 2024-07-16 06:34:29

    我相信它最初是 Netscape 扩展,并且没有标准化,因为它已被 W3C 弃用:

    http://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element

    I believe it was originally a Netscape extension, and was not standardised because it's deprecated by W3C:

    http://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文