浏览器多tab打开同一URL串行化的问题
最近同事”神经病”同学的项目中, 发现一个问题.
用firefox打开多个tab, 每个tab都去请求同一个URL(尽量同时), 会发现, 这些请求, 会被浏览器串行化.
也就是说, 浏览器会在第一个页面请求结束以后, 再发起第二个请求,
比如对于如下脚本:
<?php error_log("start . " . getmypid(). "\n"); sleep(5); error_log("end . " . getmypid() . "\n");
用firefox打开多个tab同时请求这个脚本, 观察error_log
start . 3734\n end . 3734\n start . 3733\n end . 3733\n start . 3733\n end . 3733\n
多方求证这个问题, 但无果, 得到的都是对这个现象的描述, 但没有得到为什么浏览器会这么做, 或者是什么让它们这么设计, 后来得到在mod_perl中的一段叙说:
Certain browsers will serialize requests to the same URL if accessed from different windows. For example if you have a CGI script that does:
for (1..100) {
print “$$: $_\n”;
warn “$$: $_\n”;
sleep 1;
}
And two concurrent requests are issued from different windows of the same browser (for those browsers that have this bug/feature), the browser will actually issue only one request and won’t run the second request till the first one is finished. The debug printing to the error_log file helps to understand the serialization issue.
Solution? Find a UA that doesn’t have this feature, especially if a command line UA will do (LWP comes to mind). As of this writing, opera 6, mozilla 1.0 on linux have this problem, whereas konqueror 3 and lynx don’t.
随后, 我验证了chrome也有这个问题, 不过上面的文字也说了, 这些是特定浏览器的特定行为, 比如命令行的wget, ab之类的就没有这个特定行为.
我也尝试翻看HTTP 1.1RFC和webkit的源代码, 不过也无奈找不到线索…
bitbull说可能是为了复用一个链接, 不过此时通过netstat, 会发现本地确实是打开了多个链接, 所以应该不是为了复用一个链接而这么设置的.
各位如果有对这个特性详细描述, 并且解释为什么这么设计的文档, 请一定转发一个给我.
thanks
- Android Manifest 用法
- Android学习笔记(二九):嵌入浏览器
- Mozilla发布新的移动网络浏览器Reference Browser,邀请您参与测试
- 深入Android Browser配置管理的详解
- mysql query browser中文乱码的解决方法
- jQuery 1.9移除了$.browser可以使用$.support来替代
- VS2013的Browser Link引起的问题
- 如何利用Object Browser图形化工具提高Oracle开发工作效率(一)SQL编写调试篇
- 如何在Web应用中集成摄像头拍照功能
- nodejs -- 前端设备是啥
- VS2013的Browser Link引起的问题
- 关于黑莓恢复中的部分功能分辨
- React 基础实例教程
- 通过snmp协议获取系统信息
- P2P技术和应用
- or Browser(洋葱浏览器)——一款使你匿名上网的浏览器
- Ubuntu下为Firefox安装Adobe Flash Playe
- SWT之java天气预报 .
- 手机端判断各个平台浏览器及操作系统平台
- Embedded browser not available