Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

WaitTime - WinHttp vs URLDownloadToFile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WaitTime - WinHttp vs URLDownloadToFile

    With WinHttp you can do this:

    [code]iResult = pWHttp.WaitForResponse(WaitTime) ' Wait for response with a timeout of "WaitTime"

    But I'm not finding where the waittime for URLDownloadToFile is documented, nor do the arguments seem to allow setting the waittime.

    I did some tests on a few non-existent URLs and URLDownloadToFile returned almost immediately. But I've run other code that seems to indicate the API can also take it's sweet time when returning.

    I care because in gbThreads, when localizing the online image URLs there are well over 3K non-existent images specified in the 50K threads. For speed reasons, I'd like not to wait any longer than necessary to determine if a URL exists.

  • #2
    A timeout value won't effect the response to an invalid URL especially not for a vBulletin site or most other PHP based CMS sites.

    There's a difference between "WaitForResponse" time, which only comes into play if a server is not responding, and getting a response of "404 Not Found" The latter should return immediately. and URLDownloadToFile should give an error result.

    BUT. vBulletin doesn't even return a 404 error for an invalid URL, it returns a page with standard forum banner and footer and a small content message saying "Invalid Page URL. If this is an error and the page should exist, please contact the system administrator and tell them how you got this message.".

    Edit: VBBulletin does give a 404 response initially, but then delivers a lot more "200" content. So URLDownloadToFile should return immediately with an error result.
    Last edited by Stuart McLachlan; 7 Sep 2020, 06:04 PM.

    Comment


    • #3
      I've just had a look at exactly what vBulletin serves up with an invalid page URL. Did you know it still serves up your avatar image and a lot of other bits and pieces?

      I'd show you but apparently I've only got a couple of KB of upload quota left. Hopefully that will be reset eventually.

      Comment


      • #4
        Originally posted by Gary Beene View Post
        I care because in gbThreads, when localizing the online image URLs there are well over 3K non-existent images specified in the 50K threads. For speed reasons, I'd like not to wait any longer than necessary to determine if a URL exists.
        If the image is no longer in a reachable server, you get a quick response IE: 404
        the problem is images that were hosted outside of PB forum on servers/domains that no longer exist. Those will need timeout, and can take time.

        I don't know if it's possible to change URLDownloadToFile timeout behaviour.

        Comment


        • #5
          Originally posted by Rod Macia View Post

          If the image is no longer in a reachable server, you get a quick response IE: 404
          the problem is images that were hosted outside of PB forum on servers/domains that no longer exist. Those will need timeout, and can take time.

          I don't know if it's possible to change URLDownloadToFile timeout behaviour.

          Ah-ha! I wasn't thinking about remotely hosted images, just uploaded files on the forum. You are of course correct where another hosting server doesn't respond. There is then a timeout period

          Comment


          • #6
            Gary,
            José's IBindStatusCallback example may allow you to send an Abort if it doesn't start downloading after x ms.

            https://forum.powerbasic.com/forum/u...tcp#post764578

            Comment

            Working...
            X