Why do servers not wait for http headers if the http version is not specified in a GET request?

时间:2017-08-04 13:02:15

标签: http http-headers netcat

If I make a GET request via netcat without specifying the http version - GET /, I get a response from the server without it waiting for me to send any headers and a blank line first. But if the version is there - GET / HTTP/0.1, it behaves normally, even if it's 0.1. I tested it on google.com, apache.org and microsoft.com. Is it defined by the protocol?

1 个答案:

答案 0 :(得分:2)

这种形式的请求({{1}}没有版本)被HTTP协议的早期版本使用,称为HTTP / 0.9,它根本不支持标头。请参阅The Original HTTP as defined in 1991

HTTP 1.0(RFC 1945)和HTTP 1.1(RFC 2616)的后续规范要求HTTP 1.0+实现识别HTTP 0.9请求和响应(HTTP {1}}后来删除了该要求)。

RFC 1945声明:

  

HTTP消息的版本由消息第一行中的HTTP-Version字段指示。 如果未指定协议版本,则收件人必须假定邮件采用简单的HTTP / 0.9格式。