Commit 7c5b14c3 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Martin Blix Grydeland

h2: Polish duplicate pseudo-header error

I find ":path: /foo" more descriptive than "/foo", even though I could
infer which one it was...
parent 6329cd86
...@@ -93,6 +93,7 @@ static h2_error ...@@ -93,6 +93,7 @@ static h2_error
h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len) h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
{ {
/* XXX: This might belong in cache/cache_http.c */ /* XXX: This might belong in cache/cache_http.c */
const char *b0;
unsigned n; unsigned n;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
...@@ -105,6 +106,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len) ...@@ -105,6 +106,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
return (H2SE_ENHANCE_YOUR_CALM); return (H2SE_ENHANCE_YOUR_CALM);
} }
b0 = b;
if (b[0] == ':') { if (b[0] == ':') {
/* Match H/2 pseudo headers */ /* Match H/2 pseudo headers */
/* XXX: Should probably have some include tbl for /* 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) ...@@ -143,8 +145,8 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len)
/* Check for duplicate pseudo-header */ /* Check for duplicate pseudo-header */
if (hp->hd[n].b != NULL) { if (hp->hd[n].b != NULL) {
VSLb(hp->vsl, SLT_BogoHeader, VSLb(hp->vsl, SLT_BogoHeader,
"Duplicate pseudo-header: %.*s", "Duplicate pseudo-header %.*s%.*s",
(int)(len > 20 ? 20 : len), b); (int)namelen, b0, (int)(len > 20 ? 20 : len), b);
return (H2SE_PROTOCOL_ERROR); // rfc7540,l,3158,3162 return (H2SE_PROTOCOL_ERROR); // rfc7540,l,3158,3162
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment