den_39838
May 16, 2010Nimbostratus
Binary (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_2 "\x8d\x92"
regsub $v_1_2 [HTTP::payload] $v_1_0 replaced
HTTP::payload replace 0 [HTTP::payload length] $replaced
HTTP::release
}
===============================================
Looks like "regsub" or "HTTP::payload replace" does not do the job right.
After replacement the Wireshark could not reassemble the packet.
This iRule just ruin all paiload data and replace not only 2 bytes as you can see in attached Wireshark screen captures, the payload before replacemnt was starting as HEX:
8c 81 98 ...
and after replacement:
c2 8c c2 81 c2 98 ...
Any idea what i doing wrong?
regards,
Denis