Re: [squid-users] url blocking

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 09 Feb 2011 21:27:25 +0000

On Wed, 9 Feb 2011 13:37:26 +0000, "Zartash ." <zartash_at_hotmail.com>
wrote:
> Dear All,We are blocking urls using url_regex feature (urls are stored
in
> a file), but we are unable to block urls having special characters (like
> complete youtube video links or urls having % sign or ? etc). Can any
one
> let me know how can we block specific urls (rather then blocking whole
> domain)?

To regex match characters which are reserved in regex you need to escape
them with \ characters:
  
  url_regex http://example.com/\?hello=world

matches: http://example.com/?hello=world

  % are slightly different, in URLs they are used to encode raw binary
characters. These are decoded back into binary form for the match. So your
pattern wanting to detect a specific one of these should match the binary
form. eg. %20 encodes hex binary 0x20 or character value 32 (spacebar).

Amos
Received on Wed Feb 09 2011 - 21:27:28 MST

This archive was generated by hypermail 2.2.0 : Thu Feb 10 2011 - 12:00:02 MST