From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id AD3EE9115E for ; Wed, 7 Sep 2022 11:06:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9E68F2FE67 for ; Wed, 7 Sep 2022 11:06:10 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 7 Sep 2022 11:06:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 42C1843F31; Wed, 7 Sep 2022 10:58:31 +0200 (CEST) From: Daniel Tschlatscher To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com Date: Wed, 7 Sep 2022 10:56:26 +0200 Message-Id: <20220907085633.89113-1-d.tschlatscher@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.068 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pmg-devel] [PATCH http/common/manager/wt/backup/pmg v2] fix: #3971 Tasklog download button X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2022 09:06:10 -0000 This patch series' aim is to add a download button in the tasklog- viewer GUI so that users may access all parts of the tasklog more easily (The tasklog-viewer only displays 50 lines at a time). For this change in the GUI (proxmox-widget-toolkit) there were revised implementations for all backends (PVE, PMG and PBS) needed. Now, when the parameter 'limit' for the /log API call is set to '0', the backends will stream the file rather than returning a JSON array with the corresponding lines. (Beforehand, it would return 0 lines) I initially included a number of patches aimed at refactoring redundant implementations of downloading a file via a button click. However, after talking with Sterzy, Dominik and Aaron a bit about it, I decided to only send the "core" task log download patch series now, because the refactoring depends on the changes made in widget- toolkit, but is done in the same repositories as the backend patches. This would make both reviewing and applying them more confusing, and the refactoring patches are "a step removed" anyway from this patch series. Therefore, I am going to send a separate patch series for them later instead. During the implementation of the file stream download I found a bug concerning chromium browsers because of which downloads "randomly" fail. The problem was, when implementing the download through an html a tag and setting its property "download" to anything, (even undefined) with a not imported self-signed certificate, the download will fail once the SSL connection is reset. In my testing this was the case after about 5 seconds. This problem is especially pronounced in the PMG as there are less background calls in contrast to the PVE. The PBS, however, does not seem to suffer this error at all, because the SSL handshake timeout seems to not run out. Without the 'download' attribute you can't set the filename though. The file will only have a proper name if the server adds the correct 'content-disposition' header. A few calls to the 'downloadAsFile' function set the filename anyway, because in most cases the browser frontend is making enough polling calls so that the SSL handshake does not have to be executed for the download. (That is also why it probably did not come up before) This problem does not apply in Firefox as far as I could tell. See https://bugs.chromium.org/p/chromium/issues/detail?id=993362 for more information on this. -- Changes from v1 -- * Rewrote commit messages and cover letter * Got rid of some refactoring which were initially included (going to send as own patch series later) * Rebased to current repository versions Daniel Tschlatscher (1): make tasklog downloadable in the backup server backend src/api2/node/tasks.rs | 159 ++++++++++++++++++----------- 4 files changed, 107 insertions(+), 79 deletions(-) Daniel Tschlatscher (1): stream file method for PMG and PVE src/PVE/Tools.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) Daniel Tschlatscher (1): acknowledge content-disposition header src/PVE/APIServer/AnyEvent.pm | 3 +++ 1 file changed, 3 insertions(+) Daniel Tschlatscher (1): Revised task log API call when parameter 'limit' is 0 PVE/API2/Tasks.pm | 13 ++++++++++--- 3 files changed, 15 insertions(+), 24 deletions(-) Daniel Tschlatscher (1): revised task log download function in the PMG backend src/PMG/API2/Tasks.pm | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) Daniel Tschlatscher (3): Source file download call in central function add task log download button in TaskViewer src/Utils.js | 13 +++++++++++++ src/window/TaskViewer.js | 17 +++++++++++++++-- src/window/FileBrowser.js | 11 +++++------ 3 files changed, 38 insertions(+), 8 deletions(-) -- 2.30.2