[squid-users] redirect based on url (302)

Amos Jeffries squid3 at treenet.co.nz
Thu Nov 1 04:13:19 UTC 2018


On 31/10/18 11:27 PM, uppsalanet wrote:
> Hi Amos,
> Is there a git that I can use to push stuff up?
> 

Do you mean to make a change PR against the official code?

The key details for people wanting to assist with Squid development are
linked from here: <https://wiki.squid-cache.org/DeveloperResources>



> I think you need to split the string in an other way, look into this
> example:
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> $|=1;
> while (<>) {
>      my $string = $_;
>      print "Received '\$_' = ".$_."\n";       
> 
>      $string =~ m/^(\d+)\s(.*)$/;
>      print "After regexp '\$string' = ".$string."\n";
>      print "After regexp '\$1' = ".$1."\n";           
>      print "After regexp '\$2' = ".$2."\n"; 
> 
>      ### Original split from sorce ###
>      ### This doesn't split anything looks like elements of an array?
>      #my ($cid, $uid) = ($1, $2);
>     
>      ### Split the string ###
>      ### Those two split based on one or more spaces
>      #my ($cid, $uid) = split(/\s+/ ,$_);
>      my ($cid, $uid) = split;
>      $cid =~ s/%(..)/pack("H*", $1)/ge;
>      $uid =~ s/%(..)/pack("H*", $1)/ge;
>      print "After split \$cid = ".$cid."\n";
>      print "After split \$uid = ".$uid."\n";
> }
> 
> Output from above with intake value '*130.238.000.00 muse.jhu.edu -*':
> Received '$_' = 130.238.000.00 muse.jhu.edu -
> After regexp '$string' = 130.238.000.00 muse.jhu.edu -
> /Use of uninitialized value $1 in concatenation (.) or string at
> ./sed_test_reg.pl line 13, <> line 1.
> After regexp '$1' = 
> Use of uninitialized value $2 in concatenation (.) or string at
> ./sed_test_reg.pl line 14, <> line 1.
> After regexp '$2' = /
> *After split $cid = 130.238.000.00
> After split $uid = muse.jhu.edu*
> 


$cid should be the concurrency channel ID.  Configured with the
"concurrency=N" option to external_acl_type in squid.conf. (Seems I
missed another bit of the config.)

If you are wanting to assist with fixing the helper, it could do with a
change to auto-detect whether the first column is a CID (numeric only)
or not (anything but whitespace following a numeral).


Amos


More information about the squid-users mailing list