Results 1 to 19 of 19

Thread: using Qhttp with www(x) sites

  1. #1
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Question using Qhttp with www(x) sites

    my current project involves using the qhttp class or qt-3.4 to connect to various sites, which worked fine until it encountered a request for a site like 'www3.someurl.com'

    It kicked back an error message that it couldn't find the host.

    how do you connect to www(x) sites ?

    Thanks in advance

  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: using Qhttp with www(x) sites

    Name of the server shouldn't have any impact on QHttp. Could you provide any example of non working URL?

  3. #3
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    www63.hattrick.org

    just don't spam or DNS them !

  4. #4
    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: using Qhttp with www(x) sites

    Does your application handle redirects?

    code: 302, reason: Object moved
    <head><title>Object moved</title></head>
    <body><h1>Object Moved</h1>This object may be found <a HREF="/Common/default.asp">here</a>.</body>

  5. #5
    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: using Qhttp with www(x) sites

    Quote Originally Posted by importantman
    www63.hattrick.org

    just don't spam or DNS them !
    Don't worry, I used QHttp to connecto to HT successfully. Some hattrick servers become unresponsive from time to time.

  6. #6
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    Quote Originally Posted by jacek
    Does your application handle redirects?
    Hmmm, not sure. I check the header and see if I'm reciveing a redirect, though I'd assum that a host not found would mean I'm not getting so much as a header, but I will see...

  7. #7
    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: using Qhttp with www(x) sites

    Can you connect to that particular server using a web browser?

  8. #8
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    yes, I can.

  9. #9
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    hmmm...

    maybe I am having problems because of syncing qhttp.

    The download procedure requires a series of downloads, so
    I was using this statement:

    while(http.state() != QHttp::Unconnected){;}

    so that my program flow could be one function, instead declaring a slot function for each download in the series. But that while loop isn't working. Any suggestions ?

  10. #10
    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: using Qhttp with www(x) sites

    QHttp needs a running event loop.

  11. #11
    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: using Qhttp with www(x) sites

    In short words, use signals and slots. For Hattrick I use the requestFinished slot and store a type of request along the request id. This way I know if I'm in a search-server, login, logout or download phase and can easily redirect to the appropriate method which handles the next phase.

  12. The following user says thank you to wysota for this useful post:

    importantman (31st March 2006)

  13. #12
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    > For Hattrick I use the requestFinished slot and store a type of request along the request id.

    that's a good idea, better than changing signal/slot connections !!

    (surprised someone here knows hattrick)

    btw: how do you enter quotes in this thing ?

    and jacek: what is a running event loop ?

  14. #13
    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: using Qhttp with www(x) sites

    Quote Originally Posted by importantman
    > For Hattrick I use the requestFinished slot and store a type of request along the request id.

    that's a good idea, better than changing signal/slot connections !!
    My first attempt was to change connections too (when I was still using Qt3), but after your post here I decided to change it in the new code (as I'm porting my HT app to Qt4) and thought this was much better idea. It took me about 15 minutes to implement the whole login process.

    (surprised someone here knows hattrick)
    Hattrick is a big family. Over half a milion people use it.

    btw: how do you enter quotes in this thing ?
    I don't understand. What quotes?

  15. #14
    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: using Qhttp with www(x) sites

    Quote Originally Posted by importantman
    what is a running event loop ?
    Event loop delivers events to objects. In Qt3 main event loop runs in the GUI thread (you start it when you invoke QApplication::exec()) and each time you open a modal dialog it creates its own temporary event loop.

    If event loop isn't running, your application doesn't process events and all event-driven parts are not functioning: widgets don't redraw themselves, user can't interact with your GUI, QSockets don't emit signals and so on.

    If you wait for something in a loop and you don't allow your application to process events (i.e. you block the event loop), it might occur that this loop is in fact an infinite loop.

  16. #15
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    Quote Originally Posted by wysota
    My first attempt was to change connections too (when I was still using Qt3), but after your post here I decided to change it in the new code (as I'm porting my HT app to Qt4) and thought this was much better idea. It took me about 15 minutes to implement the whole login process.
    Well, I used the state variable idea, and tydied up something else, and I can now connect to the next page, and even recieve the security code (cookie), but when I ask for the next page I get only the time-out response.

    Here's the cookie I get: ASPSESSIONIDSSSRBAQB=JMIGEOEDGPJOICJPBHBKGANJ;

    And my connection string for the next site: getStr="/common/players.asp?outputType=XML&actionType=view";

    I've tried pulling apart the cookie, but still no luck. Any suggestions ?


    BTW: Is your application published?
    BTW: How 'bout a friendly ?

  17. #16
    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: using Qhttp with www(x) sites

    Quote Originally Posted by importantman
    BTW: Is your application published?
    Not yet. I don't have time to finish it because I'm answering Qt questions here at QtCentre

    BTW: How 'bout a friendly ?
    Sure. But next week

    As for the cookie, I just set the cookie exactly as I receive it (maybe it's better to move this conversation to CHPP forum on HT? ), I don't even look at its contents.

    So in this case:
    Set-cookie: ASPSESSIONIDSSSRBAQB=JMIGEOEDGPJOICJPBHBKGANJ;
    Last edited by wysota; 3rd April 2006 at 10:17.

  18. #17
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    Quote Originally Posted by wysota
    As for the cookie, I just set the cookie exactly as I receive it (maybe it's better to move this conversation to CHPP forum on HT? ), I don't even look at its contents.

    So in this case:
    Set-cookie: ASPSESSIONIDSSSRBAQB=JMIGEOEDGPJOICJPBHBKGANJ;
    I tried the folks at the CHPP forum, but I think they all write in php. One guy told me to try using only the second part of the cookie string ( and I think he meant the part after the '=', but I'm not sure, It didn't work anyway.)

    Perhaps I have to have 'Set-cookie' instead of 'set-cookie' ? The header I recieve says 'set-cookie'. I'll try it anyway when I get home.

  19. #18
    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: using Qhttp with www(x) sites

    No... My mistake... it should be "cookie:" not "set-cookie:".

  20. The following user says thank you to wysota for this useful post:

    importantman (4th April 2006)

  21. #19
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    2
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: using Qhttp with www(x) sites

    Hey! It works! This is the last part of my program, all I have to do is write the mapping function (xml->sql) and I'm done. (at least with the first pre-release)

    check out hdm.sourceforge.net sometime when I build the release!

Similar Threads

  1. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41

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.