[master] 04a8293 Fix boolean logic in http_GetHdrToken

Nils Goroll nils.goroll at uplex.de
Sun Sep 28 17:53:12 CEST 2014


commit 04a8293c8c51e5518965f8a52e2acf2e721d542c
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Sep 28 17:48:36 2014 +0200

    Fix boolean logic in http_GetHdrToken
    
    For quoted tokens, http_GetHdrToken should not try a case insensitive match
    if the sensitive match fails

diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 031b7dd..15605e1 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -443,8 +443,9 @@ http_GetHdrToken(const struct http *hp, const char *hdr,
 		}
 		/* Check for substrings before memcmp() */
 		if ((h + fl == e || vct_issepctl(h[fl])) &&
-		    ((quoted && !memcmp(h, token, fl)) ||
-		     !strncasecmp(h, token, fl))) {
+		    (quoted
+		    ? !memcmp(h, token, fl)
+		    : !strncasecmp(h, token, fl))) {
 			if (ptr != NULL) {
 				h += fl;
 				while (vct_islws(*h))



More information about the varnish-commit mailing list