Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QtNetworkRequest return Not Acceptable

    Mobile and Embedded
    4
    6
    2107
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sigitpurnomo 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();@
      
      1 Reply Last reply Reply Quote 0
      • A
        andre last edited by

        I can't find that error in the documentation for QNetworkReply. Where do you get that error from exactly ?

        1 Reply Last reply Reply Quote 0
        • S
          sigitpurnomo last edited by

          Here is the screenshot
          !http://personaflag.com/images/QtNetworkReply-Message.png(QtNetworkReply Message)!

          1 Reply Last reply Reply Quote 0
          • V
            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.

            1 Reply Last reply Reply Quote 0
            • S
              sigitpurnomo 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]

              1 Reply Last reply Reply Quote 0
              • F
                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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post