diff 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
line wrap: on
line diff
--- 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_ct
             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
 
     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;
+}