mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
CBOR in hex format as implemented in previous commit is convenient because the produced output is portable and can easily be embedded in regular syslog payloads. However, one of the goal of CBOR implementation is to be able to produce "Concise Binary" object representation. Here is an excerpt from cbor.io website: "Some applications also benefit from CBOR itself being encoded in binary. This saves bulk and allows faster processing." Currently we don't offer that with '+cbor', quite the opposite actually since a text string encoded with '+cbor' option will be larger than a text string encoded with '+json' or without encoding at all, because for each CBOR binary byte, 2 characters will be emitted. Hopefully, the sink/log API allows for binary data to be passed as parameter, this is because all relevant functions in the chain don't rely on the terminating NULL byte and take a string pointer + string length as parameter. We can actually rely on this property to support the '+bin' option when combined with '+cbor' to produce RAW binary CBOR output. Be careful though, as this is only intended for use with set-var-fmt or to send binary data to capable UDP/ring endpoints. Example: log-format "%{+cbor,+bin}o %(test)[bin(00AABB)]" Will produce: bf64746573745f4300aabbffff (output was piped to `hexdump -ve '1/1 "%.2x"'` to dump raw bytes as HEX characters) With cbor.me pretty printer, it gives us: BF # map(*) 64 # text(4) 74657374 # "test" 5F # bytes(*) 43 # bytes(3) 00AABB # "\u0000\xAA\xBB" FF # primitive(*) FF # primitive(*) |
||
---|---|---|
.. | ||
design-thoughts | ||
internals | ||
lua-api | ||
51Degrees-device-detection.txt | ||
acl.fig | ||
architecture.txt | ||
coding-style.txt | ||
configuration.txt | ||
cookie-options.txt | ||
DeviceAtlas-device-detection.txt | ||
gpl.txt | ||
haproxy.1 | ||
intro.txt | ||
lgpl.txt | ||
linux-syn-cookies.txt | ||
lua.txt | ||
management.txt | ||
netscaler-client-ip-insertion-protocol.txt | ||
network-namespaces.txt | ||
peers-v2.0.txt | ||
peers.txt | ||
proxy-protocol.txt | ||
queuing.fig | ||
regression-testing.txt | ||
seamless_reload.txt | ||
SOCKS4.protocol.txt | ||
SPOE.txt | ||
WURFL-device-detection.txt |