On 15/11/10 17:53, Rolf Loudon wrote:
hello

I've been trying and failing to match the user agent string for the browser acl 
type.  I would appreciate any help.  I don't know exactly what squid sees as 
the user agent but a capture of the traffic shows the user agent header and I'm 
basing it on what I see there.

The complicating fact is that a simple substring search won't work as there are 
multiple browsers with the same string.  I wish to match the Windows and Mac OS 
X version of Safari.  Its user agent string is shown as:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.18.1 
(KHTML, like Gecko) Version/5.0.2 Safari/533.18.5\r\n

Looking simply for "Safari" works but the same string is reported in Google's 
Chrome user-agent, which I don't want to match.

I've tried things like ".*Version.* Safari.*"  and including [0-9] groups for 
the version numbers, all to no avail.


Squid ACL delimit on whitespace. What the above means is:
   contains "Version" OR "Safari"

Prefix and suffix .* are not useful. The regex library assumes them to be present unless ^ and $ special characters are used to indicate otherwise.

What you are looking for is I think:
 acl safari browser Version/[^S]*Safari


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.9
  Beta testers wanted for 3.2.0.3

Reply via email to