Re: [squid-users] YouTube and other streaming media (caching)

From: Adrian Chadd <adrian_at_creative.net.au>
Date: Tue, 10 Jun 2008 11:25:22 +0800

Cool! Could you drop this stuff into a bugzilla ticket so it doesn't get lost?

Thanks!

Adrian

On Mon, Jun 09, 2008, Horacio Herrera Gonzalez wrote:
> Hi Adrian, Ray and everyone...
>
> Here is a little contribution for the store_url_rewrite script, this
> part deals with youtube and google video (At least, it works for
> now)...
>
> NOTES:
>
> 1) This code is different because is based on the examples for the
> url_rewrite_program
> (http://wiki.squid-cache.org/SquidFaq/SquidRedirectors) and that way
> was easier for me.
>
> 2) Warning! This code may match other sites not related to YT or GV.
>
> 3) I used "squid://" at the begining of the rewrited string to avoid
> matching another rule, I know it's not standard and I'm still hoping
> It doesn't cause any problems... Dear developers, please forgive my
> insolence... :-)
>
> --------------------
> $|=1;
> while (<>) {
> @X = split;
> $url = $X[0];
> $url =~ s@^http://(.*?)/get_video\?(.*)video_id=(.*?)&.*@squid://videos.youtube.INTERNAL/ID=$3@;
> $url =~ s@^http://(.*?)/get_video\?(.*)video_id=(.*?)$@squid://videos.youtube.INTERNAL/ID=$3@;
> $url =~ s@^http://(.*?)/videodownload\?(.*)docid=(.*?)$@squid://videos.google.INTERNAL/ID=$3@;
> $url =~ s@^http://(.*?)/videodownload\?(.*)docid=(.*?)&.*@squid://videos.google.INTERNAL/ID=$3@;
> print "$url\n";
> }
> --------------------
>
> 4) This is the relevant part of my squid.conf:
>
> acl store_rewrite_list url_regex ^http://(.*?)/get_video\?
> acl store_rewrite_list url_regex ^http://(.*?)/videodownload\?
> cache allow store_rewrite_list
>
> # Had to uncomment this again, because I couln'd login to google mail
> using IE6 (firefox had no trouble):
> acl QUERY urlpath_regex cgi-bin \?
> cache deny QUERY
>
> refresh_pattern ^http://(.*?)/get_video\? 10080 90% 999999
> override-expire ignore-no-cache ignore-private
> refresh_pattern ^http://(.*?)/videodownload\? 10080 90% 999999
> override-expire ignore-no-cache ignore-private
>
> storeurl_access allow store_rewrite_list
> storeurl_access deny all
>
> storeurl_rewrite_program /usr/local/bin/store_url_rewrite
>
> --------------------
>
> Regards,

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -
Received on Tue Jun 10 2008 - 03:22:45 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 10 2008 - 12:00:03 MDT