[webkit-dev] cookies & qtwebkit with qt 4.4.3

Costa Basil costa_basil at yahoo.ca
Fri Nov 7 20:53:07 PST 2008


Just for the record, after digging up the code in arora (which is the next 
version of the browser demo) & sniffing the http traffic, the problem 
appears to be that the cookies that come back from the server are attached 
to a subdomain of the url host name and they are by default discarded 
by webkit.

So in the url I have something like: http://x1.x2.x3.com, while the cookies 
domain 
is x2.x3.com. Apparently these cookies are discarded.

Interesting enough, 
in the arora app someone added in the 
[cookiejar.cpp/List<QNetworkCookie> CookieJar::cookiesForUrl(const 
QUrl 
&url) const] the following block which fixed my problem. The block 
basically 
adds to the cookies list all the cookies that were assigned 
subdomains of 
the url host.

    // Not sure if this conforms to the 
cookie specification, in fact I am
    // pretty sure it incomplete and in 
the worst case a security hole.
    QList<QNetworkCookie> 
cookies;
    QString host = url.host();
    while 
(host.count(QLatin1Char('.')) > 0) {
        QUrl subUrl = url;
        
subUrl.setHost(host);
        cookies += 
QNetworkCookieJar::cookiesForUrl(subUrl);
        host = 
host.mid(host.indexOf(QLatin1Char('.')) + 1);
    }
    return 
cookies;


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20081107/65f17343/attachment.html>


More information about the webkit-dev mailing list