From: Brian Candler Date: 2003-05-17T16:10:21+09:00 Subject: Re: gzip cgi compression On Fri, May 16, 2003 at 11:17:57PM +0900, Michael Campbell wrote: > > Ah, that's not something I use. But I can trade you a working CGI: > > > > #!/usr/local/bin/ruby -w > > data = IO.popen("cat /etc/motd | gzip -c","r").read > > puts "Content-Type: text/plain" > > puts "Content-Encoding: gzip" > > puts > > print data > > > Is "cat" necessary there, or am I missing something? Would: > > data = IO.popen("gzip -c /etc/motd", "r").read > > not work? No, I think you're right. I wrote it that way because I started using a bidirectional pipe, then changed my mind when I realised I could pipe the uncompressed data directly into gzip within IO.popen - but didn't optimise it as far as yours :-) Brian.