From: Aristarkh A Zagorodnikov Date: 2001-10-08T22:05:31+09:00 Subject: [ruby-talk:22235] Re: gzip a string > -----Original Message----- > From: Tobias Reif [mailto:tobiasreif@pinkjuice.com] > Sent: Monday, October 08, 2001 5:02 PM > To: ruby-talk ML > Subject: [ruby-talk:22234] Re: gzip a string > > > ts wrote: > > > > str = Deflate::deflate "hello" > > p Inflate::inflate str > > > works, thanks. > > Now: how to serve gzipped content? > > This runs on my local machine: > (I hear strange clicks inside the computer) > > -- > require 'zlib' > > print "Content-type: image/svg+xml\n\n" > > open('utf8.svg','r') do |file| > @svg = file.read > end > > gz = GzipWriter.new($stdout) > gz.print @svg > gz.close > -- > > > Should that work on a server? Errm ... you'll need a 'Content-Encoding: gzip' (or 'deflate') header I believe. Also, in general case ou should check for 'Accept-Encoding' element in request header. Aristarkh A Zagorodnikov, Tech Lead @ bolotov.ru group www.bolotov.ru | xm@bolotov-team.ru | ICQ UIN 3698793