Le 10/18/22 à 13:01, William Dauchy a écrit :
Hi Christopher,

Thanks for your reply.

On Tue, Oct 18, 2022 at 10:22 AM Christopher Faulet <cfau...@haproxy.com> wrote:
Since the 2.2, HAProxy responses don't close the client connections in K/A mode,
except for 400-Bad-Request and 408-Request-Time-out. It is the behavior with
default error messages. Of course, if a "Connection: close" header is found in a
custom reply, the client connection is closed.

Thus, in your case, if there is no "Connection: close" header in the response,
both http-request action (return and deny) should do the same and keep the
client connection alive.

So if you observe connection closing, it may be for something else. Maybe a
timeout. Or a bug...

ok I will investigate more.
To come back on the code path, was I wrong for the
`http_reply_and_close` difference?
Would you have a pointer so I may better understand where
`http_reply_and_close` would not close the connection in K/A mode?


On all HTX versions, K/A and close modes are handled in the H1 multiplexer. Thus, on these versions, http_reply_and_close() is only closing the stream. The multiplexer is responsible to close the client connection or not.

On pre-HTX versions, when http_reply_and_close() is used, the client connection is also closed. It is a limitation of of HAProxy versions using the legacy HTTP.

Note there is a case where the connection client may be closed. If the HAProxy response is returned before the end of the request, the client connection is closed. There is no (not yet) draining mode at the mux level.

--
Christopher Faulet


Reply via email to