[master] e6f12e9 Prefer exact matches

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 8 13:36:50 CEST 2013


commit e6f12e901f00989f81dc745ad1aa9b9f93051c2e
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 8587fb1..e10567c 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -70,6 +70,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