Results 1 to 2 of 2

Thread: QHTTP get request

  1. #1
    Join Date
    Jun 2008
    Posts
    9
    Thanks
    9
    Platforms
    Unix/X11 Windows

    Default QHTTP get request

    Hello!

    I'm trying to write a simple program for downloading pages. It works OK but only for some pages. For the other I'm getting an errors.I think that the GET request is too small, it contains to few informations. For instance the Qhttp GET request is:

    Qt Code:
    1. GET / HTTP/1.1
    2. Connection Keep-Alive
    3. Host www.wrotamalopolski.pl
    To copy to clipboard, switch view to plain text mode 

    and the same but browsers request is:

    Qt Code:
    1. GET / HTTP/1.1
    2. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
    3. Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    4. Cookie: ASP.NET_SessionId=hwasqe55zv... ble ble ble
    5. Accept-Language: pl-PL,pl,en-US,en
    6. Accept-Charset: ISO-8859-2,*,utf-8
    7. Accept-Encoding: gzip,deflate,bzip2
    8. If-Modified-Since: 128650639665900000
    9. Host: www.wrotamalopolski.pl
    10. Connection: Keep-Alive
    To copy to clipboard, switch view to plain text mode 

    And my question is if there are any functions to add User-Agent,Accept-Language etc. to the GET request in QHttp?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHTTP get request

    The problem certainly is not in Qt or handling the 302 response. As it is the server who sends weird answer, but what to expect from ASP.NET? Anyway, I've tried wireshark on that page and it appears that the website sent the same 302 response to the first Firefox request. So indeed it might depend on the optional request headers.

    To add these headers, you have to set up the QHttpRequestHeader object and pass it to QHttp::request(). I would start with adding Accept-Language and Accept-Charset.

  3. The following user says thank you to jacek for this useful post:

    s410i (5th September 2008)

Similar Threads

  1. Problem in using QHttp with QTimer
    By Ferdous in forum Newbie
    Replies: 2
    Last Post: 6th September 2008, 12:48
  2. QHttp delaying requests
    By etru1927 in forum Qt Programming
    Replies: 8
    Last Post: 29th April 2008, 21:52
  3. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  4. Trouble sending request with QHttp
    By WinchellChung in forum Newbie
    Replies: 2
    Last Post: 27th June 2007, 18:50
  5. QHttp internal error
    By LubosD in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2006, 09:57

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.