[master] 593465d84 h2: Polish duplicate pseudo-header error

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Nov 5 14:47:09 UTC 2020


commit 593465d84e269e60a66feebdd1f2cfa46694f44d
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Nov 5 08:11:24 2020 +0100

    h2: Polish duplicate pseudo-header error
    
    I find ":path: /foo" more descriptive than "/foo", even though I could
    infer which one it was...

diff --git a/bin/varnishd/http2/cache_http2_hpack.c b/bin/varnishd/http2/cache_http2_hpack.c
index 281fc7fac..6bc062ee1 100644
--- a/bin/varnishd/http2/cache_http2_hpack.c
+++ b/bin/varnishd/http2/cache_http2_hpack.c
@@ -95,6 +95,7 @@ static h2_error
 h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
 {
 	/* XXX: This might belong in cache/cache_http.c */
+	const char *b0;
 	unsigned n;
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
@@ -107,6 +108,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
 		return (H2SE_ENHANCE_YOUR_CALM);
 	}
 
+	b0 = b;
 	if (b[0] == ':') {
 		/* Match H/2 pseudo headers */
 		/* XXX: Should probably have some include tbl for
@@ -145,8 +147,8 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
 		/* Check for duplicate pseudo-header */
 		if (hp->hd[n].b != NULL) {
 			VSLb(hp->vsl, SLT_BogoHeader,
-			    "Duplicate pseudo-header: %.*s",
-			    (int)(len > 20 ? 20 : len), b);
+			    "Duplicate pseudo-header %.*s%.*s",
+			    (int)namelen, b0, (int)(len > 20 ? 20 : len), b);
 			return (H2SE_PROTOCOL_ERROR);	// rfc7540,l,3158,3162
 		}
 	} else {


More information about the varnish-commit mailing list