diff --git a/rpc.cgi b/rpc.cgi index 275caa21b..daed9c304 100755 --- a/rpc.cgi +++ b/rpc.cgi @@ -13,8 +13,9 @@ use POSIX; &init_config(); if ($ENV{'REQUEST_METHOD'} eq 'POST') { local $got; - while(length($rawarg) < $ENV{'CONTENT_LENGTH'}) { - read(STDIN, $got, $ENV{'CONTENT_LENGTH'}) > 0 || last; + local $left = $ENV{'CONTENT_LENGTH'} - length($rawarg); + while($left > 0) { + read(STDIN, $got, $left) > 0 || last; $rawarg .= $got; } } @@ -49,9 +50,10 @@ if ($arg->{'newsession'}) { close(STDOUT); close(miniserv::SOCK); local $stime = time(); + local $rcount = 0; while(1) { local ($rawcmd, $cmd, @rv); - alarm(10); + alarm($rcount ? 360 : 60); open(FIFO, $fifo1) || last; while() { $rawcmd .= $_; @@ -98,6 +100,7 @@ EOF } close(FIFO); last if ($cmd->{'action'} eq 'quit'); + $rcount++; } unlink($fifo1); unlink($fifo2); diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index bca753d64..33db76c21 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -5998,7 +5998,7 @@ foreach my $sn (keys %remote_session) { delete($remote_session{$sn}); delete($remote_session_server{$sn}); } -foreach $fh (keys %fast_fh_cache) { +foreach my $fh (keys %fast_fh_cache) { close($fh); delete($fast_fh_cache{$fh}); } @@ -6015,7 +6015,7 @@ sub remote_error_setup $main::remote_error_handler = $_[0] || \&error; } -=head2 remote_rpc_call(server, structure) +=head2 remote_rpc_call(server, &structure) Calls rpc.cgi on some server and passes it a perl structure (hash,array,etc) and then reads back a reply structure. This is mainly for internal use only,