mirror of
https://git.proxmox.com/git/pve-http-server
synced 2025-05-29 18:36:45 +00:00
Fix #1684 WebSocket proxy behind a buffered proxy.
The given patch fixes incoming WebSocket traffic behind buffered Proxies like NGINX. NGINX buffers multiple requests from the Browser into one frame and sends that to pveproxy, before this patch we then processed the first message of the frame and cleared the buffer which may contained more messages. With this patch we process each message and clear the buffer right. This fixes the "NoVNC blank screen" problem users reported on the forums.
This commit is contained in:
parent
0ef7efdb9d
commit
ed979f7a2c
@ -429,7 +429,7 @@ sub websocket_proxy {
|
||||
my $hdlreader = sub {
|
||||
my ($hdl) = @_;
|
||||
|
||||
my $len = length($hdl->{rbuf});
|
||||
while (my $len = length($hdl->{rbuf})) {
|
||||
return if $len < 2;
|
||||
|
||||
my $hdr = unpack('C', substr($hdl->{rbuf}, 0, 1));
|
||||
@ -463,7 +463,7 @@ sub websocket_proxy {
|
||||
|
||||
return if $len < ($offset + 4 + $payload_len);
|
||||
|
||||
my $data = substr($hdl->{rbuf}, 0, $len, ''); # now consume data
|
||||
my $data = substr($hdl->{rbuf}, 0, $offset + 4 + $payload_len, ''); # now consume data
|
||||
|
||||
my @mask = (unpack('C', substr($data, $offset+0, 1)),
|
||||
unpack('C', substr($data, $offset+1, 1)),
|
||||
@ -494,6 +494,7 @@ sub websocket_proxy {
|
||||
} else {
|
||||
die "received unhandled websocket opcode $opcode\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
my $proto = $reqstate->{proto} ? $reqstate->{proto}->{str} : 'HTTP/1.1';
|
||||
|
Loading…
Reference in New Issue
Block a user