* [PATCH http-server 1/2] fix #8021: websocket: check length of close payload
@ 2026-09-09 12:03 Fabian Grünbichler
2026-09-09 12:03 ` [PATCH http-server 2/2] websocket: include close reason in debug log Fabian Grünbichler
2026-09-09 12:34 ` [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Dominik Csapak
0 siblings, 2 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2026-09-09 12:03 UTC (permalink / raw)
To: pve-devel
before unpacking the contained status code, otherwise the debug log might print
a warning.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/PVE/APIServer/AnyEvent.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 915d678..12701aa 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -674,8 +674,12 @@ sub websocket_proxy {
if ($opcode == 1 || $opcode == 2) {
$reqstate->{proxyhdl}->push_write($payload) if $reqstate->{proxyhdl};
} elsif ($opcode == 8) {
- my $statuscode = unpack("n", $payload);
- $self->dprint("websocket received close. status code: '$statuscode'");
+ if ($payload_len < 2) {
+ $self->dprint("websocket received close with too short payload: $payload_len");
+ } else {
+ my $statuscode = unpack("n", $payload);
+ $self->dprint("websocket received close. status code: '$statuscode'");
+ }
if (my $proxyhdl = $reqstate->{proxyhdl}) {
$proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf};
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH http-server 2/2] websocket: include close reason in debug log
2026-09-09 12:03 [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Fabian Grünbichler
@ 2026-09-09 12:03 ` Fabian Grünbichler
2026-09-09 12:36 ` Dominik Csapak
2026-09-09 12:34 ` [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Dominik Csapak
1 sibling, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2026-09-09 12:03 UTC (permalink / raw)
To: pve-devel
if given by the client.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/PVE/APIServer/AnyEvent.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 12701aa..44e4568 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -678,7 +678,9 @@ sub websocket_proxy {
$self->dprint("websocket received close with too short payload: $payload_len");
} else {
my $statuscode = unpack("n", $payload);
- $self->dprint("websocket received close. status code: '$statuscode'");
+ my $reason = substr($payload, 2, $payload_len - 2);
+ $reason = '-' if !$reason;
+ $self->dprint("websocket received close. status code: '$statuscode', reason: '$reason'");
}
if (my $proxyhdl = $reqstate->{proxyhdl}) {
$proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf};
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH http-server 1/2] fix #8021: websocket: check length of close payload
2026-09-09 12:03 [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Fabian Grünbichler
2026-09-09 12:03 ` [PATCH http-server 2/2] websocket: include close reason in debug log Fabian Grünbichler
@ 2026-09-09 12:34 ` Dominik Csapak
1 sibling, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-09-09 12:34 UTC (permalink / raw)
To: Fabian Grünbichler, pve-devel
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
On 9/9/26 2:03 PM, Fabian Grünbichler wrote:
> before unpacking the contained status code, otherwise the debug log might print
> a warning.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> src/PVE/APIServer/AnyEvent.pm | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
> index 915d678..12701aa 100644
> --- a/src/PVE/APIServer/AnyEvent.pm
> +++ b/src/PVE/APIServer/AnyEvent.pm
> @@ -674,8 +674,12 @@ sub websocket_proxy {
> if ($opcode == 1 || $opcode == 2) {
> $reqstate->{proxyhdl}->push_write($payload) if $reqstate->{proxyhdl};
> } elsif ($opcode == 8) {
> - my $statuscode = unpack("n", $payload);
> - $self->dprint("websocket received close. status code: '$statuscode'");
> + if ($payload_len < 2) {
> + $self->dprint("websocket received close with too short payload: $payload_len");
> + } else {
> + my $statuscode = unpack("n", $payload);
> + $self->dprint("websocket received close. status code: '$statuscode'");
> + }
> if (my $proxyhdl = $reqstate->{proxyhdl}) {
> $proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf};
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH http-server 2/2] websocket: include close reason in debug log
2026-09-09 12:03 ` [PATCH http-server 2/2] websocket: include close reason in debug log Fabian Grünbichler
@ 2026-09-09 12:36 ` Dominik Csapak
0 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2026-09-09 12:36 UTC (permalink / raw)
To: Fabian Grünbichler, pve-devel
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
On 9/9/26 2:03 PM, Fabian Grünbichler wrote:
> if given by the client.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> src/PVE/APIServer/AnyEvent.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
> index 12701aa..44e4568 100644
> --- a/src/PVE/APIServer/AnyEvent.pm
> +++ b/src/PVE/APIServer/AnyEvent.pm
> @@ -678,7 +678,9 @@ sub websocket_proxy {
> $self->dprint("websocket received close with too short payload: $payload_len");
> } else {
> my $statuscode = unpack("n", $payload);
> - $self->dprint("websocket received close. status code: '$statuscode'");
> + my $reason = substr($payload, 2, $payload_len - 2);
> + $reason = '-' if !$reason;
> + $self->dprint("websocket received close. status code: '$statuscode', reason: '$reason'");
> }
> if (my $proxyhdl = $reqstate->{proxyhdl}) {
> $proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf};
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-09 12:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09 12:03 [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Fabian Grünbichler
2026-09-09 12:03 ` [PATCH http-server 2/2] websocket: include close reason in debug log Fabian Grünbichler
2026-09-09 12:36 ` Dominik Csapak
2026-09-09 12:34 ` [PATCH http-server 1/2] fix #8021: websocket: check length of close payload Dominik Csapak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox