[PATCH] Make "done" function available in VCL

MAGNIEN, Thierry thierry.magnien at sfr.com
Thu Mar 6 11:31:49 CET 2014


Hi,

Here is a patch proposal in order to make "done" function available in VCL. It adds a "sub vcl_done" in VCL, which is called at beginning of cnt_done function. It allows to call a VMOD at the end of a request, whatever the status is (success, fail, timeout, etc.).

Tested on 3.0.5.

Best regards,
Thierry

diff -r 8f2ba576d90c bin/varnishd/cache_center.c
--- a/bin/varnishd/cache_center.c       Thu Mar 06 11:31:03 2014 +0100
+++ b/bin/varnishd/cache_center.c       Thu Mar 06 11:31:09 2014 +0100
@@ -311,6 +311,8 @@
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_ORNULL(sp->vcl, VCL_CONF_MAGIC);
 
+       VCL_done_method(sp);
+
        AZ(sp->obj);
        AZ(sp->vbc);
        sp->director = NULL;
diff -r 8f2ba576d90c lib/libvcl/generate.py
--- a/lib/libvcl/generate.py    Thu Mar 06 11:31:03 2014 +0100
+++ b/lib/libvcl/generate.py    Thu Mar 06 11:31:09 2014 +0100
@@ -92,6 +92,7 @@
        ('fetch',       ('error', 'restart', 'hit_for_pass', 'deliver',)),
        ('deliver',     ('restart', 'deliver',)),
        ('error',       ('restart', 'deliver',)),
+       ('done',        ('ok',)),
        ('init',        ('ok',)),
        ('fini',        ('ok',)),
 )





More information about the varnish-dev mailing list