See: http://www.blue.sky.or.jp/atelier/ruby/zlib.en.html For gzip you have to use Zlib::Gzip and a GzipReader object. On Saturday, December 14, 2002, at 11:35 PM, Jeff Schilling wrote: > I am using the PragProg 1.7.3 distro of ruby which includes zlib 0.5.1 > > I am trying to decode the response.body from an HTTP request. > > Like this: > headers["Accept-encoding"] = "gzip" > uri = URI.parse(source) > h = Net::HTTP.new(uri.host) > resp = h.get(uri.path, headers) > puts "Code = #{resp.code}" > puts "Message = #{resp.message}" > resp.each {|key, val| printf "%-14s = %-40.40s\n", key, val } > data = resp.body > if resp.fetch('content-encoding', 'None') == 'gzip' > begin > pp data[0..2] > data = Zlib::Inflate.inflate(data) > rescue StandardError => err > print "Zlib error: #{err}\n" > end > end > > This always results in : Zlib error: unknown compression method > > Byte 2 of the string is \010 - which is correct. > > Anyone seen this? > > Thanks in advance. > > -Jeff > >