I already tried using the escaped %25.
The compilation succeeded, but the regexp didn't find a match in the
problematic URLs:
# If the URL ends with % and one digit (a broken hex value) - remove
the last 2 characters.
if (req.url ~ "(.*)%25[0-9a-fA-F]$") {
set req.url = regsub(req.url, "(.*)%25[0-9a-fA-F]$", "\1");
}
Thanks for your help,
Naama
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Poul-Henning Kamp
Sent: Monday, February 08, 2010 12:53 PM
To: Naama Bamberger
Cc: [email protected]
Subject: Re: Error compiling VCL when using '% in regexp
In message <[email protected]>,
Naama Bamberger writes:
>I get this error:
>
>Invalid hex char in %xx escape
>(input Line 107 Pos 28)
> if (req.url ~ "(.*)%[0-9a-fA-F]$") {
>---------------------------###--------------
>
Try: %25
One of the decisions I had most trouble with, was deciding which
kind of escape-mechanism we wanted for strings in VCL.
In the end I settled for URL-%xx encoding, because I pressume
webmasters know it, and because it avoids a nightmare of back-slashes
in regexps.
I'm not 100% convinced that was the perfect decision...
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
[email protected] | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
varnish-misc mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-misc