Forum Discussion
Laurie_Swan_112
Nimbostratus
Jan 17, 2006Error running payload rewrite script
I've just tried cut-n-pasting the payload rewrite script at http://devcentral.f5.com/Default.aspx?tabid=29&ArticleType=ArticleView&ArticleID=56&PageID=61
, with just the find and replace variable...
Laurie_Swan_112
Nimbostratus
Jan 18, 2006Ok, we have progression, but am still having problems.
I now manage to tweak and get the script running intermittantly. I'm getting a strange HTTP:payload error/quirk. The HTTP_RESPONSE and HTTP_RESPONSE_DATA sections are as follows:
when HTTP_RESPONSE {
set clen [HTTP::header Content-Length]
if { not [info exists clen] or "0" eq $clen} {
set clen 4294967295
}
log local0. "HTTP_RESPONSE CLEN= $clen -End"
if { $clen > 0 } {
HTTP::collect $clen
}
}
when HTTP_RESPONSE_DATA {
set find "findstring"
set replace "replacestring"
set payload "[HTTP::payload]"
log local0. "Payload [HTTP::payload length] [string length "[HTTP::payload]"] [string length $payload]"
Run the regsub to make all the replacements (add -nocase for case insensitivity)
if {[regsub -all $find $payload $replace new_response] > 0} {
HTTP::payload replace 0 [HTTP::payload length] $new_response
}
}
I'm sometimes getting in the log:
Jan 18 11:55:42 tmm tmm[671]: Rule payload_https_testportal : HTTP_RESPONSE CLEN= 16175 -End
Jan 18 11:55:42 tmm tmm[671]: Rule payload_https_testportal : Payload 16175 16175 16175
Which is correct. But I'm often getting an incorrect:
Jan 18 11:50:16 tmm tmm[671]: Rule payload_https_testportal : HTTP_RESPONSE CLEN= 16175 -End
Jan 18 11:50:16 tmm tmm[671]: Rule payload_https_testportal : Payload 16175 115 115
which means ny regsub doesnt work.
Why does [HTTP::payload length] and [string length "[HTTP::payload]"] differ?? Is this a memory issue?
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects