[Gambas-user] gb.net.curl, can't figure out how to get a filesize before download

Benoît Minisini g4mba5 at gmail.com
Mon Feb 1 19:27:45 CET 2021


Le 01/02/2021 à 19:23, Bruce Steers a écrit :
> Hi all.
> I got yet another Gambas upgrader on the way.
> 
> Differences are this one does not use git or any other external commands 
> outside of the gambas compile/install process. (oh except unzip as 
> gb.compress only does single files not archives)
> 
> Also it deals with no other branch/fork than the main gambas master or 
> stable.
> Branch is manually selected as master or stable and gb.net.curl is used 
> to download the archive, then unzip is used to extract the source folder.
> 
> Planned to be the "Simple" upgrader , no git fancy stuff. just download 
> the whole archive , install dependencies and then compile/install.
> 
> I've hit a problem trying to do what i suspect is simple when you know how.
> 
> I've figured out how to use HttpClient to start downloading the gambas 
> zip and save the file reporting the bytes download as it does.
> 
> But i tried reading the .Headers and other things to find the file size 
> before downloading but cannot find anything like "content-length" or 
> anything that looks like a file size where i get a list of headers.
> 
> Is there any simple way to get the downloads total file size before or 
> even during the download?
> 
> Thanks for any help :)
> BruceS
> 
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

Content-Length is not a mandatory header. So if it is not present, you 
can't know by advance the size of the download.

-- 
Benoît Minisini


More information about the User mailing list