From e25772abfbfe5d27cbb8b59e6ac1bf6147bf9a17 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 31 Jan 2013 13:26:54 +0000 Subject: [PATCH] Fix deflate/inflate - no zlib header. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10846 7a7537e8-13f0-0310-91df-b6672ffda945 --- cups/http.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cups/http.c b/cups/http.c index 3c7fc99f62..c437a50ce6 100644 --- a/cups/http.c +++ b/cups/http.c @@ -4247,9 +4247,15 @@ http_content_coding_start( if (http->wused) httpFlushWrite(http); + /* + * Window size for compression is 11 bits - optimal based on PWG Raster + * sample files on pwg.org. -11 is raw deflate, 27 is gzip, per ZLIB + * documentation. + */ + if ((zerr = deflateInit2(&(http->stream), Z_DEFAULT_COMPRESSION, Z_DEFLATED, - coding == _HTTP_CODING_DEFLATE ? 11 : 27, 7, + coding == _HTTP_CODING_DEFLATE ? -11 : 27, 7, Z_DEFAULT_STRATEGY)) < Z_OK) { http->status = HTTP_ERROR; @@ -4267,8 +4273,13 @@ http_content_coding_start( return; } + /* + * Window size for decompression is up to 15 bits (maximum supported). + * -15 is raw inflate, 31 is gunzip, per ZLIB documentation. + */ + if ((zerr = inflateInit2(&(http->stream), - coding == _HTTP_CODING_INFLATE ? 15 : 31)) + coding == _HTTP_CODING_INFLATE ? -15 : 31)) < Z_OK) { free(http->dbuffer); -- 2.47.2