Gzip: fixed zlib memLevel adjusting.

An incorrect memLevel (lower than 1) might be passed to deflateInit2() if the
"gzip_hash" directive is set to a value less than the value of "gzip_window"
directive. This resulted in "deflateInit2() failed: -2" alert and an empty
reply.
This commit is contained in:
Valentin Bartenev 2012-12-14 15:17:58 +00:00
parent 16f4851c13
commit 435753dd55
1 changed files with 4 additions and 0 deletions

View File

@ -498,6 +498,10 @@ ngx_http_gzip_filter_memory(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
wbits--;
memlevel--;
}
if (memlevel < 1) {
memlevel = 1;
}
}
ctx->wbits = wbits;