Content-Encoding: zip

339 views
Skip to first unread message

Владимир Дашивец

unread,
Jul 4, 2012, 5:11:40 AM7/4/12
to httplib2-dev
Hello.
Please help me, I get "HTTP" request with "Content-Encoding: zip".
Decoding "Deflate" and "gzip" do not help to unpack the contents of
the request.

The file "zip1.txt" contains compressed data from the "HTTP" request.

1.
content = zlib.decompress(open( "zip1.txt", "rb").read())

Error:
Traceback (most recent call last):
File "D:\Install\Python\Project\HTTPClient\HTTPClient.py", line 132,
in <module>
content = zlib.decompress(open( "zip1.txt", "rb").read())
zlib.error: Error -3 while decompressing data: incorrect header check

2.
content = gzip.GzipFile(fileobj=io.BytesIO(open( "zip1.txt",
"rb").read())).read()

Error:
Traceback (most recent call last):
File "D:\Install\Python\Project\HTTPClient\HTTPClient.py", line 130,
in <module>
content = gzip.GzipFile(fileobj=io.BytesIO(open( "zip1.txt",
"rb").read())).read()
File "C:\Python32\lib\gzip.py", line 336, in read
self._read(readsize)
File "C:\Python32\lib\gzip.py", line 390, in _read
self._read_gzip_header()
File "C:\Python32\lib\gzip.py", line 267, in _read_gzip_header
raise IOError('Not a gzipped file')
IOError: Not a gzipped file


Tell me what else you can try or where I was wrong (for example,
extract taken from "httplib2").

Joe Gregorio

unread,
Jul 4, 2012, 11:47:31 AM7/4/12
to httpli...@googlegroups.com


On Wednesday, July 4, 2012 5:11:40 AM UTC-4, Владимир Дашивец wrote:
Hello.
Please help me, I get "HTTP" request with "Content-Encoding: zip".

The value of 'zip' for content-encoding is not valid. The valid values are defined here:

  

shadowo...@gmail.com

unread,
Jul 6, 2012, 12:54:56 AM7/6/12
to httpli...@googlegroups.com
Thank you for your reply.
I Founded mistake, I copied the wrong body of the request to a file.
All decoded using the "content = zlib.decompress (open (" hexout.txt "," rb "). Read ())"


среда, 4 июля 2012 г., 19:47:31 UTC+4 пользователь Joe Gregorio написал:
Reply all
Reply to author
Forward
0 new messages