http协议-浏览器和服务器协商http协议版本的过程探讨

How does a HTTP 1.0 only server respond to a HTTP 1.1 request?

Fairly simple question (I think). If a client sends a message like GET /whatever HTTP/1.1 to a server that only supports HTTP 1.0, how does the server react? What are the rules for header fields added in HTTP 1.1 that a HTTP 1.0 server doesn’t recognise? Does the server simply ignore 1.1 requests, ignore headers it doesn’t understand, return an error, or something else?

answer:

HTTP/1.0 200 OK

All headers of HTTP/1.1 (that a HTTP 1.0 server doesn’t recognise) will be ignored.

总之:http 目前支持协议 协商的只有 http1.1 ,浏览器通过 https 协商过程 或者直接用 upgrade 请求头  与服务器 进行协议协商。其他情况,客户端 服务端支持的最高http协议如果相同,则以最高http协议通信。服务端比客户端支持的最高http协议低,服务器会直接 忽略不能识别的请求头。

目前的浏览器,都是采用 http1.1 协议  率先进行 通信,然后 看看服务器 能不能支持 协议 升级,通过http2.0 进行通信。

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments