PDA

View Full Version : QWebView logouts while surfing



Qiieha
28th February 2014, 14:16
Hi guys,
I have a problem and need your help. I work with Qt 4.8.1
The problem:
I have one instance of QWebView and I set an url. Everything works and the page is loaded. The loaded WebApp requires login and uses cookies.
After login the user can navigate through the webapp. After several navigations (variable) the session seems to expire and the login page appears.

I tried a lots of things. I receive the cookie through QNetworkCookieJar and can read it.
The raw format of the cookie looks like this: JSESSIONID=C419FDE26FE26E68988AE3D6E3D90D77; secure; HttpOnly; domain=xxx.yyyy.com; path=/share/

So the cookie is there, but the session is lost after some navigations. Maybe you can give me a hint what's the problem. It's just one instance of QWebView and one WebApp!

And server config says, that a sessioncookie expires after one hour. On FireFox or Chrome it works as expected.

It would be very nice to solve this problem,
thank u

anda_skoa
28th February 2014, 16:09
One thing you could check by subclassing QNetworkCookieJar and overwriting cookiesForUrl() is, if the base implementation does not return the cookie and if it does indeed not, if it still has it.
You can then also check if maybe the URL changed, so it is no longer found.

Cheers,
_

Qiieha
3rd March 2014, 10:44
Thank you man. You shoved me in the right direction!!

The url changes every time, and after some navigations the cookie was lost. So I chache the session cookie, if get it, and append the cached cookie to the list of cookies in cookiesForUrl.
Now there aren't logouts --> perfect

bye ;)