diff src/http/ngx_http_output_filter.c @ 69:e43f406e4525

nginx-0.0.1-2003-03-20-19:09:44 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 20 Mar 2003 16:09:44 +0000
parents 5a7d1aaa1618
children 59229033ae93
line wrap: on
line diff
--- a/src/http/ngx_http_output_filter.c
+++ b/src/http/ngx_http_output_filter.c
@@ -16,6 +16,8 @@ static int ngx_http_output_filter_copy_h
 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool);
 static char *ngx_http_output_filter_merge_conf(ngx_pool_t *pool,
                                                void *parent, void *child);
+static void ngx_http_output_filter_init(ngx_pool_t *pool,
+                                        ngx_http_conf_filter_t *cf);
 
 
 static ngx_command_t  ngx_http_output_filter_commands[] = {
@@ -31,20 +33,13 @@ static ngx_command_t  ngx_http_output_fi
 
 
 static ngx_http_module_t  ngx_http_output_filter_module_ctx = {
-    NGX_HTTP_MODULE,
-
     NULL,                                  /* create server config */
     NULL,                                  /* init server config */
+
     ngx_http_output_filter_create_conf,    /* create location config */
     ngx_http_output_filter_merge_conf,     /* merge location config */
 
-    NULL,                                  /* translate handler */
-
-    NULL,                                  /* output header filter */
-    NULL,                                  /* next output header filter */
-    (int (*)(ngx_http_request_t *, ngx_chain_t *))
-        ngx_http_output_filter,            /* output body filter */
-    NULL                                   /* next output body filter */
+    ngx_http_output_filter_init            /* output body filter */
 };
 
 
@@ -58,7 +53,12 @@ ngx_module_t  ngx_http_output_filter_mod
 
 
 
+static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
+
+
+#if 0
 #define next_filter  ngx_http_output_filter_module_ctx.next_output_body_filter
+#endif
 
 #define need_to_copy(r, hunk)                                             \
             (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY)                \
@@ -300,6 +300,14 @@ static int ngx_http_output_filter_copy_h
 }
 
 
+static void ngx_http_output_filter_init(ngx_pool_t *pool,
+                                        ngx_http_conf_filter_t *cf)
+{
+    next_filter = cf->output_body_filter;
+    cf->output_body_filter = NULL;
+}
+
+
 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool)
 {
     ngx_http_output_filter_conf_t *conf;