1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-06 14:15:05 +00:00

rtorrent: fix SCGI headers

Newer versions of rtorrent stopped responding to these plugins, and
comparing it to another (working) XML-RPC client, the difference was the
1 after the SCGI in the header (\000 1 vs \001).

This matches up with the example on Wikipedia's "Simple Common Gateway
Interface" page.
This commit is contained in:
Matt Merhar 2025-07-21 22:19:27 -04:00
parent cceb4a7db7
commit 7106ecaec0
8 changed files with 16 additions and 16 deletions

View file

@ -78,7 +78,7 @@ sub rtorrent_version_lower_than {
}
my $line_version= "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>system.client_version</methodName></methodCall>";
my $llen = length $line_version;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\0001\000";
my $hlen = length $header;
$line_version= "${hlen}:${header},${line_version}";
print SOCK $line_version;
@ -98,7 +98,7 @@ my $pattern = qr/<value><(int|i4|i8|ex\.i8)>(\d+)<\/(int|i4|i8|ex\.i8)><\/value>
my $function = rtorrent_version_lower_than('0.9.0') ? 'get_memory_usage' : 'pieces.memory.current';
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>$function</methodName></methodCall>";
my $llen = length $line;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\0001\000";
my $hlen = length $header;
$line = "${hlen}:${header},${line}";