]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: rawsock: introduce CO_RFL_TRY_HARDER to detect closures on complete reads
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Sep 2025 12:05:55 +0000 (14:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Oct 2025 08:23:01 +0000 (10:23 +0200)
commit1afaa7b59d6c407d68683b821f3142654a37b17e
treedf136a497e53fd07e575374926acac3c6c99553b
parentdae4cfe8c57dc7644a7afd847d964c8d7444deda
MINOR: rawsock: introduce CO_RFL_TRY_HARDER to detect closures on complete reads

Normally, when reading a full buffer, or exactly the requested size, it
is not really possible to know if the peer had closed immediately after,
and usually we don't care. There's a problematic case, though, which is
with SSL: the SSL layer reads in small chunks of a few bytes, and can
consume a client_hello this way, then start computation without knowing
yet that the client has aborted. In order to permit knowing more, we now
introduce a new read flag, CO_RFL_TRY_HARDER, which says that if we've
read up to the permitted limit and the flag is set, then we attempt one
extra byte using MSG_PEEK to detect whether the connection was closed
immediately after that content or not. The first use case will obviously
be related to SSL and client_hello, but it might possibly also make sense
on HTTP responses to detect a pending FIN at the end of a response (e.g.
if a close was already advertised).
include/haproxy/connection-t.h
src/raw_sock.c