Does that mean that you have to add something to your request? Or do you mean that you get too few cookies but expect it to work?
Does that mean that you have to add something to your request? Or do you mean that you get too few cookies but expect it to work?
I need all four cookies it won't work with just one.
How does the QNetworkAccessManager's QNetworkCookieJar look?
Can you tell me how to check because allCookies() is protected and I don't want to subclass the whole class....![]()
I'd go or the cookiesForUrl function.
I insertedon line 7Qt Code:
To copy to clipboard, switch view to plain text mode
and in debug mode jar stayed empty until the program ended.
How does the original URL look? Do you try to login here, or do you try to access some location where you already are logged in? If so, how did you originally log in there?
You say that you reach the login/wrong password page, and that seems reasonable to me if you don't have any cookies...
Here is the deal:
1) I send the user and password to the server that the original http://abv.bg 's form will send the data.
2) The server returnes me "HTTP 302 Moved temporarily" and a link like:
http://mailXX.abv.bg/servlet/plogin?s=hewirhwekrjhwekjrhw.passportX" wher re X's are random nubers.
3) When I go to that page I get the same HTTP 302 Moved temprarily message but with differtent mailXX.
4) I go there and this page gives me 4 cookies: example:
and redirects me to "http://mailXX.abv.bg/app/j/home.jsp" whre the XX are from the last page . ( the page that gave me the cookies)Qt Code:
Set-Cookie: JSESSIONID=4D6B05D58928843F51D03F6D85ED5F40; Path=/app\r\n SET-COOKIE: _key=7710db16cea77c8152a557a0ab0469cc; Path=/app; HTTPOnly\r\n Set-Cookie: uhost=mail33.abv.bg; Domain=.abv.bg; Path=/\r\n Set-Cookie: usid=4D6B05D58928843F51D03F6D85ED5F40; Domain=.abv.bg; Path=/\r\nTo copy to clipboard, switch view to plain text mode
This is what I need. I used WGET to deal with the cookies and everything is ok, but my program reached version 1.00 and I want to remove it because it's stupid for the windows version to come with a hidden wget.exe in the same folder.
In general I'd say that what the server returns you could be a bit invalid. From what I understand (I could be wrong though) there should only be one header of each type therefore you only get one set-cookie header that contains all cookies that are to be set separated by semicolons.
QNetworkReply::header() should return you a QVariant when passed QNetworkRequest::SetCookieHeader. This variant is really QList<QNetworkCookie>. When you get hold of it, you can list its contents to check out what cookies you are set. Then you can store them in your cookie-jar.
Be sure to cast the variant to a proper type or else you will get an empty list like you do now.
I tried that on line 12 and 14 on the first post and "list" is empty.
Read again my last sentence and see what QVariant::toList() returns.
Makes cookies = QList<QNetworkCookie> and list = 0 itemsQt Code:
QList<QVariant> list = cookies.toList();To copy to clipboard, switch view to plain text mode
Bookmarks