[Interest] Using cookies with Image.source

Jason H jhihn at gmx.com
Tue Aug 11 17:57:37 CEST 2015


> Sent: Tuesday, August 11, 2015 at 11:20 AM
> From: "Jason H" <jhihn at gmx.com>
> To: "interest at qt-project.org" <interest at qt-project.org>
> Subject: [Interest] Using cookies with Image.source
>
> I have an application that needs a user to login and maintain a cookie. The AJAX features work just fine. But when I set the Image.source property to a URL that is protected and requires a session cookie, it gets a 401.
> 
> How can I tell Image elements to use a cookie, the same cookie the AJAX login result got?
> _______________________________________________

So I'm digging into this some more, and I think I have a handle on the problem.

It seems the XmlHttpRequest() object uses a cookie-enabled QNetworkAccessManger, probably created with QQMLNetworkAccessManagerFactory.
It also seems that Image elements don't use the same one, because we login, get the cookie, the AJAX works, but the image elements don't (The server is not receiving a cookie from the Image) . So they must be using another QNetworkAccessManger, not created with QQMLNetworkAccessManagerFactory?

Isn't this a bug? Shouldn't the Image elements and the AJAX all be using the same factory?




More information about the Interest mailing list