comparison src/core/ngx_output_chain.c @ 162:96993d4d5067

nginx-0.0.1-2003-10-28-00:01:00 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 27 Oct 2003 21:01:00 +0000
parents e7e094d34162
children 84036764e215
comparison
equal deleted inserted replaced
161:88abd07d9f62 162:96993d4d5067
1 1
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 #include <ngx_core.h> 3 #include <ngx_core.h>
4 #include <ngx_event.h>
4 5
5 6
6 #define NGX_NONE 1 7 #define NGX_NONE 1
7 8
8 9
28 29
29 if (in == NULL) { 30 if (in == NULL) {
30 return ctx->output_filter(ctx->output_ctx, in); 31 return ctx->output_filter(ctx->output_ctx, in);
31 } 32 }
32 33
33 if (!ctx->copy_chain 34 if (in->next == NULL
34 && in->next == NULL
35 && (!ngx_output_chain_need_to_copy(ctx, in->hunk))) 35 && (!ngx_output_chain_need_to_copy(ctx, in->hunk)))
36 { 36 {
37 return ctx->output_filter(ctx->output_ctx, in); 37 return ctx->output_filter(ctx->output_ctx, in);
38 } 38 }
39 } 39 }
248 } 248 }
249 } 249 }
250 250
251 return NGX_OK; 251 return NGX_OK;
252 } 252 }
253
254
255 int ngx_chain_write(void *data, ngx_chain_t *in)
256 {
257 ngx_chain_write_ctx_t *ctx = data;
258
259 ngx_chain_t *cl;
260
261
262 for (/* void */; in; in = in->next) {
263 ngx_alloc_link_and_set_hunk(cl, in->hunk, ctx->pool, NGX_ERROR);
264 *ctx->last = cl;
265 ctx->last = &cl->next;
266 }
267
268 ctx->out = ngx_write_chain(ctx->connection, ctx->out);
269
270 if (ctx->out == NGX_CHAIN_ERROR) {
271 return NGX_ERROR;
272 }
273
274 if (ctx->out == NULL) {
275 ctx->last = &ctx->out;
276 return NGX_OK;
277 }
278
279 return NGX_AGAIN;
280 }