First, I'd suggest using a stream profile and STREAM:: commands to replace or remove the offending content, as it wouldn't be subject to the size limitations of HTTP::collect. Also, it should be significantly more efficient, as the HTTP payload isn't being buffered and you're not restricting the server side connection to HTTP v1.0.
You can check the STREAM::expression wiki page (
Click here) for an example of replacing response content. The stream option is only available in 9.2 or later.
If you do need/want to stick with the payload collection method, can you try adding logging to see how much content is being collected? How far into the response is the data being replaced? Also, you might want to add another check before collecting the payload to only collect text-based content-types (you shouldn't bother collecting binary content).
Aaron