minmig 发表于 2010-07-19 18:32
squid 重定向的 问号问题
用squid做一个简单的重定向。
想把 http:// 192.168.0.2/get?url=http://download.aaa.com/new.exe
转译成 [url]http://download.aaa.com/new.exe[/url]
碰到这个 问号 头疼不已。
加了问号导致所有下载的文件名都变成 get.exe
去掉就正常。
下面是 转译的perl ,是根据网上的样子改的[code]#!/usr/bin/perl -wl
$|=1; # don't buffer the output
while (<>) {
($uri,$client,$ident,$method) = ( );
($uri,$client,$ident,$method) = split;
next unless ($uri =~ m,^http://.*get/?url=(/S*),);
$uri = "$1";
} continue {
print "$uri";
}
~[/code]用过 小括号 / 大括号 来转译。不过都没效果。
不知道哪位兄弟碰到过。