Exactly, however, I have checked my script and it seems to run slightly
differently from running the script at the cmd prompt.
I think it may have something to do with the way the helper script is
called by quid and seems to run with c:\squid\sbin\ as the running
directory.
Here is the script:
The file foundurl.txt is never populated if it runs via squid, which is
why it seems to put the 302 as empty. But if I run same script from cmd
line then it populates foundurl.txt.
Unfortunately, when it comes to Perl and scripting generally I am a
total Noob.
BEGIN {$|=1};
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime;
while (defined($line = <STDIN>)) {
@hdr = split (/\s+/, $line);
$hdr[2] =~ s/\/-//;
$url = $hdr[1];
$user_ip = $hdr[2];
open (prof, ">>user_profile.txt");
print prof $user_ip;
while (<prof>) {
@user_prof = split(/\s+/, $_) if /$user_ip/;
}
close (prof);
$ran_num = rand (5);
$ran_num = int ($ran_num);
$cat = $user_prof[1];
open (selurl, "profile_$cat.txt");
while (<selurl>) {
$sel_url = $_ if /$ran_num/;
}
close (selurl);
substr($sel_url,0,2) = "";
($sec1,$min1,$hour1,$mday1,$mon1,$year1,$wday1,$yday1) = gmtime;
open (info, ">>foundurl.txt");
print info $sel_url;
close (info);
if ($min1 >= $min+1 && $sec1 > $sec) {
print "302:$sel_url\n";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime;
}
else {
print "$url\n";
}
}
-----Original Message-----
From: Henrik Nordstrom [mailto:henrik@henriknordstrom.net]
Sent: 14 March 2007 12:06
To: WRIGHT Alan
Cc: squid-users@squid-cache.org
Subject: RE: [squid-users] Question on 302 problem
ons 2007-03-14 klockan 11:01 +0100 skrev WRIGHT Alan:
> Thanks Henrik,
> Changed the helper to concurrency 0 and the 302 is now working.
>
> Only issue now is that the Location value is empty.
You mean that Squid is sending a 302 redirect with an empty "Location:"
header? Should not happen, and does not happen in my tests..
Regards
Henrik
Received on Wed Mar 14 2007 - 09:32:27 MDT
This archive was generated by hypermail pre-2.1.9 : Sat Mar 31 2007 - 13:00:02 MDT