• Nils Goroll's avatar
    Add filters: regex objects to perform substitutions on bodies · f8fb9d5c
    Nils Goroll authored
    If the optional ``asfilter`` parameter to ``re.regex()`` is true, the
    vmod registers itself as a Varnish Fetch Processor (VFP) for use in
    `beresp.filters` and as a Varnish Delivery Processor (VDP) for use in
    `resp.filters`. In this setup, the `xregex.substitute_match()` and
    `xregex.substitute_all()` methods can be used to define replacements
    for matches on the body.
    
    Example:
    
    	    sub vcl_init {
    		new reiher = re.regex("r(ei)h(er)", asfilter = true);
    	    }
    	    sub vcl_deliver {
    		unset req.http.Accept-Encoding;
    		set resp.filters += " reiher";
    		reiher.substitute_match(1, "czapla");
    		reiher.substitute_match(2, "\1\2");
    		reiher.substitute_match(0, "heron");
    	    }
    f8fb9d5c
Name
Last commit
Last update
m4 Loading commit data...
pkg/rpm Loading commit data...
src Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
CHANGES.rst Loading commit data...
INSTALL.rst Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.rst Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...