]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
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>
Thu, 27 Feb 2025 16:23:24 +0000 (17:23 +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.

src/h3.c

index cb60e632e0c26dc6dc973ba165e8280e4125060c..b57916b109b46c755e0086e15bcddc36e4e74f8f 100644 (file)
--- 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);