httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject Re: cvs commit: apache-2.0/src/main http_core.c http_protocol.c util_filter.c
Date Thu, 14 Sep 2000 03:37:58 GMT
On 13 Sep 2000 rbb@locus.apache.org wrote:
   
>   As a part of making adding this filter, I removed the ctx pointer from the
>   ap_add_filter prototype.  The problem is that the core is the thing that
>   is actually inserting the filter into the filter stack, but the core doesn't
>   know how to allocate memory for each filter.  The solution is to have the
>   filters themselves be responsible for allocating the ctx memory whenever
>   it is required.

wait, why not leave ctx in the ap_add_filter() prototype?  http_core can
just pass NULL for the ctx.  i don't see AddFilter as being the only way
to register a filter, other approaches may only know the context (which
is something other than the filter name) at the time ap_add_filter() is
called.  patch below puts it back, any problems with this?

Index: include/util_filter.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/util_filter.h,v
retrieving revision 1.15
diff -u -r1.15 util_filter.h
--- include/util_filter.h	2000/09/14 00:34:15	1.15
+++ include/util_filter.h	2000/09/14 03:33:50
@@ -283,7 +283,7 @@
  * @param r The request to add this filter for.
  * @deffunc void ap_add_filter(const char *name, request_rec *r)
  */
-API_EXPORT(void) ap_add_filter(const char *name, request_rec *r);
+API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r);
 
 /* The next two filters are for abstraction purposes only.  They could be
  * done away with, but that would require that we break modules if we ever
Index: main/http_core.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
retrieving revision 1.120
diff -u -r1.120 http_core.c
--- main/http_core.c	2000/09/14 02:16:07	1.120
+++ main/http_core.c	2000/09/14 03:33:57
@@ -3145,10 +3145,10 @@
 
     for (i = 0; i < conf->filters->nelts; i++) {
         char *foobar = items[i];
-        ap_add_filter(foobar, r);
+        ap_add_filter(foobar, NULL, r);
     }
 
-    ap_add_filter("CORE", r);
+    ap_add_filter("CORE", NULL, r);
 }
 
 static void register_hooks(void)
Index: main/http_protocol.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.124
diff -u -r1.124 http_protocol.c
--- main/http_protocol.c	2000/09/13 23:13:19	1.124
+++ main/http_protocol.c	2000/09/14 03:34:05
@@ -2064,7 +2064,7 @@
     if (r->chunked) {
         apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked");
         apr_table_unset(r->headers_out, "Content-Length");
-        ap_add_filter("CHUNK", r);
+        ap_add_filter("CHUNK", NULL, r);
     }
 
     if (r->byterange > 1) {
Index: main/util_filter.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
retrieving revision 1.17
diff -u -r1.17 util_filter.c
--- main/util_filter.c	2000/09/14 00:34:15	1.17
+++ main/util_filter.c	2000/09/14 03:34:06
@@ -99,7 +99,7 @@
     apr_register_cleanup(FILTER_POOL, NULL, filter_cleanup, apr_null_cleanup);
 }
 
-API_EXPORT(void) ap_add_filter(const char *name, request_rec *r)
+API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)
 {
     ap_filter_rec_t *frec = registered_filters;
 
@@ -108,7 +108,7 @@
             ap_filter_t *f = apr_pcalloc(r->pool, sizeof(*f));
 
             f->frec = frec;
-            f->ctx = NULL;
+            f->ctx = ctx;
             f->r = r;
 
             if (INSERT_BEFORE(f, r->filters)) {



Mime
View raw message