diff ngx_http_gunzip_filter_module.c @ 11:b12d2ee20755

Gunzip: fix gunzip of empty gzip stream. Reported by: Matthieu Tourne
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 07 Mar 2010 17:05:43 +0300
parents 5c999acd9436
children 5b45458fb4ac
line wrap: on
line diff
--- a/ngx_http_gunzip_filter_module.c
+++ b/ngx_http_gunzip_filter_module.c
@@ -537,23 +537,18 @@ ngx_http_gunzip_filter_inflate(ngx_http_
 
     if (ctx->in == NULL) {
 
+        b = ctx->out_buf;
+
+        if (ngx_buf_size(b) == 0) {
+            return NGX_OK;
+        }
+
         cl = ngx_alloc_chain_link(r->pool);
         if (cl == NULL) {
             return NGX_ERROR;
         }
 
-        b = ctx->out_buf;
-
-        if (ngx_buf_size(b) == 0) {
-
-            b = ngx_calloc_buf(ctx->request->pool);
-            if (b == NULL) {
-                return NGX_ERROR;
-            }
-
-        } else {
-            ctx->zstream.avail_out = 0;
-        }
+        ctx->zstream.avail_out = 0;
 
         cl->buf = b;
         cl->next = NULL;