File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -490,27 +490,25 @@ def _init_read_gz(self):
490490 # taken from gzip.GzipFile with some alterations
491491 if self .__read (2 ) != b"\037 \213 " :
492492 raise ReadError ("not a gzip file" )
493- method , flag = struct .unpack ("<BB6x" , self .__read (8 ))
494- if method != 8 :
493+ if self .__read (1 ) != b"\010 " :
495494 raise CompressionError ("unsupported compression method" )
496495
497- # process FEXTRA
496+ flag = ord (self .__read (1 ))
497+ self .__read (6 )
498+
498499 if flag & 4 :
499- extra_len , = struct .unpack ("<H" , self .__read (2 ))
500- self .__read (extra_len )
501- # process FNAME
500+ xlen = ord (self .__read (1 )) + 256 * ord (self .__read (1 ))
501+ self .__read (xlen )
502502 if flag & 8 :
503503 while True :
504504 s = self .__read (1 )
505- if not s or s == b' \000 ' :
505+ if not s or s == NUL :
506506 break
507- # process FCOMMENT
508507 if flag & 16 :
509508 while True :
510509 s = self .__read (1 )
511- if not s or s == b' \000 ' :
510+ if not s or s == NUL :
512511 break
513- # process FHCRC
514512 if flag & 2 :
515513 self .__read (2 )
516514
You can’t perform that action at this time.
0 commit comments