www-lib usable on server for cgi content-encoding?

Hoping someone out there has already done this. . .

We have a vendor-provided application that generates dynamic html content via a (compiled) CGI program. We do not have access to the source. It returns a complete HTTP response, headers followed by the body HTML.

I want to add content-encoding (zlib deflation) to the body content returned by the cgi program.

Under netscape/iplanet architecture, the only way to "post-process" the output of a cgi program appears to be by inserting another program between the server's cgi handler & the cgi program. 

This program will invoke the vendor CGI, read the it's output from stdin, and apply deflation if the browser says it supports deflate encoding & if the content-size returned is above some minimum size (tentatively 1k).

My questions:
(1) Is there already an implementation of this somewhere? It seems that it would be a common desire to compress dynamic content?

(2) If there is no existing implementation, is libwww appropriate for this usage? All the examples appear to be for client-side usage, but I note that there are zlib compression routines in addition to the decompression needed by the client.

(2) What header modifications should this program make? Obvious ones are: change content-length to reflect new length, and add content-encoding: deflate. Are there others? Maybe "vary" since we're doing compression conditionally? (Not completely sure how this impacts proxying and/or caching, but all output from this application will be transmitted to the client via SSL). 

Thanks for any advice and/or constructive critism.

--
David Carter
david@carter.net

Received on Thursday, 7 June 2001 12:00:05 UTC