QtNetworkRequest return Not Acceptable
-
wrote on 24 Mar 2011, 09:40 last edited by
Hello all,
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);
QEventLoop loop;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();@
-
wrote on 24 Mar 2011, 09:53 last edited by
I can't find that error in the documentation for QNetworkReply. Where do you get that error from exactly ?
-
wrote on 24 Mar 2011, 10:07 last edited by
Here is the screenshot
!http://personaflag.com/images/QtNetworkReply-Message.png(QtNetworkReply Message)! -
wrote on 24 Mar 2011, 10:17 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.
-
wrote on 24 Mar 2011, 10:21 last edited by
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]
-
wrote on 24 Mar 2011, 10:25 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.
1/6