有效的 HTTP 标头? `GET /page.html Http1.0`?
好吧,我一直在阅读 HTTP 并找到此页面。这是一个发布在此处的 HTTP 请求示例:
GET /http.html Http1.1 Host: www.http.header.free.fr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, Accept-Language: Fr Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) Connection: Keep-Alive
我在 telnet 中尝试了它并且成功了。但在其他地方我都会看到这种请求行。
GET /http.html HTTP/1.1
重要的不同之处在于 HTTP
全部大写和 /
字符。
他们都正确吗?它们似乎都可以在我测试过的网站上运行。我浏览了 HTTP 的 RFC 但没有发现任何有用的东西。有其他人见过这种请求标头吗?官方支持吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
参考HTTP协议,必须是
HTTP/1.1
或HTTP/1.0
(较旧的)。现在就看http服务器是如何开发的了。它可能会接受它,但您不应该依赖它。编辑:
现在协议是 1.1 所以你应该使用:
GET /http.html HTTP/1.1
Refering to the HTTP protocol, it must be in
HTTP/1.1
orHTTP/1.0
(older one). Now it depend how the http server was developed. It may accept it but you should not rely on it.EDIT:
And now the protocol is 1.1 so you should use:
GET /http.html HTTP/1.1
根据 RFC2145(第 3 页),
特别是:
因此,如果版本号是“Http1.1”(无效),服务器会忽略版本号,并且可能会将消息解释为 HTTP/1.0 消息(甚至可能是 HTTP/0.9!)。当然,您不应该依赖这种行为!
According to RFC2145 (page 3),
And in particular:
So the server is ignoring the version number in the case that it's "Http1.1" (which is not valid) and presumably it's interpreting the message as a HTTP/1.0 message (or maybe even HTTP/0.9!). Of course, you should not rely on this behaviour!
应该是
It should be