GUACAMOLE-462: Report size of files downloaded via the static HTTP tunnel.

This commit is contained in:
Michael Jumper
2022-02-17 14:34:51 -08:00
parent 389bbece05
commit 2428c7eb14

View File

@@ -1365,6 +1365,14 @@ Guacamole.StaticHTTPTunnel = function StaticHTTPTunnel(url, crossDomain, extraTu
*/ */
var extraHeaders = extraTunnelHeaders || {}; var extraHeaders = extraTunnelHeaders || {};
/**
* The number of bytes in the file being downloaded, or null if this is not
* known.
*
* @type {number}
*/
this.size = null;
this.sendMessage = function sendMessage(elements) { this.sendMessage = function sendMessage(elements) {
// Do nothing // Do nothing
}; };
@@ -1411,6 +1419,9 @@ Guacamole.StaticHTTPTunnel = function StaticHTTPTunnel(url, crossDomain, extraTu
} }
// Report overall size of stream in bytes, if known
tunnel.size = response.headers.get('Content-Length');
// Connection is open // Connection is open
tunnel.setState(Guacamole.Tunnel.State.OPEN); tunnel.setState(Guacamole.Tunnel.State.OPEN);