Mercurial > hg > nginx
comparison src/http/ngx_http_write_filter.c @ 399:4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 25 Jul 2004 18:34:14 +0000 |
parents | 6f3b20c1ac50 |
children | f209f3391020 |
comparison
equal
deleted
inserted
replaced
398:201b5f68b59f | 399:4e21d1291a14 |
---|---|
5 #include <ngx_http.h> | 5 #include <ngx_http.h> |
6 | 6 |
7 | 7 |
8 typedef struct { | 8 typedef struct { |
9 ngx_chain_t *out; | 9 ngx_chain_t *out; |
10 | |
11 /* unsigned flush:1; */ | |
12 ngx_uint_t flush; | |
13 } ngx_http_write_filter_ctx_t; | 10 } ngx_http_write_filter_ctx_t; |
14 | 11 |
15 | 12 |
16 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle); | 13 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle); |
17 | 14 |
117 | 114 |
118 if (c->write->delayed) { | 115 if (c->write->delayed) { |
119 return NGX_AGAIN; | 116 return NGX_AGAIN; |
120 } | 117 } |
121 | 118 |
122 if (size == 0 && !ctx->flush) { | 119 if (size == 0 && !c->buffered) { |
123 if (!last) { | 120 if (!last) { |
124 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 121 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
125 "the http output chain is empty"); | 122 "the http output chain is empty"); |
126 } | 123 } |
127 return NGX_OK; | 124 return NGX_OK; |
144 | 141 |
145 if (chain == NGX_CHAIN_ERROR) { | 142 if (chain == NGX_CHAIN_ERROR) { |
146 return NGX_ERROR; | 143 return NGX_ERROR; |
147 } | 144 } |
148 | 145 |
149 if (chain == NGX_CHAIN_AGAIN) { | 146 ctx->out = chain; |
150 ctx->out = NULL; | 147 |
151 ctx->flush = 1; | 148 if (chain || c->buffered) { |
152 return NGX_AGAIN; | 149 return NGX_AGAIN; |
153 } | 150 } |
154 | 151 |
155 ctx->out = chain; | 152 return NGX_OK; |
156 | |
157 if (chain == NULL) { | |
158 return NGX_OK; | |
159 } | |
160 | |
161 return NGX_AGAIN; | |
162 } | 153 } |
163 | 154 |
164 | 155 |
165 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle) | 156 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle) |
166 { | 157 { |