想知道在流水线操作的背景下,是否有任何人可以提供有关HTTP 1.1是半双工还是全双工的令人信服的解释?据我所知,在客户端获得响应之前,可以通过同一个持久连接发送多个请求.那么这是否意味着服务器可以在客户端发送新请求时响应先前的请求?
vij*_*yst 21
HTTP是请求 - 响应协议.客户端发送请求.服务器等待直到收到完整的请求.然后发送回复.客户端和服务器无法同时发送.
全双工通道意味着客户端和服务器可以同时发送数据.电话线是全双工的示例.要在Web中实现全双工,建议使用Web套接字.建立Web套接字连接后,双方可以同时交换消息.Web套接字在TCP之上工作,不使用HTTP协议.
fvu*_*fvu 14
我们来看看标准,在这种情况下是RFC-2616.我们在第8.1.1节中找到了持久连接:
- HTTP requests and responses can be pipelined on a connection.
Pipelining allows a client to make multiple requests without
waiting for each response, allowing a single TCP connection to
be used much more efficiently, with much lower elapsed time.
Run Code Online (Sandbox Code Playgroud)
稍后在文件中:
8.1.2.2 Pipelining
A client that supports persistent connections MAY "pipeline" its
requests (i.e., send multiple requests without waiting for each
response). A server MUST send its responses to those requests in the
same order that the requests were received.
Run Code Online (Sandbox Code Playgroud)
正如在两种情况下都清楚地表明客户端可以在不等待响应的情况下发送请求,我认为可以说HTTP 1.1支持全双工.
编辑:在RFC-7230中,RFC集的一部分取代了RFC-2616,该声明变为:
A client that supports persistent connections MAY "pipeline" its
requests (i.e., send multiple requests without waiting for each
response). A server MAY process a sequence of pipelined requests in
parallel if they all have safe methods (Section 4.2.1 of [RFC7231]),
but it MUST send the corresponding responses in the same order that
the requests were received.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5734 次 |
最近记录: |