Forum Discussion
John_Alam_45640
Apr 07, 2014Historic F5 Account
if you are on 11.4 or above, here is a slight variation in order to demonstrate iRule procedures "proc".
proc save_n_let_it_go args {
the args variable is ignored here
set my_req_msg_payload [TCP::payload]
set my_req_msg_length [TCP::payload length]
release the data already collected to be forwarded to destination.
TCP::release
}
when CLIENT_ACCEPTED {
TCP::collect 2
set header_collected "false"
}
}
when CLIENT_DATA {
if { not ($header_collected) } {
Comment out one of the two binary scan lines below.
use this form if lower order byte is last (big endian order)
binary scan [TCP::payload] S message_length
use this form if lower order byte is first (little endian order)
binary scan [TCP::payload] s message_length
as the message length collected does not include itself add 2 more onto the result
if { $message_length > 0 } {
set header_collected "true"
check if we already have the required data in the buffer if so
capture the payload in vars and release it
if {[TCP::payload length] == [expr { $message_length + 2 }] } {
set vars with payload info for HSL logging later
call save_n_let_it_go
} else {
collect data with the required length
TCP::collect $message_length
}
}
} else {
if we are here the actual message is collected.
call save_n_let_it_go
}
}