Results 1 to 12 of 12

Thread: how to make QHttp work with this URL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to make QHttp work with this URL

    Well, I just took the official HTTP example by Qt, and added your code to it:

    Qt Code:
    1. void HttpWindow::readResponseHeader(const QHttpResponseHeader &responseHeader)
    2. {
    3. // handle redirections
    4. if (responseHeader.statusCode() >= 300 &&
    5. responseHeader.statusCode() < 400 &&
    6. responseHeader.hasKey("location")) {
    7. http->get(responseHeader.value("location"));
    8. return;
    9. }
    10.  
    11. if (responseHeader.statusCode() != 200)
    12. //...
    13. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: how to make QHttp work with this URL

    But is that branch triggered for the redirected url or not?

  3. #3
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to make QHttp work with this URL

    Looks like that it gets to a redirection circle, i.e. site1 redirects to site2 which redirects to site1... I'm not sure how to work around this. Somehow it works only from browsers.

  4. #4
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to make QHttp work with this URL

    Sorry, I realized that there is a direct link:
    http://easynews.dl.sourceforge.net/s...ges/source.zip
    It works well with this link.

Similar Threads

  1. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  2. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  3. QHttp signals don't work !!
    By probine in forum Qt Programming
    Replies: 11
    Last Post: 11th January 2007, 15:02
  4. Why can't I make dynamic_cast work properly?
    By pir in forum General Programming
    Replies: 13
    Last Post: 18th July 2006, 16:17
  5. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19

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
  •  
Qt is a trademark of The Qt Company.