ReceiveHTTPFile - Not really a Bug - therefore here

Everything else that doesn't fall into one of the other PB categories.
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

ReceiveHTTPFile - Not really a Bug - therefore here

Post by Thade »

Success=ReceiveHTTPFile(.......)
Success delivered in previous Versions the length of the received file
Now in 5.41 it is always 1 if it was ok

Was there a reason to change that?

Now it needs an additional FileSize() to make a quick check if the website/image/script-return has changed ...
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
Fred
Administrator
Administrator
Posts: 18247
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ReceiveHTTPFile - Not really a Bug - therefore here

Post by Fred »

If the file was empty, it would have return 0, even if the file was successfully created on disk. That's why it has been changed (the doc never specified it returned the length anyway).
User avatar
HeX0R
Addict
Addict
Posts: 1204
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: ReceiveHTTPFile - Not really a Bug - therefore here

Post by HeX0R »

Why not return -1 if no file has been downloaded?
This seems to fit better to the "PB-way" from my point of view (see FileSize() e.g.).

But anyway, this is more a Feature-Request and I would be the second one who would prefer it like this.
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

Re: ReceiveHTTPFile - Not really a Bug - therefore here

Post by Thade »

It does make sense to have files that are 0 Bytes long
I. e. a simple empty index.html in a subfolder of a webserver prevents that the file list is displayed if several settings on apache, php etc. are not complete or missing ...
That's why a Zero Result = ReceiveFTPFile(#Ftp,...) on Failure is wrong anyway ... it should be -1
FTP Programs transfer 0 Byte sized files without reporting errors ...

If you want to open a file you make If FileSize(-1, "file") > 0 anyway (you do not need an empty file with 0 Bytes to be opened (because you know what you get) and not one which does not exist -1)
The same happens to a downloaded website or image or echo of a php script ...

It was simple for years to check by a certain size of the file without opening it to know how to further handle interaction with php scripts without the extra command FileSize

Usually most things which have to do with network are based on how many Bytes are received or sent ... makes sense ... that happened with HTTP in the past ...

That's why I asked, if it has a special reason you changed it ... and made it incompatible with previous Versions ...
Although you never said it in the manual .. there are many things not told explicitly in the manual and still work ... :)
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
Post Reply