Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtNetworkRequest return Not Acceptable
I have built an application for mobile device that access an URL using code below, but I got the Not Acceptable message from the server (http://personaflag.com). Any one can help?
Thanks a lot.
mNetManager = new QNetworkAccessManager(this);
mResponse = mNetManager->get(QNetworkRequest(QUrl("http://personaflag.com"))); connect(mResponse,SIGNAL(finished()),&loop,SLOT(quit())); loop.exec(); QTextStream strStream; strStream.setDevice(mResponse); strResult = strStream.readAll();@
andre last edited by
I can't find that error in the documentation for QNetworkReply. Where do you get that error from exactly ?
Here is the screenshot
vcsala last edited by
As I know this is HTTP Error 406 ("status codes":http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) and you should check the Accept headers in your request and reply.
maybe you can suggest me what Accept headers that i should set on the request and reply?
[quote author="VCsala" date="1300961867"]As I know this is HTTP Error 406 ("status codes":http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) and you should check the Accept headers in your request and reply.[/quote]
florent.revelut last edited by
Would be worth using wireshark to drop actual communication and help pinpointing what is actually sent/received in your communication and comparing with a browser.
Can be linked to a lot of answer, from unexpected user agent on server side to wrong headers... When dealing with external website, you often have to fine tune headers to let them believe you're a standard browser.