On sön, 2008-07-06 at 22:05 -0700, Shaine wrote: > Following is my script. > > #!/usr/bin/perl > # no buffered output, auto flush > use strict; > use warnings; > > my ($temp, $array, @array, $param_1, $param_2, $param_3, $new_uri); > > $|=1; > $temp = ""; > > > while (<STDIN>){ > #@array = split(/ /); > ($param_1, $param_2, $param_3) = split(/ /); > #if (!($array[1] =~ m#VALUE-X#)) { > if (!($param_2 =~ m#VALUE-X#)) { > $temp = $param_2; > if ($param_2 =~ m#\?#) { > $temp .= "&VALUE-X=652224848"; > }else { > $temp .= "?VALUE-X=652224848"; > } > $new_uri = ($param_1 . " " . $temp . " " . $param_3); > s#$param_2#$temp#; > #print $new_uri; > print; > }else { > print; > } > } If I understand the above correct you modify the second parameter sent to the script which is the requesting client ip... The URL is the first, and the only one used by Squid in responses. Here is a simplified version of that script which should work better I think (completely untested) ### BEGIN ### #!/usr/bin/perl use strict; use warnings; # no buffered output, auto flush $|=1; while (<STDIN>) { chomp; my ($url) = split(/ /); if (!($url =~ m#VALUE-X#)) { if ($url =~ m#\?#) { $url .= "&VALUE-X=652224848"; } else { $url .= "?VALUE-X=652224848"; } print $url."\n"; } else { print "\n"; } } ### END ### The chomp isn't stricly needed, but makes testing from command line easier as it's sufficient to then enter just the URL for proper results and not a complete url rewriter request. Regards Henrik
Attachment:
signature.asc
Description: This is a digitally signed message part