[6.0] 7c5b14c34 h2: Polish duplicate pseudo-header error

Martin Blix Grydeland martin at varnish-software.com
Tue Nov 8 10:03:08 UTC 2022


commit 7c5b14c346eac7b5dace4d3a8eceb13ed03273ee
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 d43262916..5c791a103 100644
--- a/bin/varnishd/http2/cache_http2_hpack.c
+++ b/bin/varnishd/http2/cache_http2_hpack.c
@@ -93,6 +93,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);
@@ -105,6 +106,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
@@ -143,8 +145,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