我正在自动化一个 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?
发布评论
评论(5)
据我所知,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.
来自 W3C HTML 4.01 规范,引用:
这意味着当您使用
标记时,您实际上是在指示浏览器表现得好像有正在发送
Refresh
标头。有关其历史的详细概述,请访问 http://www.securiteam.com/securityreviews /6Z00320HFQ.html
from the W3C HTML 4.01 specification, quote:
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 aRefresh
header being sent.a good overview of the history of it can be found at http://www.securiteam.com/securityreviews/6Z00320HFQ.html
根据 维基百科:URL 重定向:
According to Wikipedia: URL Redirection:
“刷新”HTTP 响应标头已标准化(对于 Web 浏览器,
无论如何)在 HTML 中:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents%3Ashared-declarative-refresh-steps
该网址看起来不太稳定,所以这是截至目前的相关步骤
2019-12-03:
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:
我相信它最初是 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