[master] b21b0d7 Ident and type are optional

Federico G. Schwindt fgsch at lodoss.net
Wed Oct 26 16:14:05 CEST 2016


commit b21b0d7b326b18a808c26d4687fe87911a94f4fa
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Wed Oct 26 14:51:57 2016 +0100

    Ident and type are optional
    
    Update the code to accommodate this.  Originally reported by Reinis
    Rozitis (r at roze.lv) on varnish-misc.
    
    Fixes #2118.

diff --git a/bin/varnishtest/tests/u00002.vtc b/bin/varnishtest/tests/u00002.vtc
index d6aa4ef..173c9cd 100644
--- a/bin/varnishtest/tests/u00002.vtc
+++ b/bin/varnishtest/tests/u00002.vtc
@@ -24,3 +24,7 @@ shell "grep -q mempool ${tmpdir}/p2/stdout"
 err_shell "" "grep -q LCK.vbe.destroy ${tmpdir}/p2/stdout"
 
 shell "cmp -s ${tmpdir}/p1/stdout ${tmpdir}/p2/stdout"
+
+process p3 {varnishstat -1 -n ${v1_name} -f MAIN.cache_hit} -run
+
+shell "grep -q cache_hit ${tmpdir}/p3/stdout"
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 6af266e..67da9d6 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -379,10 +379,13 @@ vsc_filter_pt_list(struct VSM_data *vd)
 		VTAILQ_FOREACH_SAFE(pt, &vsc->pt_list, list, pt2) {
 			CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC);
 			VSB_clear(vsb);
-			VSB_printf(vsb, "%s.%s.%s",
-			    pt->point.section->type,
-			    pt->point.section->ident,
-			    pt->point.desc->name);
+			if (strcmp(pt->point.section->type, ""))
+				VSB_printf(vsb, "%s.",
+				    pt->point.section->type);
+			if (strcmp(pt->point.section->ident, ""))
+				VSB_printf(vsb, "%s.",
+				    pt->point.section->ident);
+			VSB_printf(vsb, "%s", pt->point.desc->name);
 			VSB_finish(vsb);
 			if (fnmatch(sf->pattern, VSB_data(vsb), 0))
 				continue;



More information about the varnish-commit mailing list