Something like as follows right?
Taken from the creditcard scrubber.
when HTTP_RESPONSE {
if { $scrub_content } {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 4294967295
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
when HTTP_RESPONSE_DATA {
set old_link "www.somedomain.com/someuri"
set new_link "www.somedomain1.com/somenewuri"
if { [regsub -all {$old_link} [HTTP::payload] $new_link newdata] } {
log "Replacing $old_link with $new_link"
HTTP::payload replace 0 [HTTP::payload length] $newdata
} else {
log "replacing nothing"
}
}
I think the issue is that I am not replacing the string correctly, the regsub seems like it should work, if it matches the old_link in the payload, replace etc. But I think I am off target.