简体   繁体   English

加入并发/相同的HTTP GET请求?

[英]Joining concurrent/identical HTTP GET requests?

Do browsers join concurrent identical HTTP GET requests? 浏览器是否加入并发的相同HTTP GET请求? At least, for static or cache-able content? 至少对于静态或可缓存内容?

That is, if something like this happens: 也就是说,如果发生这种情况:

| AJAX/HTTP-GET(resourceX)
| [start download]------------------------------------------->[finish download]
|
|            AJAX/HTTP-GET(resourceX)
|            [start download]--------->etc...
|
+------------------------------------------------------------------> Time

Will the browser figure out "Hey you're already trying to download resourceX! Don't try downloading it twice, it won't do anything!"? 浏览器会指出“嘿,您已经在尝试下载resourceX!不要尝试两次下载,它什么也不会做!”?

**Update: **更新:

Now of course, I can go to some site and try downloading a big file (eg, "BigFile"), and click the link twice; 当然,现在,我可以去某个站点尝试下载一个大文件(例如“ BigFile”),然后单击两次链接。 this will (duplicately) download both BigFile and BigFile(1). 这将(重复)下载BigFile和BigFile(1)。 Granted, it's an error on the user's part, but still... 当然,这是用户方面的错误,但仍然...

For cache-able resources (eg, downloading some javascript file), it seems pretty inefficient if browsers couldn't figure out these duplicates... 对于可缓存的资源(例如,下载一些javascript文件),如果浏览器无法找出这些重复项,则效率似乎非常低...

The browser won't notice. 浏览器不会注意到。 It acts just like regular HTTP traffic. 它的行为就像常规的HTTP流量一样。 It might cache the request once the first one is finished (if the proper cache-control fields are set), but concurrently, no. 一旦第一个请求完成(如果设置了正确的缓存控制字段),它可能会缓存请求,但同时不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM