HEADSUP: regsub() changes in -trunk

Poul-Henning Kamp phk at phk.freebsd.dk
Fri Jun 20 14:30:49 CEST 2008


Those of you running -trunk should take note of this commit if
you use regsub() in your VCL.

I apologize for this kind of disruptive change, but the replacement
syntax was badly chosen and I needed to fix it before 2.0

Poul-Henning


----------------------------------------------------------------------------
Author: phk
Date: 2008-06-20 13:58:25 +0200 (Fri, 20 Jun 2008)
New Revision: 2741

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt_re.c
   trunk/varnish-cache/bin/varnishtest/tests/c00001.vtc
Log:

NB: FLAGDAY!

Make an executive decision, and change the regsub() replacement specifiers to
get something which is consistent and nontroubling for URL and query strings.

Since $ and & both are heavily used in query strings, we (DES & I)
have chosen to use \0 ... \9 for replacement indicators, with \0
being the "all matched text" replacement and \1...\9 replacing
with tne N'th paranthesized subexpressions.

   regsub("_barf_", "(b)(a)(r)(f)", "\0\4\3\2\\p") -> "_barffra\p_"

----------------------------------------------------------------------------

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list