[Development] QtNetwork changes from QtDD SF 2011

Alexis Menard alexis.menard at openbossa.org
Tue Dec 6 16:53:41 CET 2011


On Dec 5, 2011, at 4:50 PM, Jeff Mitchell wrote:

> Hello,

Hi,

> 
> I was asked to put this information on the wiki, but wasn't actually
> sure where the correct place was to do it. I'll put the info here and it
> can be moved into the wiki later.
> 
> At the Contributor Day in San Francisco, a number of people met to
> discuss some of the issues involving QtNetwork, espcially
> QNetworkAccessManager (QNAM). The overall idea is that eventually
> QNetworkAccessManager, which is meant to generally be
> one-per-application, must be made thread-safe in order to fulfill this
> desired use.
> 
> Here are the notes from the discussion:
> 
> Long term: QNAM needs to be thread-safe (and each QNAM will be in its
> own thread)
> * As a result so does the cookie jar and disk cache (and these would not
> moveToThread())
> * After that, implement QNAM::setApplicationNetworkAccessManager()
> * QML can stop using multiple QNAMs and QNetworkProxyFactories (QNPFs) too.
> 
> Disk cache:
> * Get implementation from somewhere which is good enough for most
> applications
> * Set caching on by default: no
> 
> Cookie jar:
> * Get Alexi to redesign the API

I had a chat with Peter about that.

What QtWebKit need is (though we already implemented it, work-arounding the current issues) :

- setCookieFromUrl to not be magic. It may removes/update cookies and therefore If I implement a persistent storage it would be nice to know what is added/removed/updated from the internal list.
- I need some "hooks" whenever something is added/removed/updated from the internal list of cookie stored by QNetworkCookieJar. Basically all the black magic done by QNetworkCookieJar, I need to know about it so I can update accordingly where I store my cookies (read a SQL database). I was thinking that a couple of virtual method should be fine, for example :

void writeCookie(const QNetworkCookie &foo) {

// Store into my database

// Call the base class.
QNetworkCookieJar::write(cookie);

}

The base class just adding it into the list.

- Maybe put the security filtering into a separate virtual function (to make setCookieFromUrl less magical, even if the latter will call that function). Make the API looks nicer to me.

In the ideal world an add-on of Qt should give the possibility to have a persistent storage built in (Mac OS has an API cross OS/apps for that) for example a subclass of QNetworkCookieJar which already implement a SQL storage for example.

> * Need a default persistent cookie jar: possibly?
> * Talk to WebKit guys, see if we can make an addon based on their cookie jar
> 
> Application proxy:
> * Use system proxy by default
> 
> System proxy config:
> * Global proxy config needs to be in network manager/connection manager
> so there is a known place to fetch it before system proxies can be
> supported on non-Windows/MacOS
> 
> QNetworkProxyFactory:
> * queryProxy() needs to be documented that it must be thread-safe
> * proxyForQuery(): unlock mutex before calling user code
> 
> QSharedPointer:
> * Use for all three (disk cache, cookie jar, qnam) so that the user can
> keep a ref around if they want (also for the static methods)
> * Make QSharedPointer be able to delete properly with a forward declaration
> * QObject::connect needs to be able to take a QSharedPointer<QObject>
> * QObject::connect needs to be able to take a QWeakPointer<QObject>
> 
> Ultra long term (Qt6): Fix QIODevice to do zero-copy
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list