]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: Set conn-stream/channel EOI flags at the end of request
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Mar 2022 14:38:39 +0000 (15:38 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 8 Mar 2022 15:33:56 +0000 (16:33 +0100)
In HTX, HTX_FL_EOM flag is added on the message to notifiy the end of the
message was received. In addition, the producer must set CS_FL_EOI flag on
the conn-stream. If it is a mux, the stream-interface is responsible to set
CF_EOI flag on the input channel. But, for now, if the producer is an
applet, in addition to the conn-stream flag, it must also set the channel
one.

These flags are used to notify the stream that the message is finished and
no more data are expected. It is especially important when the message
itself it directly forwarded from one side to the other. Because in this
case, the stream has no way to see the HTX_FL_EOM flag on the
message. Otherwise, the stream will detect a client or a server abort,
depending on the side.

For the HTTP client, it is not really easy to diagnose this error because
there is also another bug hiding this one. All HTTP request analyzers are
not set on the input channel. This will be fixed by another patch.

This patch must be backported to 2.5. It is related to the issue #1593.

src/http_client.c

index b84e6178ef19374ded0b9f25b890350faff420b5..a9eff6467fe2b9726a1658fd49e23e6c5ab7061a 100644 (file)
@@ -720,8 +720,11 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
                                                goto more;
 
                                        /* if the request contains the HTX_FL_EOM, we finished the request part. */
-                                       if (htx->flags & HTX_FL_EOM)
+                                       if (htx->flags & HTX_FL_EOM) {
+                                               si->cs->flags |= CS_FL_EOI;
+                                               req->flags |= CF_EOI;
                                                appctx->st0 = HTTPCLIENT_S_RES_STLINE;
+                                       }
 
                                        goto more; /* we need to leave the IO handler once we wrote the request */
                                }