Implementing the equivalent of mod_deflate without Apache2s Filtered I/O framework meant touching a bunch of code in the core of httpd. This extract is just part of the patch. It gets worse. We had to modify the following:
ap_bwrite(), bflush_core(), ap_bclose()
Introuduced new constants B_GZIP, B_GZIP_CHUNK
ap_send_http_header(), ap_finalize_request_protocol()