]> git.kaiwu.me - nginx.git/commit
Gzip: use zlib to write header and trailer.
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 12 Jul 2019 10:43:08 +0000 (12:43 +0200)
committerIlya Leoshkevich <iii@linux.ibm.com>
Fri, 12 Jul 2019 10:43:08 +0000 (12:43 +0200)
commitcfa1316368dcc6dc1aa82e3d0b67ec0d1cf7eebb
tree7b33b9ec24dda0f7ee95cc46d92a4a716b277c61
parent29fea7d9ec7b18d9f3c2e77bddd873dafbd10842
Gzip: use zlib to write header and trailer.

When nginx is used with zlib patched with [1], which provides
integration with the future IBM Z hardware deflate acceleration, it ends
up computing CRC32 twice: one time in hardware, which always does this,
and one time in software by explicitly calling crc32().

crc32() calls were added in changesets 133:b27548f540ad ("nginx-0.0.1-
2003-09-24-23:51:12 import") and 134:d57c6835225c ("nginx-0.0.1-
2003-09-26-09:45:21 import") as part of gzip wrapping feature - back
then zlib did not support it.

However, since then gzip wrapping was implemented in zlib v1.2.0.4,
and it's already being used by nginx for log compression.

This patch replaces hand-written gzip wrapping with the one provided by
zlib. It simplifies the code, and makes it avoid computing CRC32 twice
when using hardware acceleration.

[1] https://github.com/madler/zlib/pull/410
src/http/modules/ngx_http_gzip_filter_module.c