Results 1 to 2 of 2

Thread: QHttp request failed

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QHttp request failed

    Hi,

    I'm developing an application that need to get a pair of values from a web.

    I have this piece of code:
    Qt Code:
    1. QHttpRequestHeader header("POST", PATH); QString str=LOGIN_STRING;
    2. QByteArray data=str.toUtf8();
    3. header.setValue("Host", HOST);
    4. header.setValue("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.4) Gecko/2008102920 "
    5. "Firefox/3.0.4 (.NET CLR 3.5.30729)");
    6. header.setValue("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    7. header.setValue("Accept-Language", "en-gb,en;q=0.5");
    8. header.setValue("Accept-Encoding", "gzip,deflate");
    9. header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
    10. header.setValue("Keep-Alive", "300");
    11. header.setValue("Connection", "keep-alive");
    12. header.setValue("Referer", REFERER);
    13. header.setValue("Cookie", COOKIE);
    14. header.setContentType("application/x-www-form-urlencoded");
    15. header.setContentLength(data.length());
    16. qDebug()<<header.toString();
    17. http->setHost(HOST, QHttp::ConnectionModeHttps);
    18. qDebug()<<http->request(header, data);
    To copy to clipboard, switch view to plain text mode 
    And this sends the request correctly (I think), and this is the event log (SIGNALS connected to SLOTS)
    2
    request: 1
    1 request finished
    request: 2
    status changed: 2
    status changed: 3
    send 586 586
    status changed: 6
    status changed: 0
    status changed: 2
    status changed: 3
    send 586 586
    status changed: 6
    status changed: 0
    status changed: 2
    status changed: 3
    send 586 586
    status changed: 6
    status changed: 0
    2 request finished
    done
    And no response header and no data.

    What's the problem?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QHttp request failed

    What is the status code of the second request?

Similar Threads

  1. Replies: 1
    Last Post: 9th September 2008, 00:10
  2. QHTTP get request
    By s410i in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2008, 17:35
  3. QHttp delaying requests
    By etru1927 in forum Qt Programming
    Replies: 8
    Last Post: 29th April 2008, 21:52
  4. Trouble sending request with QHttp
    By WinchellChung in forum Newbie
    Replies: 2
    Last Post: 27th June 2007, 18:50
  5. X Error of failed request - on exit
    By VorosM in forum Newbie
    Replies: 3
    Last Post: 12th April 2006, 09:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.