I tried:
gzencode($contents, 9, FORCE_DEFLATE)
gzdeflate...
zlib_encode($contents, -15);// RFC 1951 - raw deflate
zlib_encode($contents, 15);// RFC 1950 - zlib
But none of them are suitable, because output is different.
And I'm talking about output, NOT headers!
I need deflate, not gzip.
PHP's gzcompress()
. The use of the word "deflate" in the HTTP specification and content encoding is a misnomer. It really means zlib, which is a zlib wrapper around raw deflate data. gzcompress()
produces zlib-wrapped deflate data.
From the HTTP 1.1 specification:
deflate: The "zlib" format defined in RFC 1950 [31] in combination with
the "deflate" compression mechanism described in RFC 1951 [29].
So HTTP "deflate" == zlib. HTTP "deflate" != deflate.
For reference, gzencode()
produces gzip-wrapped deflate data, and gzdeflate()
produces raw, unwrapped deflate data.