HTTP 服务器是否应该期望在同一 TCP 连接上接收具有不同 Host
字段的请求?尽管与直觉相反,RFC 2616 似乎并未明确禁止客户端在认为合适的情况下将请求多路复用到同一连接上的不同主机。
有没有相关文件的规范性规定禁止这样做?如果没有,是否有任何实际考虑可以有效地防止这种情况,从而允许服务器不检查每个请求的主机?
最佳答案
引用 Chromium 的 William Chan:
Beyond SPDY, this doesn't happen, except for proxy servers.
We've actually discussed reusing TCP connections to different hosts if the ip addresses overlap, but were considered about security and broken HTTP server implementations (let's say you have a reverse proxy HTTP server that has different application server backends, perhaps with different owners...a broken reverse proxy may just assume all connection reuse will be to the same application server backend, which would be bad).
所以这是很有可能的,尽管 Chromium 不这样做。
关于http - 不同的 HTTP 主机通过相同的 TCP 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12790440/