开发者

Increasing the maximum number of connections per host of QtWebKit

开发者 https://www.devze.com 2023-02-08 09:15 出处:网络
Question: How can the default limit of 6 connect开发者_JAVA百科ions per host be increased in QtWebKit?

Question:

How can the default limit of 6 connect开发者_JAVA百科ions per host be increased in QtWebKit?

Use case:

I've multiple QtWebKit (QWebView) panes displayed by a PySide application. (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. The solution would be to increase this limit, but I can't find the API for this.


There's no API for this. It's hardcoded in qhttpnetworkconnection.cpp in the following way

#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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消