Add query string encoding & decoding functions

This commit is contained in:
Yorhel 2025-02-18 14:08:05 +01:00
parent 90cfd66069
commit 67e6d99f01
5 changed files with 120 additions and 15 deletions

View file

@ -13,7 +13,7 @@ sub start {
sub record($id, $type, $data, $pad=undef) {
$pad //= rand > 0.5 ? int rand(50) : 0;
my $msg = pack('CCnnCC', 1, $type, $id, length($data), $pad, 0) . $data . ("\0"x$pad);
is $remote->syswrite($msg, length($msg)), length($msg);
die "Short write" if $remote->syswrite($msg, length($msg)) != length($msg);
}
sub begin($id=1, $role=1, $keep=0) {