Here's my code:
QList<QNetworkCookie>* cookies;
......
void MyPlayer::getMusicList(char type)
{
QString url
= constructGetUrl
(type
);
QNetworkRequest request(url);
request.
setHeader(QNetworkRequest
::CookieHeader,
QVariant::fromValue(*cookies
));
getPlayListReply = manager.get(request);
....
}
QList<QNetworkCookie>* cookies;
......
void MyPlayer::getMusicList(char type)
{
QString url = constructGetUrl(type);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::CookieHeader,QVariant::fromValue(*cookies));
getPlayListReply = manager.get(request);
....
}
To copy to clipboard, switch view to plain text mode
This function will be called twice.At first,the cookies has 2 items,and everything works fine.
After the request finishes,I receive two more cookie and I add them to the cookies.So I have
4 cookies totally.Then this function is called agian.But through a network sniffer tool,I see that
the request sending out only contains 1 cookie.The rest disappeared.
I also set a breakpoint after calling manager.get().
And through the "locals and watchers",I can see there're 4 cookies in the request.
Does anyone know why those three disappear?
Bookmarks