BUG/MINOR: h1: Reject empty coding name as last transfer-encoding value
The following Transfer-Encoding header is now rejected with a
400-bad-request:
Transfer-Encoding: chunked,\r\n
This case was not properly handled and the last empty value was just
ignored.
This patch must be backported as far as 2.6.
(cherry picked from commit 428451fe96d9ad9ba8ef0f0669e145a37d97304d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit f403f36c2a83fa6f4cec9eca17ff240b4a1213b9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit ca03901888637ee3e1db57a0124664bbc3ff2cd9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/h1.c b/src/h1.c
index 787b885..f4fb742 100644
--- a/src/h1.c
+++ b/src/h1.c
@@ -140,6 +140,10 @@
continue;
n = http_find_hdr_value_end(word.ptr, e); // next comma or end of line
+
+ /* a comma at the end means the last value is empty */
+ if (n+1 == e)
+ goto fail;
word.len = n - word.ptr;
/* trim trailing blanks */