Forum Discussion
John_Alam_45640
Apr 07, 2014Historic F5 Account
Good catch.
Your modification look great. Only a couple suggestions:
1) don't add the 2 to the message_length variable because it is used for the TCP::collect later, instead add it within the comparison operation. 2) Perform the second the TCP::collect in the else statement so that it can be avoided if not needed.Here is what it would look like:
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
set my_req_msg_payload [TCP::payload]
set my_req_msg_length [TCP::payload length]
release the data already collected
TCP::release
} else {
collect data with the required length
TCP::collect $message_length
}
}
} else {
if we are here the actual message is collected.
set my_req_msg_payload [TCP::payload]
set my_req_msg_length [TCP::payload length]
TCP::release
}
}
- beefy80Apr 07, 2014NimbostratusJohn, I have just tried your enhancement but this does not work for me until our software sends the request again then it works. I have reverted to the previous version of code that I included. I like the code on 11.4 not aware of the procedures function however I am on 11.3 at the moment but will keep that in mind for the future.
- John_Alam_45640Apr 07, 2014Historic F5 AccountThanks for the feedback. Good luck.