Re: gzipped images in SIAP 1.0

From: Mark Taylor <m.b.taylor-at-bristol.ac.uk>
Date: Tue, 22 May 2007 18:24:06 +0100 (BST)


> Roy Williams wrote:

> (3) If the headers have a content-encoding of gzip, then uncompress like
> this
> if headers.has_key('content-encoding') and headers['content-encoding']
> == 'gzip':
> gunzip the blob

as per Alberto's previous quote from RFC 2616 if you're doing this you ought to check for "x-gzip" as well as "gzip". However, ignoring the headers altogether and following Tom's advice to look at the magic numbers is almost certainly a better idea: more reliable (the headers might be wrong) and probably easier. For reference:

     gzip (.gz):     0x1f 0x8b
     compress (.Z):  0x1f 0x9d
     bzip2 (.bz2):   B    Z    h

-- 
Mark Taylor   Astronomical Programmer   Physics, Bristol University, UK
m.b.taylor@bris.ac.uk +44-117-928-8776 http://www.star.bris.ac.uk/~mbt/
Received on 2007-05-22Z19:24:38