Forum Discussion
TCL error - irule [13.01]
Facing error as [TCL error: /Common/CAI3G - can't read "recv_data": no such variable while executing "regexp {^(.)(.<\/ns4:imsi>)(.*)$} $recv_data -> part1 garbage part2"], while executing below i-rule. Any suggestions?
when HTTP_REQUEST { if {[HTTP::method] eq "POST"}{ Trigger collection for up to 1MB of data if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{ set content_length [HTTP::header "Content-Length"] } else { set content_length 1048576 } Check if $content_length is not set to 0 if { $content_length > 0} { HTTP::collect $content_length } } }
when RULE_INIT { set recv_data "nothing coming out" }
when HTTP_REQUEST_DATA { do stuff with the payload set payload [HTTP::payload] log local0. "receive payload: $payload"
regexp {^(.*)(.*<\/ns4:imsi>)(.*)$} $recv_data -> part1 garbage part2
set new_payload "$part1$part2"
log local0. "garbage:$garbage"
log local0. "new payload:$new_payload"
}
- iaine
Nacreous
Hi
If you are setting your variable in RULE_INIT and the variable is not changing then set it as a Static variable - https://devcentral.f5.com/wiki/iRules.static.ashx - then you can refer to it a per the example in the link
Recent Discussions
Related Content
* 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