Since the following patch, HTTP/3 trailers are only decoded when the
stream HTX buffer is empty, with previous data already consumed by the
upper layer. This is the simplest reason to ensure there is always
enough space for trailers decoding.
8020cefc30ceadf61b45130609b90fdbb0741840
BUG/MEDIUM: h3: prevent conn failure on trailers decoding without space
However, this check is also performed for an empty trailers frame, which
is unnecessary and thus suboptimal. Worse, QCS demux is blocked but when
it is woken up there is nothing left to decode as the empty trailers
frame header was already consumed and the demuxer starts on a new frame.
The trailer frame and its FIN signal are thus dropped.
To fix this, simply bypass the check on HTX buffer if the trailers frame
is empty. EOM is then reported and the rest of the frame parsing is
skipped.
Note that h3_resp_headers_to_htx() has a similar check. However, an
HTTP/3 headers frame cannot be empty as it must contain mandatory
pseudo-headers, thus an empty headers frame is rejected earlier.
This must be backported up to 2.8.
htx = htx_from_buf(appbuf);
data_ofs = htx->data;
/* Do not decode trailers if there is remaining data left, for similar
- * reasons as h3_resp_headers_to_htx().
+ * reasons as h3_resp_headers_to_htx(), unless trailer frame is empty.
*/
- if (!htx_is_empty(htx)) {
+ if (len && !htx_is_empty(htx)) {
qcs->flags |= QC_SF_DEM_FULL;
len = 0;
goto out;