BUG/MINOR: h3: do not report transfer as aborted on preemptive response
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Feb 2025 15:38:39 +0000 (16:38 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 18 Mar 2025 15:18:02 +0000 (16:18 +0100)
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.

(cherry picked from commit f6648d478b632bbd243ab374e24c02d566a4112b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 00177c6f78d37a7fdbf22d86f1eb7c7403035fbb)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>

src/h3.c

index 2e7c418..e68271c 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -2096,6 +2096,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
@@ -2104,6 +2110,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);