From f6648d478b632bbd243ab374e24c02d566a4112b Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 27 Feb 2025 16:38:39 +0100 Subject: [PATCH] BUG/MINOR: h3: do not report transfer as aborted on preemptive response HTTP/3 specification allows a server to emit the entire response even if only a partial request was received. In particular, this happens when request STREAM FIN is delayed and transmitted in an empty payload frame. In this case, qcc_abort_stream_read() was used by HTTP/3 layer to emit a STOP_SENDING. Remaining received data were not transmitted to the stream layer as they were simply discared. However, this prevents FIN transmission to the stream layer. This causes the transfer to be considered as prematurely closed, resulting in a cL-- log line status. This is misleading to users which could interpret it as if the response was not sent. To fix this, disable STOP_SENDING emission on full preemptive reponse emission. Rx channel is kept opened until the client closes it with either a FIN or a RESET_STREAM. This ensures that the FIN signal can be relayed to the stream layer, which allows the transfer to be reported as completed. This should be backported up to 2.9. --- src/h3.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/h3.c b/src/h3.c index cb60e632e..b57916b10 100644 --- a/src/h3.c +++ b/src/h3.c @@ -2100,6 +2100,12 @@ static size_t h3_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count) * request, clients SHOULD continue sending the content of the request * and close the stream normally. */ + + /* TODO deactivate for now STOP_SENDING emission on complete response. + * In particular, this may prevent FIN transmission to stream layer + * which results in transfers reported as prematurely aborted (cL--). + */ +#if 0 if (unlikely((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) && !qcs_is_close_remote(qcs)) { /* Generate a STOP_SENDING if full response transferred before @@ -2108,6 +2114,7 @@ static size_t h3_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count) qcs->err = H3_ERR_NO_ERROR; qcc_abort_stream_read(qcs); } +#endif out: htx_to_buf(htx, buf);