]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: clarify matching strings on binary fetches
authorMathias Weiersmueller <mathias.weiersmueller@cyberheads.ch>
Mon, 2 Dec 2019 08:43:40 +0000 (09:43 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 3 Dec 2019 06:34:56 +0000 (07:34 +0100)
Add clarification and example to string matching on binary samples,
as comparison stops at first null byte due to strncmp behaviour.

Backporting all the way down to 1.5 is suggested as it might save
from headaches.

doc/configuration.txt

index 1e15ba4ecba001df362f363fdbee8f171b19b474..432c265aea155227f4f9b48365acd4dd91fafe5b 100644 (file)
@@ -12883,6 +12883,14 @@ string, then the matching will be performed ignoring the case. In order
 to match the string "-i", either set it second, or pass the "--" flag
 before the first string. Same applies of course to match the string "--".
 
+Do not use string matches for binary fetches which might contain null bytes
+(0x00), as the comparison stops at the occurrence of the first null byte.
+Instead, convert the binary fetch to a hex string with the hex converter first.
+
+Example:
+    # matches if the string <tag> is present in the binary sample
+    acl tag_found req.payload(0,0),hex -m sub 3C7461673E
+
 
 7.1.4. Matching regular expressions (regexes)
 ---------------------------------------------