PDA

View Full Version : Problem with QNetworkRequst and QNetworkCookie



MorrisLiang
26th May 2010, 20:10
Here's my code:


QList<QNetworkCookie>* cookies;
......
void MyPlayer::getMusicList(char type)
{
QString url = constructGetUrl(type);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::CookieHeader,QV ariant::fromValue(*cookies));
getPlayListReply = manager.get(request);
....
}

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?