Forum Discussion
den_39838
Nimbostratus
May 16, 2010Binary (HEX) payload replace in HTTP
Trying to write simple iRule to replace 2 bytes in HTTP response data.
===============================================
when HTTP_RESPONSE {
set v_1_0 "\x8d\x90"
set v_1_...
Hi Aaron,
Thanks for link to related issue, strange how i miss it before.
So the final working script will looks like following:
when HTTP_RESPONSE {
set v_1_0 "\x8d\x90"
set v_1_1 "\x8d\x91"
set v_1_2 "\x8d\x92"
log local0. "START response parsing"
if { [regexp {\x8d\x92} [HTTP::payload]] } {
log local0. "Found 8d92 = v1.2:"
}
if { [regexp {\x8d\x91} [HTTP::payload]] } {
log local0. "Found 8d91 = v1.1:"
}
if { [regexp {\x8d\x90} [HTTP::payload]] } {
log local0. "Found 8d90 = v1.0:"
}
regsub $v_1_2 [HTTP::payload] $v_1_0 replaced
regsub $v_1_1 $replaced $v_1_0 replaced
HTTP::payload replace 0 [HTTP::payload length] [binary format a* $replaced]
log local0. "STOP response processing"
HTTP::release
}
As mentioned in old issue the "binary format ca*" was not working in my SW version BIG-IP 9.4.8 Build 396.1 Hotfix HF3
but "binary format a*" working as required.
thanks and regards,
Denis
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