As a rough proof of concept, I refactored the design, allowing for the pattern matching and substitution to be done as soon as we have a "line". Also is some rough ability to pass the data to the next filter after we get more than ~AP_MIN_BYTES_TO_WRITE bytes. Doesn't alleviate all the problems, but it allows for us to pass data quicker (we still have the issue where we need to fully read in the bb though...) It's rough but passes superficial testing...
More work needs to be done, but more people could work on it if I just commit to trunk :) Same URL, different version: http://people.apache.org/~jim/code/mod_sed_filter.c