]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
NULL terminate the URL
authorwessels <>
Thu, 13 Aug 1998 22:52:25 +0000 (22:52 +0000)
committerwessels <>
Thu, 13 Aug 1998 22:52:25 +0000 (22:52 +0000)
scripts/icp-test.pl

index fb36455ba9f4de3662dbf408d93124c85798cb99..73abe9cfd1ef80ebb8534502f0b9096696796ff0 100755 (executable)
@@ -71,11 +71,21 @@ while ($ARGV[0] =~ /([^:]+):(\d+)/) {
        shift;
 }
 
+$rn = 0;
 while (<>) {
        print;
        chop;
-       $request_template = 'CCnx4Nx4x4a4a' . length;
-       $request = pack($request_template, 1, 2, 24 + length, $flags, $myip, $_);
+       $len = length($_) + 1;
+       $request_template = sprintf 'CCnNNa4a4x4a%d', $len;
+       $request = pack($request_template,
+               1,              # C opcode
+               2,              # C version
+               24 + $len,      # n length
+               ++$rn,          # N reqnum
+               $flags,         # N flags
+               '',             # a4 pad
+               $myip,          # a4 shostid
+               $_);            # a%d payload
        $n = 0;
        foreach $host (keys %ADDR) {
                $port = $PORT{$host};