Welcome! Log In Create A New Profile

Advanced

[nginx] Gunzip: proper error handling on gunzipping an empty res...

Maxim Dounin
October 30, 2013 08:20PM
details: http://hg.nginx.org/nginx/rev/6aa75f4982ce
branches:
changeset: 5436:6aa75f4982ce
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Oct 31 04:16:20 2013 +0400
description:
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.

diffstat:

src/http/modules/ngx_http_gunzip_filter_module.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

diffs (20 lines):

diff --git a/src/http/modules/ngx_http_gunzip_filter_module.c b/src/http/modules/ngx_http_gunzip_filter_module.c
--- 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_
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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Gunzip: proper error handling on gunzipping an empty res...

Maxim Dounin 746 October 30, 2013 08:20PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 150
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready