aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2013-10-31 04:16:20 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2013-10-31 04:16:20 +0400
commit45075adccf8f5f88db0ee59c14282d187c5c58ea (patch)
tree03b568b4a8cf568c5c2081232124733acaa75e0b
parenteea2e1262b204c75996ba38f4d0fd9d8f9930948 (diff)
downloadnginx-45075adccf8f5f88db0ee59c14282d187c5c58ea.tar.gz
nginx-45075adccf8f5f88db0ee59c14282d187c5c58ea.zip
Gunzip: proper error handling on gunzipping an empty response.
With previous code, an empty (malformed) response resulted in a request finalized without sending anything to a client.
-rw-r--r--src/http/modules/ngx_http_gunzip_filter_module.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_gunzip_filter_module.c b/src/http/modules/ngx_http_gunzip_filter_module.c
index 9a1ce41a5..adadc9da6 100644
--- a/src/http/modules/ngx_http_gunzip_filter_module.c
+++ b/src/http/modules/ngx_http_gunzip_filter_module.c
@@ -500,9 +500,13 @@ ngx_http_gunzip_filter_inflate(ngx_http_request_t *r,
return NGX_OK;
}
- if (rc == Z_STREAM_END && ctx->flush == Z_FINISH
- && ctx->zstream.avail_in == 0)
- {
+ if (ctx->flush == Z_FINISH && ctx->zstream.avail_in == 0) {
+
+ if (rc != Z_STREAM_END) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "inflate() returned %d on response end", rc);
+ return NGX_ERROR;
+ }
if (ngx_http_gunzip_filter_inflate_end(r, ctx) != NGX_OK) {
return NGX_ERROR;