在IE中挂接http / https协议会导致GET请求是顺序的 [英] Hooking the http/https protocol in IE causes GET requests to be sequential

查看:336
本文介绍了在IE中挂接http / https协议会导致GET请求是顺序的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 PassthruAPP 方法挂钩到IE发出的HTTP / HTTPS请求。



它大部分工作良好,但我注意到一个问题。一次只有一个下载线程处于活动状态,通常IE使用两个下载线程。我可以看到两个IInternetProtocol对象被创建,但IE一次只使用一个。



这是发生在IE7,我还没有尝试过其他版本。 / p>

问题似乎是,当 IInternetSession :: RegisterNameSpace 被调用时,IE会回到下载一个项目对于任何其默认处理程序。下面的代码会使 HTTP 下载顺序,即使我正在注册 HTTPS 处理程序。注册file://会导致同样的问题。

  CComPtr< IInternetSession> spSession; 
CoInternetGetSession(0,& spSession,0);

MetaFactory :: CreateInstance(CLSID_HttpSProtocol,& m_spCFHTTPS);
spSession-> RegisterNameSpace(m_spCFHTTPS,CLSID_NULL,Lhttps,0,0,0)


$ b b

这总是发生在页面上的前几个项目,但似乎在文档完成发布后,并发下载可能再次发生。例如在页面加载完成后执行的Javascript代码可以同时加载图像。 InternetProtocolRootEx :: StartEx()可以通过修补COM VTable来解决这个问题。

解决方案

注册的HTTP / HTTPS协议。因为这不直接取代协议处理程序,IE不会回退到单线程模型。



这里描述的技术:



http ://web.archive.org/web/20130313164317/http://www.blackfishsoftware.com/blog/don/passthroughapp_bho_toolbar_intercepting_requests_responses


I'm using the PassthruAPP method to hook into HTTP/HTTPS requests made by IE.

It's working well for the most part, however I noticed a problem. Only one download thread is active at a time, normally IE uses two download threads. I can see two IInternetProtocol objects getting created, but IE uses only one at a time.

This is happening with IE7, I haven't tried with other versions yet.

The problem seems to be that IE falls back to downloading items one at a time when IInternetSession::RegisterNameSpace is called for any of its default handlers. The code below causes HTTP downloads to be sequential even though I am registering a HTTPS handler. Registering for 'file://' causes the same problem.

CComPtr<IInternetSession> spSession;
CoInternetGetSession(0, &spSession, 0);

MetaFactory::CreateInstance(CLSID_HttpSProtocol, &m_spCFHTTPS);
spSession->RegisterNameSpace(m_spCFHTTPS, CLSID_NULL, L"https", 0, 0, 0)

This always happens for the first few items on the page, but it seems that after the document complete is issued, concurrent downloads can occur again. For example Javascript code that is executed after the page has finished loading can load images concurrently just fine.

解决方案

It's possible to get around this problem by patching the COM VTable for InternetProtocolRootEx::StartEx() on the registered HTTP/HTTPS protocols. Since this does not replace the protocol handler directly, IE won't fallback to the single thread model.

The technique is described here:

http://web.archive.org/web/20130313164317/http://www.blackfishsoftware.com/blog/don/passthroughapp_bho_toolbar_intercepting_requests_responses

这篇关于在IE中挂接http / https协议会导致GET请求是顺序的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆