Author phr
Recipients phr
Date 2009-04-17.22:10:18
SpamBayes Score 7.74785e-10
Marked as misclassified No
Message-id <1240006221.86.0.263428051867.issue5784@psf.upfronthosting.co.za>
In-reply-to
Content
The zlib module doesn't support raw deflate format, so it doesn't
completely interoperate with php's "gzdeflate" function and fails to
decompress some strings that web browsers can decompress.

A workaround is to use a special zlib feature and pass the value -15 as
the "wbits" arg: 

plaintext = zlib.deflate(compressed_text, wbits=-15)

I don't know if it's appropriate to mess with the code, but at minimum I
urge that the workaround be mentioned in the docs.  We had a tremendous
distruption where I work because of a malicious raw-deflated PHP script
that we couldn't decompress with Python for analysis.  We had to resort
to decompressing in a PHP container that (through my slipping up) it
proceeded to escape from.  

Help us Python-Kenobi, save us from PHP ;-)
History
Date User Action Args
2009-04-17 22:10:22phrsetrecipients: + phr
2009-04-17 22:10:21phrsetmessageid: <1240006221.86.0.263428051867.issue5784@psf.upfronthosting.co.za>
2009-04-17 22:10:20phrlinkissue5784 messages
2009-04-17 22:10:18phrcreate