使用HTTP / 1.1 Pipelining发出多个请求 [英] Issuing multiple requests using HTTP/1.1 Pipelining
问题描述
使用HTTP / 1.1 Pipelining时标准对发出多个请求的说法是什么,而不等待每个请求完成?服务器在实践中做了什么?
When using HTTP/1.1 Pipelining what does the standard say about issuing multiple requests without waiting for each request to complete? What do servers do in practice?
我问,因为我曾经尝试过写一个会发出一批 GET
请求多个文件并记住收到错误。我不确定是否是由于我错误地发出 GET
或者需要等待每个单独的请求完成才发出下一个获取
。
I ask because I once tried writing a client which would issue a batch of GET
requests for multiple files and remember getting errors. I wasn't sure if it was due to me incorrectly issuing the GET
's or needing to wait for each individual request to finish before issuing the next GET
.
推荐答案
流水线就是这样 - 在飞行中有多个请求单一连接。
Pipelining is just that -- having more than one request "in flight" on a single connection.
在开放的互联网上,流水线技术并不常见,因为少数服务器和中介机构没有做到正确,后果搞乱流水线操作可能很严重(例如,将响应混合到两个不同的用户)。
On the open Internet, pipelining isn't very common, because a few servers and intermediaries don't get it right, and the consequences of messing up pipelining can be severe (e.g., mixing up responses to two different users).
请记住,只有HTTP / 1.1支持流水线操作;如果你有一个HTTP / 1.0服务器,或者中间有一个1.0代理,它可能不起作用。
Keep in mind that only HTTP/1.1 supports pipelining; if you have a HTTP/1.0 server, or a 1.0 proxy in the middle, it probably won't work.
此外,流水线操作只能用于幂等方法,如GET和HEAD; POST等不允许。
Also, pipelining can only be used on "idempotent" methods like GET and HEAD; it isn't allowed for POST, etc.
参见:
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-09#section-7.1。 2.2
这篇关于使用HTTP / 1.1 Pipelining发出多个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!