comparison 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
comparison
equal deleted inserted replaced
10:e60753404354 11:b12d2ee20755
535 return NGX_AGAIN; 535 return NGX_AGAIN;
536 } 536 }
537 537
538 if (ctx->in == NULL) { 538 if (ctx->in == NULL) {
539 539
540 b = ctx->out_buf;
541
542 if (ngx_buf_size(b) == 0) {
543 return NGX_OK;
544 }
545
540 cl = ngx_alloc_chain_link(r->pool); 546 cl = ngx_alloc_chain_link(r->pool);
541 if (cl == NULL) { 547 if (cl == NULL) {
542 return NGX_ERROR; 548 return NGX_ERROR;
543 } 549 }
544 550
545 b = ctx->out_buf; 551 ctx->zstream.avail_out = 0;
546
547 if (ngx_buf_size(b) == 0) {
548
549 b = ngx_calloc_buf(ctx->request->pool);
550 if (b == NULL) {
551 return NGX_ERROR;
552 }
553
554 } else {
555 ctx->zstream.avail_out = 0;
556 }
557 552
558 cl->buf = b; 553 cl->buf = b;
559 cl->next = NULL; 554 cl->next = NULL;
560 *ctx->last_out = cl; 555 *ctx->last_out = cl;
561 ctx->last_out = &cl->next; 556 ctx->last_out = &cl->next;