httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-2.0/src/main http_core.c http_protocol.c util_filter.c
Date Thu, 14 Sep 2000 02:06:34 GMT
On Wed, Sep 13, 2000 at 11:13:21PM -0000, rbb@locus.apache.org wrote:
> rbb         00/09/13 16:13:21
> 
>   Modified:    src      CHANGES
>                src/include http_core.h util_filter.h
>                src/main http_core.c http_protocol.c util_filter.c
>   Log:
>...
>   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.

Woah!

That isn't right. The ctx parameter in the ap_add_filter() is present so
that the filters can be parameterized. How are we supposed to parameterize
the filters now?

Consider the following code:

  void foobar_insert_filters(request_rec *r)
  {
      if (client_uses_WAP(r))
          ap_add_filter("foobar_rewrite", (void *)FOOBAR_WAP, r);
      else
          ap_add_filter("foobar_rewrite", (void *)FOOBAR_HTML, r);
  }

We still need to be able to handle the above.

The AddFilter directive simply uses NULL for the ctx parameter. When Ken was
discussing the directive, and queried about how to parameterize, that would
also fit in here.

That said, I see one of two MUST-DO cases:

1) put the ctx parameter back into ap_add_filter()
2) have separate notions of filter context (f->ctx) and filter params
   (f->params). The latter would be passed to ap_add_filter.
   [ type? no particular thought. at least a string, but the question is how
     much parsing does the core do. tokenize into words? raw string? ]

I'm open to either approach.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message