'Refresh' HTTP header

2019-01-01 15:47发布

问题:

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?

回答1:

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.



回答2:

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



回答3:

According to Wikipedia: URL Redirection:

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



回答4:

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



回答5:

It is probably a Microsoft extension to HTTP; at least they suggest its use on HOW TO: Enable Client Pull for Web Servers, Sites, and Folders and it seems to confirm to the meta refresh syntax.