Mercurial > hg > nginx
diff src/http/ngx_http_write_filter.c @ 395:f8f0f1834266
nginx-0.0.7-2004-07-16-21:11:43 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 16 Jul 2004 17:11:43 +0000 |
parents | e7a68e14ccd3 |
children | 6f3b20c1ac50 |
line wrap: on
line diff
--- a/src/http/ngx_http_write_filter.c +++ b/src/http/ngx_http_write_filter.c @@ -7,6 +7,9 @@ typedef struct { ngx_chain_t *out; + + /* unsigned flush:1; */ + ngx_uint_t flush; } ngx_http_write_filter_ctx_t; @@ -42,7 +45,6 @@ ngx_int_t ngx_http_write_filter(ngx_http int last; off_t size, flush, sent; ngx_chain_t *cl, *ln, **ll, *chain; - ngx_http_core_srv_conf_t *cscf; ngx_http_core_loc_conf_t *clcf; ngx_http_write_filter_ctx_t *ctx; @@ -114,7 +116,7 @@ ngx_int_t ngx_http_write_filter(ngx_http return NGX_AGAIN; } - if (size == 0) { + if (size == 0 && !ctx->flush) { if (!last) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, "the http output chain is empty"); @@ -124,11 +126,8 @@ ngx_int_t ngx_http_write_filter(ngx_http sent = r->connection->sent; - cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); - - chain = cscf->send_chain(r->connection, ctx->out, - clcf->limit_rate ? clcf->limit_rate: - OFF_T_MAX_VALUE); + chain = r->send_chain(r->connection, ctx->out, + clcf->limit_rate ? clcf->limit_rate: OFF_T_MAX_VALUE); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http write filter %X", chain); @@ -144,6 +143,12 @@ ngx_int_t ngx_http_write_filter(ngx_http return NGX_ERROR; } + if (chain == NGX_CHAIN_AGAIN) { + ctx->out = NULL; + ctx->flush = 1; + return NGX_AGAIN; + } + ctx->out = chain; if (chain == NULL) {