Licensee was looking for a way to get total file size to display download progress. On Windows (which uses the curl library for Http request/response), binding a function to the OnRequestProgress delegate and getting the FHttpResponsePtr from the FHttpRequestPtr and calling FHttpResponsePtr::GetContentLength() correctly returns the total file size.
Output from sample project
LogHttpTest:Warning: Received Size = 16384, TotalSize = 1291706, PercentDone = 1.27 LogHttpTest:Warning: Received Size = 32768, TotalSize = 1291706, PercentDone = 2.54 LogHttpTest:Warning: Received Size = 49152, TotalSize = 1291706, PercentDone = 3.81
On Mac total size returns the same value as received size, so it's not possible to calculate a percent done. (I only tested Mac, but if memory serves, the implementation is the same for Mac and iOS):
LogHttpTest:warning: Received Size = 81301, TotalSize = 81301, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 325157, TotalSize = 325157, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 589205, TotalSize = 589205, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 801741, TotalSize = 801741, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 1278325, TotalSize = 1278325, PercentDone = 100.00100.00
Originally reported here:
FHttpRequestPtrで、ダウンロードしているファイルのTotalSizeが知りたいです。
Head over to the existing Questions & Answers thread and let us know what's up.