MEDIUM: cli: allow custom pattern for payload
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 27 Nov 2023 15:04:20 +0000 (16:04 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 28 Nov 2023 18:12:32 +0000 (19:12 +0100)
commite3557c7d45ba6805b39e716200f90a4c270d3f95
tree224e4df8af6c681959a0b3c180eff91bbdb05914
parent23c810d04244166a1a205de510b898cf8bba2a5c
MEDIUM: cli: allow custom pattern for payload

The CLI payload syntax has some limitation, it can't handle payloads
with empty lines, which is a common problem when uploading a PEM file
over the CLI.

This patch implements a way to customize the ending pattern of the CLI,
so we can't look for other things than empty lines.

A char cli_payload_pat[8] is used in the appctx to store the customized
pattern. The pattern can't be more than 7 characters and can still empty
to match an empty line.

The cli_io_handler() identifies the pattern and stores it, and
cli_parse_request() identifies the end of the payload.

If the customized pattern between "<<" and "\n" is more than 7
characters, it is not considered as a pattern.

This patch only implements the parser for the 'stats socket', another
patch is needed for the 'master CLI'.
include/haproxy/applet-t.h
src/cli.c