[Qt-interest] QNetworkAccessManager cache bug

Pascal Patry iscy at invalidip.com
Mon Jun 8 19:50:16 CEST 2009


There is a bug about the caching done with QNetworkDiskCache on 
QNetworkAccessManager. Setting the request to: 'QNetworkRequest::AlwaysCache' 
will make WebKit to start a download rather than showing the page. When using 
'QNetworkRequest::PreferCache', this won't happen.

You can easily modify the 'browser' demo coming with Qt to reproduce it.


QNetworkReply *NetworkAccessManager::createRequest(Operation op, const 
QNetworkRequest& req, QIODevice *outgoingData)
{
    QNetworkRequest request(req);

    request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, 
QNetworkRequest::AlwaysCache);
    return QNetworkAccessManager::createRequest(op, request, outgoingData);
}


Changing from AlwaysCache to PreferCache won't make it go through the network 
as expected.




More information about the Qt-interest-old mailing list