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 56C597103A for ; Mon, 17 May 2021 15:07:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 473E82C0C8 for ; Mon, 17 May 2021 15:07:41 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E39912C0B8 for ; Mon, 17 May 2021 15:07:36 +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 BD0EA43BE6 for ; Mon, 17 May 2021 15:07:36 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 17 May 2021 15:07:34 +0200 Message-Id: <20210517130735.17568-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210517130735.17568-1-d.csapak@proxmox.com> References: <20210517130735.17568-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 Adjusted score from AWL reputation of From: address 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 Subject: [pve-devel] [PATCH http-server 1/2] AnyEvent/websocket_proxy: remove 'base64' handling X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 13:07:41 -0000 novnc does not support this anymore since 2015, and neither does our xtermjs client. it is also not listed in IANAs list of websocket protocols [0]. so simply drop it and only send out binary frames and don't decode text frames 0: https://www.iana.org/assignments/websocket/websocket.xml#subprotocol-name Signed-off-by: Dominik Csapak --- src/PVE/APIServer/AnyEvent.pm | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index f0e2e68..a7d31cc 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -496,15 +496,6 @@ sub websocket_proxy { my $max_payload_size = 128*1024; - my $binary; - if ($wsproto eq 'binary') { - $binary = 1; - } elsif ($wsproto eq 'base64') { - $binary = 0; - } else { - die "websocket_proxy: unsupported protocol '$wsproto'\n"; - } - if ($param->{port}) { $remhost = 'localhost'; $remport = $param->{port}; @@ -520,13 +511,9 @@ sub websocket_proxy { my $string; my $payload; - if ($binary) { - $string = $opcode ? $opcode : "\x82"; # binary frame - $payload = $$data; - } else { - $string = $opcode ? $opcode : "\x81"; # text frame - $payload = encode_base64($$data, ''); - } + + $string = $opcode ? $opcode : "\x82"; # binary frame + $payload = $$data; my $payload_len = length($payload); if ($payload_len <= 125) { @@ -635,8 +622,6 @@ sub websocket_proxy { $payload ^= $mask; } - $payload = decode_base64($payload) if !$binary; - if ($opcode == 1 || $opcode == 2) { $reqstate->{proxyhdl}->push_write($payload) if $reqstate->{proxyhdl}; } elsif ($opcode == 8) { -- 2.20.1