]> git.proxmox.com Git - pve-http-server.git/commitdiff
websocket: set $max_payload_size = 128*1024; (131072)
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 6 Jun 2018 15:30:40 +0000 (17:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 7 Jun 2018 08:08:59 +0000 (10:08 +0200)
AnyEvent checks rbuf_max after calling the callback (too late), so
we can receive larger data, because AnyEvent uses MAX_READ_SIZE=131072
to fill the buffer.

So a more elegant solution is to set $max_payload_size=128*1024. At least
I am not able to receive rbuf larger than 128*1024 now. But I keep the
protection from the previous patch - just to be sure.

PVE/APIServer/AnyEvent.pm

index 9efd662c14a41dbc52225a4f21dfe15de7773d01..190471a61a1fa1eb01eb96bb8456156baaae2a11 100755 (executable)
@@ -345,7 +345,7 @@ sub websocket_proxy {
        my $remhost;
        my $remport;
 
        my $remhost;
        my $remport;
 
-       my $max_payload_size = 65536;
+       my $max_payload_size = 128*1024;
 
        my $binary;
        if ($wsproto eq 'binary') {
 
        my $binary;
        if ($wsproto eq 'binary') {
@@ -375,7 +375,7 @@ sub websocket_proxy {
            $reqstate->{proxyhdl} = AnyEvent::Handle->new(
                fh => $fh,
                rbuf_max => $max_payload_size,
            $reqstate->{proxyhdl} = AnyEvent::Handle->new(
                fh => $fh,
                rbuf_max => $max_payload_size,
-               wbuf_max => $max_payload_size*10,
+               wbuf_max => $max_payload_size*5,
                timeout => 5,
                on_eof => sub {
                    my ($hdl) = @_;
                timeout => 5,
                on_eof => sub {
                    my ($hdl) = @_;