BUG/MEDIUM: mux-h2: handle remaining read0 cases
authorWilly Tarreau <w@1wt.eu>
Fri, 5 Feb 2021 10:41:46 +0000 (11:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Feb 2021 14:04:35 +0000 (15:04 +0100)
commit5554e636261a90f672e391e7e90c3089501a386d
treee941360d2c5ae5dc5f0cf815ec925560183d4eb3
parent99e4ce23d220f620b3bf2b8e2780a9b599ffba91
BUG/MEDIUM: mux-h2: handle remaining read0 cases

Commit 3d4631fec ("BUG/MEDIUM: mux-h2: fix read0 handling on partial
frames") tried to address an issue introduced in commit aade4edc1 where
read0 wasn't properly handled in the middle of a frame. But the fix was
incomplete for two reasons:

  - first, it would set H2_CF_RCVD_SHUT in h2_recv() after detecting
    a read0 but the condition was guarded by h2_recv_allowed() which
    explicitly excludes read0 ;

  - second, h2_process would only call h2_process_demux() when there
    were still data in the buffer, but closing after a short pause to
    leave a buffer empty wouldn't be caught in this case.

This patch fixes this by properly taking care of the received shutdown
and by also waking up h2_process_demux() on an empty buffer if the demux
is not blocked.

Given the patches above were tagged for backporting to 2.0, this one
should be as well.

(cherry picked from commit f09612289f4a6e358524df385473323ea4254883)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/mux_h2.c