Description

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が知りたいです。

Steps to Reproduce
  1. Build attached sample project for Windows
  2. Run attached sample project ([Link Removed]) on Windows
  3. Look in the output for Recieved Size and Total Size values. Notice TotalSize correctly reports the actual total file size of the download
  4. Build and Run attached sample project on Mac or iOS
  5. Look in the output for Recieved Size and Total Size values. Notice TotalSize incorrectly reports the same size as Recieved Size, not the total file size

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentTools
Affects Versions4.12.54.13.24.14
Target Fix4.15
Fix Commit3202371
Main Commit3206922
CreatedNov 9, 2016
ResolvedNov 17, 2016
UpdatedSep 16, 2019