RE: [squid-users] My PreDefined DownLoad

From: Vishal Agarwal <vishal_at_norpknit.com>
Date: Tue, 17 Jul 2012 18:01:44 +0600

-----Original Message-----
From: Eliezer Croitoru [mailto:eliezer_at_ngtech.co.il]
Sent: Tuesday, July 17, 2012 5:39 PM
To: Vishal Agarwal
Cc: squid-users_at_squid-cache.org
Subject: Re: [squid-users] My PreDefined DownLoad

On 7/17/2012 1:59 PM, Vishal Agarwal wrote:
> Dear All,
>
> Is there any way to replace the download location for some client PC via
> squid.
>
> Like if somebody is downloading say .torrent file from any location; he
> should end up with my predefined .torrent file located in my localhost web
> server location torrent file.
>
>
> Thanks/regards,
> Vishal Agarwal
>
>
try to not hijack other people threads to keep the list in order, please.

it can be done but it's preferred to redirect them into some html page
that is saying something about restrictions of the network.
you can use the url_rewrite_program.
i wrote some url_rewriter in these examples:
http://wiki.squid-cache.org/ConfigExamples/PhpRedirectors
http://wiki.squid-cache.org/ConfigExamples/DynamicContent/Coordinator#Store_
URL_Rewrite

mine uses regex to find a match.
if so will send a rewritten url to the server.
you can use it like this:
##start
#!/usr/bin/ruby
def main
   while request = gets
         request = request.split
      if request[0]
         case request[1]
           when /^http:\/\/.*\.torrent$/
             puts request[0] +
"302:http://server_ip_or_domain/302_torrent_forbidden.html"
           else
             puts request[0] + ""
         end
      else
         puts ""
      end
    end

end
STDOUT.sync = true
main
##end

Regards,
Eliezer

-- 
Eliezer Croitoru
https://www1.ngtech.co.il
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il
Hi Eliezer,
Thanks for your reply. If I have committed any mistake I apologize for that.
I am really interested in changing the download file; because I can generate
custom error message for some specific type of extensions.
Thanks/regards,
Vishal Agarwal
Received on Tue Jul 17 2012 - 11:59:12 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 17 2012 - 12:00:02 MDT