Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QtNetworkRequest return Not Acceptable
Qt 6.11 is out! See what's new in the release blog

QtNetworkRequest return Not Acceptable

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 4 Posters 3.6k Views 1 Watching
  • 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 Offline
    S Offline
    sigitpurnomo
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sigitpurnomo
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vcsala
          wrote on last edited by
          #4

          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
          0
          • S Offline
            S Offline
            sigitpurnomo
            wrote on last edited by
            #5

            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
            0
            • F Offline
              F Offline
              florent.revelut
              wrote on last edited by
              #6

              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
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved