[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modules
Subject: Re: [apache-modules] How input and output filter communicate
From: Nick Kew <nick () webthing ! com>
Date: 2003-02-17 15:19:59
[Download RAW message or body]
On Mon, 17 Feb 2003, Kent Fitch wrote:
> But I'm very interested in request_config as a better
> alternative. I can't find any good examples of it in
> the current Apache source - can you point me to some?
Not OTTOMH. Quicker to cut&paste from my current work-in-progress at
http://access.www.webthing.com/software/mod_accessibility/
mod_accessibility is an output filter that rewrites outgoing HTML
to improve accessibility. Apart from the filter itself, there's
a post_read_request hook that does some simple URL rewriting.
This serves to offer readers a choice of different views on a page,
and to preserve state.
So that's
typedef struct req_cfg {
const char* view ;
const char* variant ;
} req_cfg ;
static int getView(request_rec* r) {
...
req_cfg* cfg = apr_palloc(r->pool, sizeof(req_cfg)) ;
/* Parse /view=..../ component of URL and rewrite it out
Store the results in cfg
*/
ap_set_module_config(r->request_config, &accessibility_module, cfg) ;
return DECLINED ; // keep out of the way of other modules
}
And then to access the stuff in the filter, I make that a field
in the filter context:
typedef struct saxctxt {
...
req_cfg* view ;
...
} saxctxt ;
So in my filter_init function, I just use
ctx->view =
ap_get_module_config(f->r->request_config,&accessibility_module);
and my filter then has the data from the post_request hook in ctx->view,
and can now parse it to an enum, etc.
--
Nick Kew
---------------------------------------------------------------------
To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
For additional commands, e-mail: apache-modules-help@covalent.net
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic