]> git.kaiwu.me - haproxy.git/commit
MINOR: log: add app_log_raw() and send_log_raw() for binary-safe logging
authorDragan Dosen <ddosen@haproxy.com>
Wed, 1 Jul 2026 08:18:49 +0000 (08:18 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2026 21:51:17 +0000 (23:51 +0200)
commit146015e58b142246b529390abd8886219460c344
treef011e2ae075daf3d5aae5b598f4e40ea6b3977bd
parent3ef29b43142e7c98d6f91f7a0d5e78969a04515a
MINOR: log: add app_log_raw() and send_log_raw() for binary-safe logging

app_log() and send_log() build the message with vsnprintf(), which stops
at the first NUL byte and therefore cannot emit an arbitrary binary
payload.

Add two variants that pass a pre-built <msg> of <len> bytes straight to
__send_log() without formatting it, so embedded NUL bytes are preserved:

  * app_log_raw()  : takes an explicit list of loggers and a tag
  * send_log_raw() : derives both from a proxy

The send path still strips trailing LF / NUL bytes (kept for the legacy
text logs), so the message must be self-terminating by its own encoding
and must not rely on a meaningful trailing '\n' or NUL.
include/haproxy/log.h
src/log.c