CMS 3D CMS Logo

Classes | Functions
ztail Namespace Reference

Classes

class  Decoder
 

Functions

def strip_gzip_header (body)
 

Function Documentation

def ztail.strip_gzip_header (   body)

Definition at line 16 of file ztail.py.

Referenced by ztail.Decoder.decode().

17  assert body[0:2] == "\x1f\x8b"
18  method, flags, mtime = struct.unpack("<BBIxx", body[2:10])
19 
20  FHCRC = 0x02
21  FEXTRA = 0x04
22  FNAME = 0x08
23  FCOMMENT = 0x10
24 
25  i = 10
26 
27  if flags & FEXTRA:
28  size, = struct.unpack("<H", body[i:i+2])
29  i += size + 2
30 
31  def skip_until_zero(ix):
32  while body[ix] != '\x00': ix += 1
33  return ix + 1
34 
35  if flags & FNAME: i = skip_until_zero(i)
36  if flags & FCOMMENT: i = skip_until_zero(i)
37  if flags & FHCRC: i += 2
38 
39  body = body[i:]
40  return body
41 
def strip_gzip_header(body)
Definition: ztail.py:16