[3.0] 7b4557a Prefer exact matches

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 22 13:27:01 CEST 2013


commit 7b4557a38969a3a000093c7f9ba9959cce5d3a6e
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Apr 8 13:31:27 2013 +0200

    Prefer exact matches
    
    If there are multiple matches for a given VSL tag (such as "Hit"
    matching both Hit and HitPass), prefer the one that is an exact match.
    
    Fixes #1288

diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 21cd8e9..070265d 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -67,6 +67,10 @@ VSL_Name2Tag(const char *name, int l)
 	for (i = 0; i < 256; i++) {
 		if (VSL_tags[i] != NULL &&
 		    !strncasecmp(name, VSL_tags[i], l)) {
+			if (strlen(VSL_tags[i]) == l) {
+				/* Exact match */
+				return (i);
+			}
 			if (n == -1)
 				n = i;
 			else



More information about the varnish-commit mailing list