BUG/MINOR: sample: Make sure to return stable IDs in the unique-id fetch
authorTim Duesterhus <tim@bastelstu.be>
Wed, 26 Feb 2020 15:20:49 +0000 (16:20 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Feb 2020 10:11:57 +0000 (11:11 +0100)
commite6cd345cef8e08d4cc8e11a6419bb2b18b93f93c
tree08a9e88933230eaabbd56a907da39b2539c14765
parent3f821294d81397ea2d5259d43fb2683b745c46af
BUG/MINOR: sample: Make sure to return stable IDs in the unique-id fetch

Previously when the `unique-id-format` contained non-deterministic parts,
such as the `uuid` fetch each use of the `unique-id` fetch would generate
a new unique ID, replacing the old one. The following configuration shows
the error:

  global
        log stdout format short daemon

  listen test
        log global
        log-format "%ID"
        unique-id-format %{+X}o\ TEST-%[uuid]

        mode http
        bind *:8080
        http-response set-header A %[unique-id]
        http-response set-header B %[unique-id]
        server example example.com:80

Without the patch the contents of the `A` and `B` response header would
differ.

This bug was introduced in commit f4011ddcf5b41284d2b137e84c25f2d1264ce458,
which was first released with HAProxy 1.7-dev3.

This fix should be backported to HAProxy 1.7+.

(cherry picked from commit 530408f976e5fe2f2f2b4b733b39da36770b566f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/http_fetch.c