Forum Discussion
Nat_Thirasuttakorn
Employee
Nov 09, 2004HTTP::payload vs Null/binary insertion
Hi all,
I have try to insert binary data into HTTP payload by "HTTP::payload replace" command but it insert not as I expected.
for example:-
HTTP::payload replace offset 0 [binary format "B8B8" 00000000 10010110]
HTTP::payload replace [HTTP::header "Content-Length"] 0 "\000\226"
it inserted [C0 80 C2 96] instead of [00 96]
anyone could tell me the right way to insert/replace binary and Null character in HTTP (TCP/UDP) payload.
Note: If i insert the binary character into bigip.conf directly by hex editor or command like "printf" it works (except Null).
Thanks in advance
Best regards,
Nat
5 Replies
- unRuleY_95363Historic F5 AccountI believe this is a Utf problem.
[C0 80] is the Utf equivalent to Null.
I need to check into this a bit and get back to you. - bl0ndie_127134Historic F5 AccountLooks like you have found a problem with the payload command. What's happening is that the binary data outside the value of 1 and 127 is being expanded into 2 byte UTF form when its marshalled into BigIP. We are looking into this problem (CR42507) and we should have a fix available with BigIP 9.03.
- Nat_Thirasuttakorn
Employee
Thanks for all reply - Nat_Thirasuttakorn
Employee
I have tested with new hotfix for 9.0.2. (regarding solution SOL3594 and SOL3602)
The [HTTP::payload replace] command does work for binary data like \001, \002, etc, but still does not work with NULL or \000.
am I doing something wrong? has any one successfully insert null by HTTP::payload replace command after apply this hotfix.
Thanks in advance - unRuleY_95363Historic F5 AccountPlease try this out and let us know:
HTTP::payload replace offset 0 [binary format ca* 0 "my goofy string"]
FYI, the problem is that the literal string is converted to Utf-8 when Tcl compiles the rule. This changes any embedded NUL's to C0 80 in the string. Therefore, you still need to use the binary format command to convert from the Utf-8 encoded literal string into a binary array (this is what keeps HTTP::payload replace offset 0 "\000my goofy string" from working).
There is also a known issue with the binary format command that will prevent just using a* from working correctly (ie, binary format a* "\000my goofy string") This has been fixed in the upcoming 9.0.3 release.
Thanks Nat!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
