Mercurial > hg > nginx
comparison src/http/ngx_http_output_filter.c @ 57:a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 30 Jan 2003 07:28:09 +0000 |
parents | 27b628ef907e |
children | e8cdc2989cee |
comparison
equal
deleted
inserted
replaced
56:058f01f78761 | 57:a499e0d1f16e |
---|---|
57 }; | 57 }; |
58 | 58 |
59 | 59 |
60 int ngx_http_output_filter(ngx_http_request_t *r, ngx_hunk_t *hunk) | 60 int ngx_http_output_filter(ngx_http_request_t *r, ngx_hunk_t *hunk) |
61 { | 61 { |
62 int rc, once; | 62 int rc, once; |
63 size_t size; | 63 size_t size; |
64 ssize_t n; | 64 ngx_chain_t *ce; |
65 ngx_chain_t *ce; | 65 ngx_http_output_filter_ctx_t *ctx; |
66 ngx_http_output_filter_ctx_t *ctx; | 66 ngx_http_output_filter_conf_t *conf; |
67 ngx_http_output_filter_conf_t *conf; | |
68 | 67 |
69 ctx = (ngx_http_output_filter_ctx_t *) | 68 ctx = (ngx_http_output_filter_ctx_t *) |
70 ngx_http_get_module_ctx(r->main ? r->main : r, | 69 ngx_http_get_module_ctx(r->main ? r->main : r, |
71 ngx_http_output_filter_module); | 70 ngx_http_output_filter_module); |
72 | 71 |
76 } | 75 } |
77 | 76 |
78 if (hunk && (hunk->type & NGX_HUNK_LAST)) { | 77 if (hunk && (hunk->type & NGX_HUNK_LAST)) { |
79 ctx->last = 1; | 78 ctx->last = 1; |
80 } | 79 } |
80 | |
81 #if (NGX_SUPPRESS_WARN) | |
82 rc = NGX_ALERT; | |
83 #endif | |
81 | 84 |
82 for (once = 1; once || ctx->in; once = 0) { | 85 for (once = 1; once || ctx->in; once = 0) { |
83 | 86 |
84 /* input chain is not empty */ | 87 /* input chain is not empty */ |
85 if (ctx->in) { | 88 if (ctx->in) { |
177 next_output_body_filter(r, NULL); | 180 next_output_body_filter(r, NULL); |
178 | 181 |
179 } else { | 182 } else { |
180 if (ctx->hunk == NULL) { | 183 if (ctx->hunk == NULL) { |
181 | 184 |
182 if (hunk->type & NGX_HUNK_LAST) { | 185 conf = (ngx_http_output_filter_conf_t *) |
183 | |
184 conf = (ngx_http_output_filter_conf_t *) | |
185 ngx_http_get_module_loc_conf( | 186 ngx_http_get_module_loc_conf( |
186 r->main ? r->main : r, | 187 r->main ? r->main : r, |
187 ngx_http_output_filter_module); | 188 ngx_http_output_filter_module); |
188 | 189 |
190 if (hunk->type & NGX_HUNK_LAST) { | |
189 size = hunk->last.mem - hunk->pos.mem; | 191 size = hunk->last.mem - hunk->pos.mem; |
190 if (size > conf->hunk_size) { | 192 if (size > conf->hunk_size) { |
191 size = conf->hunk_size; | 193 size = conf->hunk_size; |
192 } | 194 } |
193 | 195 |
241 | 243 |
242 if (rc == NGX_OK && ctx->hunk) | 244 if (rc == NGX_OK && ctx->hunk) |
243 ctx->hunk->pos.mem = ctx->hunk->last.mem = ctx->hunk->start; | 245 ctx->hunk->pos.mem = ctx->hunk->last.mem = ctx->hunk->start; |
244 } | 246 } |
245 | 247 |
248 #if (NGX_SUPPRESS_WARN) | |
249 if (rc == NGX_ALERT) { | |
250 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
251 "ngx_http_output_filter: rc == NGX_ALERT"); | |
252 return NGX_ERROR; | |
253 } | |
254 #endif | |
255 | |
246 if (rc == NGX_OK && ctx->last) { | 256 if (rc == NGX_OK && ctx->last) { |
247 return NGX_OK; | 257 return NGX_OK; |
248 } | 258 } |
249 | 259 |
250 if (rc == NGX_OK) { | 260 if (rc == NGX_OK) { |