Re: [squid-users] Storeurl program,what's wrong with it ?

From: Eliezer Croitoru <eliezer_at_ngtech.co.il>
Date: Wed, 05 Dec 2012 15:49:36 +0200

Hey 金 戈,

Squid storeurl_rewrite feature was introduced in squid version 2.6-7
which is not supported anymore.

I am working on another version which called StoreID which replaces
storeurl_rewrite.
It will be integrated into squid 3.3 which is now on Beta.
To find out what is your error you should understand better what you are
aiming for.

If you are willing to try the new feature it will be available soon.

Just a Note on your small program:
The regex you are using is not optimized and you should use less ".*"
and use a more strict approach on letters and characters.

Regards,
Eliezer

On 12/5/2012 2:49 PM, 金 戈 wrote:
> Hi everyone!
>
> I use squid with our ISP services.
>
> And now we use storeurl_rewrite_program for rewrite some video cache for our user. But after a few days draggle and google. We found it's so difficult for us to do this. I can't find where is the error of my configuration.And i hope someone can help.
>
> This is my core thing about the rewrite program.
> The squid.conf
>
> acl store_rewrite_list referer_regex ^http://static.youku.com/.*$
> storeurl_access allow store_rewrite_list
> storeurl_access deny all
> storeurl_rewrite_program /var/squid/run/squid/store_url_rewrite.py
> ------------------------
>
> this is my store_url_rewrite.py
> -------------------------
> #!/usr/bin/env python
> import re
> import sys
> YOUKU=re.compile("http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/youku/.*/(.*-.*-.*-.*-.*)\?.*")
>
> def modify_url(line):
> list = line.split(' ')
> old_url = list[0]
> new_url = '\n'
> is_match = YOUKU.search(old_url)
> if is_match:
> new_url='http://www.youku.com/'+is_match.group(1)+new_url
> return new_url
>
> while True:
> line = sys.stdin.readline().strip()
> new_url = modify_url(line)
> if new_url:
> sys.stdout.write(new_url)
> sys.stderr.write("\n\nREWRITE:"+new_url+'\nORI:'+line)
> else:
> sys.stdout.write(line+'\n')
> sys.stderr.write("NOREWRITE:"+line+'\n')
> sys.stdout.flush()
>
>
> ------------------------------------
> throught the stderr , I can find the new_url already write to the log file.But I can't found the it in the store.log
>
> The cache.log
>
> REWRITE:http://www.youku.com/030002050050BCAFBB490B03BAF2B1A20A79FD-0282-DEA6-350C-E810E14BAA19.flv
> ORI:http://118.180.3.36/youku/6971A9C8A1E348250177A4314B/030002050050BCAFBB490B03BAF2B1A20A79FD-0282-DEA6-350C-E810E14BAA19.flv?start=17 192.168.108.14/- - GET - myip=192.168.137.20 myport=3128
>
> But there is no
> object http://www.youku.com/030002050050BCAFBB490B03BAF2B1A20A79FD-0282-DEA6-350C-E810E14BAA19.flv in store.log
>
>
> Thanks for your help!
>
> Best wishes!
>
>

-- 
Eliezer Croitoru
https://www1.ngtech.co.il
sip:ngtech_at_sip2sip.info
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il
Received on Wed Dec 05 2012 - 13:49:50 MST

This archive was generated by hypermail 2.2.0 : Wed Dec 05 2012 - 12:00:03 MST