Download files slow and confusing on HTML5

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DigNZ

We are using HTTPRequest node to download a file from the server. There is a progress bar that is polled every second to read get_downloaded_bytes() and set the progress to the amount downloaded.

Separately to that there is a listener on the signal for request_completed - i.e. if that signal fired before the progress bar completed the loading scene would complete.

On Desktop the file takes around 10 seconds to download and the progress bar moves along as expected.

On HTML5 export the browser dev tools show a similar download time (~10 seconds) and then they stop, but the http request has only downloaded about 25% of the bytes at that stage (and the progress bar shows this). get_downloaded_bytes() continues to increase periodically for another 30-40 seconds and fill the bar and the request_completed signal is fired. But for those 30-40 seconds the browser dev tools don’t show any activity - the file has already been downloaded as far as the browser is concerned.

Second request e.g., on refresh, the file is cached and takes no time at all.

What is happening? And why the large discrepancy between download times? 10 seconds on desktop vs 40 - 50 seconds on html5 on the same machine in the same network.