Forum Discussion
Tim_Brown
Nimbostratus
Feb 17, 2006regsub failing
I used bl0ndie's search and replace code, the short version:
when HTTP_REQUEST {
HTTP::version 1.0
}
when HTTP_RESPONSE {
HTTP::collect 4294967295
}
when HTTP_RESPONSE_DATA {
set find ":8088"
set replace ""
set payload [HTTP::payload]
if {[regsub -all $find $payload $replace new_response] > 0} {
HTTP::payload replace 0 [HTTP::payload len] $new_response
}
}
to attempt to search and replace ":8088" with "" (nothing). I've gone so far as to log the HTTP::payload after the "set payload" line and the string I'm searching for is there, but it appears as though the regsub evaluation is failing as the response never gets rewritten.
Any help here would be appreciated.
- I just tested this out and it works for me. Here are the approaches I would take if I were you:
- Tim_Brown
Nimbostratus
Joe, - Give this a try:
when HTTP_REQUEST { HTTP::version 1.0 } when HTTP_RESPONSE { HTTP::collect 4294967295 } when HTTP_RESPONSE_DATA { set find ":8088" set replace "" log local0. "payload: [HTTP::payload]" if {[regsub -all $find [HTTP::payload] $replace new_response] > 0} { log local0. "Match found - regsub returned greater than zero!" log local0. "New Response: $new_response" HTTP::payload replace 0 [HTTP::payload len] $new_response } else { log local0. "No match found - regsub returned zero!" } }
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