cgi_buffer

·

cgi_buffer is a group of libraries (for Perl, Python and PHP) that automatically handle performance-improving HTTP features that most Web servers don't implement for scripts. This includes ETag generation and Gzip compression. All it takes is one 'include' line, and all output from your script is routed through cgi_buffer. I'm now using this to generate ETag headers and Gzip compression for HubMed's RSS feeds.
One point to note is that, if you're using application/xml or application/rss+xml for the Content-Type of your RSS feeds, you need to change a line in the cgi_buffer module that prevents it from altering files with content types other than text:
if ( m/$encoding/i && ((lc($content_type[0]) eq 'text') || (lc($content_type[1]) =~ /xml/))) {