]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: sample: add a generic reverse converter
authorManu Nicolas <e.nicolas@criteo.com>
Mon, 27 Apr 2026 14:57:58 +0000 (14:57 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 13 May 2026 14:45:25 +0000 (16:45 +0200)
commitf3fc68e3a20507fb4ce999ff9ff44b2bcf8e7a4c
tree72ddc1cce5acd4b5405e364496bb6a601c9d7ff1
parentc090e515027e39e0288ec4e774653b51f345925d
MINOR: sample: add a generic reverse converter

Some use cases benefit from reversing a string before passing it to other
converters or lookups. While reverse_dom addresses domain-specific label
reversal, a generic byte-wise string reversal remains useful on its own and can
also be combined with other converters such as concat().

A common lookup use case is turning a suffix match on the original string into
a prefix match on the reversed string. Prefix string matches use the
prefix-tree index (PAT_MATCH_BEG with pat_idx_tree_pfx), while end matches use
the string-list index (PAT_MATCH_END with pat_idx_list_str), so reversing
before map_beg can avoid linear suffix scans for large maps.

This patch adds a new string converter named "reverse". It reverses the input
string byte by byte and returns the resulting string unchanged otherwise. It
does not apply any domain-specific semantics or character-encoding semantics.

The documentation is updated and a reg-test is added to cover the basic
conversion as well as a simple composition with concat(.).
doc/configuration.txt
reg-tests/converter/reverse.vtc [new file with mode: 0644]
src/sample.c