1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-09 23:43:57 +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

@ -89,7 +89,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;
@ -113,7 +113,7 @@ my $function_multicall_arg = rtorrent_version_lower_than('0.9.0') ? '' : '<
my $function_hash = rtorrent_version_lower_than('0.9.0') ? 'd.get_hash=' : 'd.hash=';
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>$function_multicall</methodName><params>$function_multicall_arg<param><value><string>main</string></value></param><param><value><string>$function_hash</string></value></param><param><value><string>p.multicall=,p.is_encrypted=,p.is_incoming=</string></value></param></params></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}";