MEDIUM: rhttp: create session for active preconnect
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 3 Nov 2023 15:21:12 +0000 (16:21 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 22 May 2024 08:01:57 +0000 (10:01 +0200)
commit12c40c25a9520fe3365950184fe724a1f4e91d03
tree0bfc35c14907a53c5dce860e51c6a3319d048c9e
parent45b80aed70a597614e31b748328570785099dfec
MEDIUM: rhttp: create session for active preconnect

Modify rhttp preconnect by instantiating a new session for each
connection attempt. Connection is thus linked to a session directly on
its instantiation contrary to previously where no session existed until
listener_accept().

This patch will allow to extend rhttp usage. Most notably, it will be
useful to use various sample fetches on the server line and extend
logging capabilities.

Changes are minimal, yet consequences are considered not trivial as for
the first time a FE connection session is instantiated before
listener_accept(). This requires an extra explicit check in
session_accept_fd() to not overwrite an existing session. Also, flag
SESS_FL_RELEASE_LI is not set immediately as listener counters must note
be decremented if connection and its session are freed before reversal
is completed, or else listener counters will be invalid.

conn_session_free() is used as connection destroy callback to ensure the
session will be freed automatically on connection release.
include/haproxy/session.h
src/proto_rhttp.c
src/session.c