[fpc-pascal] download manager

Lukas Gebauer gebylist at mlp.cz
Sun Dec 23 14:50:53 CET 2012


> With HTTP my problem is that I can't find the way to get the size of the
> file on the server while HTTPSend.DownloadSize is giving me the size of
> what have been downloaded.

HTTP have a few ways how to download data. But not all ways know size of 
data. For example, in chunked way you know size of next chunk only. 
Remember your favourite web browser - sometimes it dowloading file, even 
it does not shot full file size! Here it is same!

If filesize or at least next chuk size is known, then it is in 
DownloadedSize property. It is designed for progress indicators.

However if you wish to know size of file o the server, try to ask you 
HTTP server by HEAD method (instead of GIT) and analyze 
THTTTPSend.Headers. See the Content-Length header.


--
Lukas Gebauer.

http://synapse.ararat.cz/ - Synapse Delphi and Kylix TCP/IP Library
http://geoget.ararat.cz/ - Geocaching solution





More information about the fpc-pascal mailing list