[Development] QtNetwork changes from QtDD SF 2011

Peter Hartmann peter.hartmann at nokia.com
Wed Dec 7 11:19:05 CET 2011


On 12/06/2011 04:53 PM, ext Alexis Menard wrote:
> (...)
> - 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);
>
> }

yes, so as Alexis already said, we plan to introduce new virtual methods
virtual void insertCookie(...)
              deleteCookie(...)
              updateCookie(...)
              cookie(...)

which by default just do what QNetworkCookieJar currently does, i.e. 
manage everything in memory. In addition we can expose the security 
check as a new function "isCookieAccepted()" or so.

So that way one could implement a backend of choice, which could also be 
persistent; and we could have backends as Qt add-ons.

The burden of keeping everything in sync regarding several processes in 
Webkit 2 would be put on the implementor of that class; the base class 
wouldn't be able to deal with that. But since Webkit people plan to have 
a persistent cookie jar anyway I guess this would be fine.

Peter

>
> 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
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development


-- 
Qt Developer Days 2011 – REGISTER NOW!
October 24 – 26, Munich
November 29 – December 1, San Francisco
Learn more and Register at http://qt.nokia.com/qtdevdays2011



More information about the Development mailing list