comparison src/http/modules/ngx_http_gzip_filter_module.c @ 5291:84155a389bcc

Gzip: clearing of c->buffered if all data are flushed. This allows to finalize unfinished responses while still sending as much data as available.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 25 Jul 2013 14:55:32 +0400
parents 4b744a2fb1a6
children c52a761a2029
comparison
equal deleted inserted replaced
5290:355779f81491 5291:84155a389bcc
366 366
367 if (in) { 367 if (in) {
368 if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) { 368 if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) {
369 goto failed; 369 goto failed;
370 } 370 }
371
372 r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
371 } 373 }
372 374
373 if (ctx->nomem) { 375 if (ctx->nomem) {
374 376
375 /* flush busy buffers */ 377 /* flush busy buffers */
618 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 620 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
619 "deflateInit2() failed: %d", rc); 621 "deflateInit2() failed: %d", rc);
620 return NGX_ERROR; 622 return NGX_ERROR;
621 } 623 }
622 624
623 r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
624
625 ctx->last_out = &ctx->out; 625 ctx->last_out = &ctx->out;
626 ctx->crc32 = crc32(0L, Z_NULL, 0); 626 ctx->crc32 = crc32(0L, Z_NULL, 0);
627 ctx->flush = Z_NO_FLUSH; 627 ctx->flush = Z_NO_FLUSH;
628 628
629 return NGX_OK; 629 return NGX_OK;
851 851
852 cl->buf = b; 852 cl->buf = b;
853 cl->next = NULL; 853 cl->next = NULL;
854 *ctx->last_out = cl; 854 *ctx->last_out = cl;
855 ctx->last_out = &cl->next; 855 ctx->last_out = &cl->next;
856
857 r->connection->buffered &= ~NGX_HTTP_GZIP_BUFFERED;
856 858
857 return NGX_OK; 859 return NGX_OK;
858 } 860 }
859 861
860 if (rc == Z_STREAM_END) { 862 if (rc == Z_STREAM_END) {