diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-10-27 21:01:00 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-10-27 21:01:00 +0000 |
commit | 2b0c76cfbdfd660242f47ce66a4d54d30f9b23e8 (patch) | |
tree | 0fd87b8ac4a82695019df8e591ad2c6dbfc26fa7 /src/core/ngx_output_chain.c | |
parent | 425a42ce3dfe0a24c5c6eb44285447b40e685291 (diff) | |
download | nginx-2b0c76cfbdfd660242f47ce66a4d54d30f9b23e8.tar.gz nginx-2b0c76cfbdfd660242f47ce66a4d54d30f9b23e8.zip |
nginx-0.0.1-2003-10-28-00:01:00 import
Diffstat (limited to 'src/core/ngx_output_chain.c')
-rw-r--r-- | src/core/ngx_output_chain.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index 6ef592dca..a2eec1ae1 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -1,6 +1,7 @@ #include <ngx_config.h> #include <ngx_core.h> +#include <ngx_event.h> #define NGX_NONE 1 @@ -30,8 +31,7 @@ int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) return ctx->output_filter(ctx->output_ctx, in); } - if (!ctx->copy_chain - && in->next == NULL + if (in->next == NULL && (!ngx_output_chain_need_to_copy(ctx, in->hunk))) { return ctx->output_filter(ctx->output_ctx, in); @@ -250,3 +250,31 @@ ngx_log_debug(src->file->log, "READ: %qd:%qd %X:%X %X:%X" _ return NGX_OK; } + + +int ngx_chain_write(void *data, ngx_chain_t *in) +{ + ngx_chain_write_ctx_t *ctx = data; + + ngx_chain_t *cl; + + + for (/* void */; in; in = in->next) { + ngx_alloc_link_and_set_hunk(cl, in->hunk, ctx->pool, NGX_ERROR); + *ctx->last = cl; + ctx->last = &cl->next; + } + + ctx->out = ngx_write_chain(ctx->connection, ctx->out); + + if (ctx->out == NGX_CHAIN_ERROR) { + return NGX_ERROR; + } + + if (ctx->out == NULL) { + ctx->last = &ctx->out; + return NGX_OK; + } + + return NGX_AGAIN; +} |