readurl() fails when server is slow to respond
Forum rules
You might want to read this if you're looking for priority service
Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
You might want to read this if you're looking for priority service
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
-
40k
- Posts: 234
- Joined: 09 Dec 2011 21:25
readurl() fails when server is slow to respond
I'm getting Download Failed errors thrown by Xyplorer when I use readurl to download data from a Twitch.tv server.
It seems this server is sometimes slow to respond but will eventually send the data. By that time the script has already failed though.
I developed a while loop that keeps track of how many times the readurl fails before it pulls data from the server. The highest I have seen is 5 attempts before it reached the break function indicating data had been received.
Is it possible that the readurl and download functions can't deal with slow byte streams?
I could reproduce this bug using my code but is nested in a bigger script so it may take some time to extract it and turn it into a working standalone sample,
It seems this server is sometimes slow to respond but will eventually send the data. By that time the script has already failed though.
I developed a while loop that keeps track of how many times the readurl fails before it pulls data from the server. The highest I have seen is 5 attempts before it reached the break function indicating data had been received.
Is it possible that the readurl and download functions can't deal with slow byte streams?
I could reproduce this bug using my code but is nested in a bigger script so it may take some time to extract it and turn it into a working standalone sample,
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
You get "Download Failed" also when the downloaded bytes count is smaller than the filesize initially (before the download) determined by HttpQueryInfo API. Could that be the case? I never got this case in my tests (therefore I did not give an extra error message).
FAQ | XY News RSS | XY X
-
40k
- Posts: 234
- Joined: 09 Dec 2011 21:25
Re: readurl() fails when server is slow to respond
Is there any way around this? Perhaps a flag that enables less than perfect byte stream downloads?admin wrote:You get "Download Failed" also when the downloaded bytes count is smaller than the filesize initially (before the download) determined by HttpQueryInfo API. Could that be the case? I never got this case in my tests (therefore I did not give an extra error message).
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
Yes, I'll add something...40k wrote:Is there any way around this? Perhaps a flag that enables less than perfect byte stream downloads?admin wrote:You get "Download Failed" also when the downloaded bytes count is smaller than the filesize initially (before the download) determined by HttpQueryInfo API. Could that be the case? I never got this case in my tests (therefore I did not give an extra error message).
FAQ | XY News RSS | XY X
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: readurl() fails when server is slow to respond
Don, the new "b" option for download() has to be concatenated with other options or specified separately? I mean, the correct syntax is
or
?
Code: Select all
download $url, $target, "ob";Code: Select all
download $url, $target, "o", "b";Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
40k
- Posts: 234
- Joined: 09 Dec 2011 21:25
Re: readurl() fails when server is slow to respond
Perhaps one of the nicest things about Xyplorer is that it pretty much comes with its' own "on-call" developeradmin wrote:Yes, I'll add something...40k wrote:Is there any way around this? Perhaps a flag that enables less than perfect byte stream downloads?admin wrote:You get "Download Failed" also when the downloaded bytes count is smaller than the filesize initially (before the download) determined by HttpQueryInfo API. Could that be the case? I never got this case in my tests (therefore I did not give an extra error message).
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
40k
- Posts: 234
- Joined: 09 Dec 2011 21:25
Re: readurl() fails when server is slow to respond
It seems you enabled it for Download() only? All my scripts are based on ReadUrl() so I'll have to set up a test script.admin wrote:So it worked?
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
Yes, only Download().
Argh... tomorrow...
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
I'm surprised that you use ReadUrl() because it is limited to 100 MB whereas download() is not.
FAQ | XY News RSS | XY X
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: readurl() fails when server is slow to respond
I never encountered the OP's problem but so far the switch seems working. Already implementedadmin wrote:So it worked?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
40k
- Posts: 234
- Joined: 09 Dec 2011 21:25
Re: readurl() fails when server is slow to respond
I'm using ReadUrl() in my Twitch script because it only needs to get about 100KB worth of information from the Twitch API at any time. Coincidentally ReadUrl() only fails in a reproducible manner when downloading from Twitch.admin wrote:I'm surprised that you use ReadUrl() because it is limited to 100 MB whereas download() is not.
I'm waiting for you to release the next stable version before I'm switching my YouTube script over to Download().
I've set up the following experiment:
Code: Select all
download ("http://usher.twitch.tv/find/reckful.xml?type=any", file, o);
text readfile (file);When I leave out the byte check I have not yet encountered a "Download Failed" even after 30 attempts. This leads me to believe there may be an issue with the Twitch server response to Xyplorer HTTPquery call.
Conclusion: This "seems" to be fixed by leaving out the byte check.
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
Well, the OP's problem WAS the bytecheck which now is OFF by default. So when you "implement" (the "b" flag) it you are back exactly where you were before the change. Sure it works!Marco wrote:I never encountered the OP's problem but so far the switch seems working. Already implementedadmin wrote:So it worked?
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 67282
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: readurl() fails when server is slow to respond
Ok, that's good.40k wrote:Conclusion: This "seems" to be fixed by leaving out the byte check.
Now, that little byte check was implemented years ago on a whim -- actually I never thought it would ever catch a failed byte count. Now I see that the failure may as well be caused by a wrong file size retrieval or maybe even other causes. So, what the heck, I just removed the byte check by default from ReadURL() as well. Pass "4" with the 4th parameter if you still want to have it.
Coming with next version...
FAQ | XY News RSS | XY X
XYplorer Beta Club