From: Atoli Atoli Date: 2010-10-23T23:51:42+09:00 Subject: open-uri + Zlib: not in gzip format Hello, I have a script that fetches a gzip compressed web page using open-uri and Zlib. It works well most of the time, but sometimes Zlib raises a Zlib::GzipFile::Error exception saying that the data was not in gzip format (even though the content-encoding was gzip). The code basically looks like this: begin resp = open(uri, @headers) data = Zlib::GzipReader.new(StringIO.new(resp.read)).read rescue StandardError => e puts "#{e.message} / #{resp.meta['content-encoding']}" end I tried to dump the data to a file to see if I can inflate it with gunzip. It worked. I then tried to reopen the file in ruby using Zlib module, and it also worked. If the server response was somehow corrupted I wouldn't be able to gunzip the dumped file, right? Or did I miss something? Thanks in advance. -- Posted via http://www.ruby-forum.com/.