BUG/MEDIUM: h3: fix cookie header parsing
Cookie header are treated specifically to merge multiple occurences in a single HTX header. This is treated in a if-block condition inside the 'while (1)' loop for headers parsing. The length value of ist representing cookie header is set to -1 by http_cookie_register(). The problem is that then a continue statement is used but without incrementing 'hdr_idx' to pass on the next header. This issue was revealed by the introduction of commit : commitd6fb7a0e0f
BUG/MEDIUM: h3: reject request with invalid header name Before the aformentionned patch, the bug was hidden : on the next while iteration, all isteq() invocations won't match with cookie header length now set to -1. htx_add_header() fails silently because length is invalid. hdr_idx is finally incremented which allows parsing to proceed normally with the next header. Now, a cookie header with length -1 do not pass the test on header name conformance introduced by the above patch. Thus, a spurrious RESET_STREAM is emitted. This behavior has been reported on the mailing list by Shawn Heisey who found out that browsers disabled H3 usage due to the RESET_STREAM received. Big thanks to him for his testing on the master branch. This issue is simply resolved by incrementing hdr_idx before continue statement. It could have been detected earlier if htx_add_header() return value was checked. This will be the subject of a dedicated commit outside of the backport scope. This must be backported up to 2.6. (cherry picked from commit19942e3859
) Signed-off-by: William Lallemand <wlallemand@haproxy.org> (cherry picked from commit fda9a5e4351d9b11bc2c1562d86a2da292443298) Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
parent
db5c4b3d93
commit
b4e250237b
1
src/h3.c
1
src/h3.c
@ -544,6 +544,7 @@ static ssize_t h3_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
|
||||
|
||||
if (isteq(list[hdr_idx].n, ist("cookie"))) {
|
||||
http_cookie_register(list, hdr_idx, &cookie, &last_cookie);
|
||||
++hdr_idx;
|
||||
continue;
|
||||
}
|
||||
else if (isteq(list[hdr_idx].n, ist("content-length"))) {
|
||||
|
Loading…
Reference in New Issue
Block a user