- 論壇徽章:
- 0
|
用squid做一個簡單的重定向。
想把 http:// 192.168.0.2/get?url=http://download.aaa.com/new.exe
轉(zhuǎn)譯成 http://download.aaa.com/new.exe
碰到這個 問號 頭疼不已。
加了問號導(dǎo)致所有下載的文件名都變成 get.exe
去掉就正常。
下面是 轉(zhuǎn)譯的perl ,是根據(jù)網(wǎng)上的樣子改的- #!/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";
- }
- ~
復(fù)制代碼 用過 小括號 \ 大括號 來轉(zhuǎn)譯。不過都沒效果。
不知道哪位兄弟碰到過。 |
|