lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I wanted to show some progress when downloading big files with socket.http, had some problems and made some changes.
The main issue, I've had, is

* How to access the received headers from within the storing sink?

Main reason is, I need the "content-length" from the reply to calculate progress. Other reasons could be the "filename" header, which you will need, when the filename is not detectable from the url.

If you don't mind the extra connection, you can simply send
a HEAD request before the GET request. That will give you
the headers independently.