gzipped images in SIAP 1.0

Mark Taylor m.b.taylor at bristol.ac.uk
Tue May 22 10:24:06 PDT 2007


> 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 at bris.ac.uk +44-117-928-8776 http://www.star.bris.ac.uk/~mbt/



More information about the dal mailing list