is there an api to learn an url's lenght?...
Printable View
is there an api to learn an url's lenght?...
what do you mean by that??
when i am downloading a web page i want to show the progress.
so i think i need to knowthe lenght of the target url.
or is there a function that will show how much of the download progress is bening done???
ty yours, sincerely.
If you can see the raw HTTP header then look at the Content-Length: tag. This will be the number of bytes to expect AFTER the header VBCRLF+VBCRLF = header termination.
Some HTTP headers don't contain this so the only way to know if you received all the bytes is to wait for Connection-Close (socket close) in the latter case it's not possible to calculate the number of bytes you are expecting thus you cannot make a progressbar. This is why some downloads do not show %age complete.
So check for
Content-Length: xxxxxx
at the beginning of the file, then search for the crlfcrlf and count the number of bytes received AFTER this to caculate the progress.
This is all assuming you have access to raw header data. I didn't see any mention of the method used to download (Web browser control I assume?)
ty.