How to find a cookie origin URL with QWebEngine
Hello to everyone.
I'm trying to improve the integration between Konqueror, the KDE browser, and QWebEngine and I'm struggling on how to deal with cookies. To fully integrate with the KDE environment I can't download files using
QWebEngineDownloadItembut I have to use the infrastructure provided by KDE, named KIO. The problem arises when downloading files from sites requiring authentication (for example, my bank site). To make the download work, I need to share cookies between QWebEngine and KIO. The problem is that to add a cookie to KIO I need to specify the URL it originates from but, unfortunately, as far as I can tell, QWebEngine and
QWebEngineCookieStorein particular don't provide this information.
For the time being, I found a workaround by registering the URL a
QWebEnginePageis navigating to from its acceptNavigationRequest method and using that URL from the slot connected to
QWebEngineCookieStore::cookieAddedsignal. However, I don't like this solution at all, also because there can be more than one page loading at the same time and I don't think there are warranties about the order the cookies will be added in this case. So, my question is: is there a way I'm overlooking to retrieve the origin URL from a cookie using the API provided by QWebEngine?
Thanks in advance