jay_41157
Apr 21, 2011Nimbostratus
HTTP::PAYLOAD
HI,
I am trying to replace the page content with x's however I am running into some issues and not sure what to do..
Please help.
here is the error i see in the ltm log file:
Apr 21 16:28:16 local/tmm err tmm[4788]: 01220001:3: TCL error: parse_test_irule - Out of bounds (line 2) invoked from within "HTTP::payload replace 0 $content_length [string repeat "X" $content_length]"
Apr 21 16:28:53 local/tmm1 err tmm1[4789]: 01220001:3: TCL error: parse_test_irule - Out of bounds (line 6) invoked from within "HTTP::payload replace 0 $content_length [string repeat "X" $content_length]"
Apr 21 16:29:26 local/tmm err tmm[4788]: 01220001:3: TCL error: parse_test_irule - Out of bounds (line 2) invoked from within "HTTP::payload replace 0 $content_length [string repeat "X" $content_length]"
Here is what my irule looks like, I got it from the WIKI page examples...
when HTTP_RESPONSE {
Only check responses that are a text content type (text/html, text/xml, text/plain, etc).
if { [HTTP::header "Content-Type"] starts_with "text/" } {
Get the content length so we can collect the data (to be processed in the HTTP_RESPONSE_DATA event)
Limit collection to 1Mb (1048576 minus a little to spare) - See SOL6578 for details
if { [HTTP::header exists "Content-Length"] } {
if { [HTTP::header "Content-Length"] > 1048000 }{
Content-Length over 1Mb so collect 1Mb
set content_length 1048000
} else {
Content-Length under 1Mb so collect actual length
set content_length [HTTP::header "Content-Length"]
}
} else {
Response did not have Content-Length header, so use default of 1Mb
set content_length 1048000
}
Don't collect content if Content-Length header value was 0
if { $content_length > 0 } {
HTTP::collect $content_length
}
log local0. "Payload Length:[HTTP::payload length]:"
log local0. "Content Length:[HTTP::header value Content-Length]:"
log local0. "Payload:[HTTP::payload]:"
}
}
when HTTP_RESPONSE_DATA {
log "Replacing payload with new data."
HTTP::payload replace 0 $content_length [string repeat "X" $content_length]
[HTTP::release]
}
Thanks,
Jay