Forum Discussion
mghosh_170954
Nimbostratus
Sep 19, 2014iRule POST data manipulation truncates the message
I have an iRule where I am intercepting an incoming HTTP POST request.
Then matching a portion of the request in the input stream, manipulating it and then sending it on.
However, I noticed tha...
Kevin_Stewart
Employee
Sep 22, 2014At a minimum, the STREAM process may not be updating the Content-Length header. Also, since you're not explicitly buffering the payload with an HTTP::collect, I believe the STREAM is only working on HTTP headers and any payload data that may fill the first TCP packet. Here's a version that specifically buffers and works on HTTP payload data:
when HTTP_REQUEST {
log local0. "URI: [HTTP::uri] - IP: [IP::client_addr] - Method: [HTTP::method]"
if { ( [HTTP::method] equals "POST" ) && ( [HTTP::uri] equals "/Process/POST" ) } {
log local0. "URI: [HTTP::uri] - IP: [IP::client_addr]"
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
set old_teststate [findstr [HTTP::payload] "TestState=" 0 "&"]
regsub -all {foo} $old_teststate bar new_teststate
set new_payload [string map "$old_teststate $new_teststate" [HTTP::payload]]
HTTP::payload replace 0 [HTTP::payload length] $new_payload
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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