简体   繁体   English

增加每个QtWebKit主机的最大连接数

[英]Increasing the maximum number of connections per host of QtWebKit

Question: 题:

How can the default limit of 6 connections per host be increased in QtWebKit? 如何在QtWebKit中增加每个主机6个连接的默认限制?

Use case: 使用案例:

I've multiple QtWebKit (QWebView) panes displayed by a PySide application. 我有一个PySide应用程序显示的多个QtWebKit(QWebView)窗格。 (PyQt would also work the same way.) The default connection limit of 6 connections per host quickly became an obstacle, since persistent HTTP connections (Comet) are used for data communication by each of those Web panes. (PyQt也可以以相同的方式工作。)每个主机6个连接的默认连接限制很快成为障碍,因为持久HTTP连接(Comet)用于每个Web窗格的数据通信。 The solution would be to increase this limit, but I can't find the API for this. 解决方案是增加此限制,但我找不到此API。

There's no API for this. 这没有API。 It's hardcoded in qhttpnetworkconnection.cpp in the following way 它在qhttpnetworkconnection.cpp中以下列方式硬编码

#ifdef Q_OS_SYMBIAN
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 3;
#else
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
#endif

You can change it and build Qt yourself or you can make a quick and very dirty hack suggested by special on #qt irc.freenode.net IRC channel in the form of the following code 您可以自己更改它并构建Qt,或者您可以通过以下代码形式的#qt irc.freenode.net IRC频道特别建议快速且非常脏的黑客

hackUrl.setUserName(QString::number(qrand()));

Citing special : 引用特别

the username part of the URL is used in the connection cache, so as long as the username is different, that limit won't apply URL的用户名部分用于连接缓存,因此只要用户名不同,该限制就不适用

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

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