From 2428c7eb148649e031258e7201491bbd1a66514b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 17 Feb 2022 14:34:51 -0800 Subject: [PATCH] GUACAMOLE-462: Report size of files downloaded via the static HTTP tunnel. --- guacamole-common-js/src/main/webapp/modules/Tunnel.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js b/guacamole-common-js/src/main/webapp/modules/Tunnel.js index 677c570bf..23657cddc 100644 --- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js +++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js @@ -1365,6 +1365,14 @@ Guacamole.StaticHTTPTunnel = function StaticHTTPTunnel(url, crossDomain, extraTu */ 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) { // 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 tunnel.setState(Guacamole.Tunnel.State.OPEN);