Dear Mailinglist,
I try do develop a simple Module which look at the *content/body* of
the request. After reading (not manipulate) some date of the request i
decide to forward the request to mod_proxy or to send a HTTP_OK.
I made in myModule a BIG Contenthandler like this
<code>
......
static int my_handler( request_rec *r)
{
//read the contet of the request
apr_bucket_brigade *bb;
conn_rec *c = r->connection;
bb = apr_brigade_create(r->pool, c->bucket_alloc);
ap_get_brigade(r->input_filters, bb, AP_MODE_GETLINE,
APR_BLOCK_READ, HUGE_STRING_LEN);
for ( bucket = APR_BRIGADE_FIRST(bb); bucket !=
APR_BRIGADE_SENTINEL(bb); bucket = APR_BUCKET_NEXT(bucket) )
{
const char *data;
apr_size_t len;
apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);
if ( ...do some genius work(data,len) ...)
{
return HTTP_OK;
}
else
{
return DECLINED;
}
}
}
....
static void register_hooks(apr_pool_t *p)
{
static const char * const aszSuc[] = { "mod_proxy.c",
"mod_proxy_http.c", NULL };
ap_hook_handler( my_handler, NULL, aszSuc, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA mod_processinformhandler = {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
register_hooks
};
</code>
Now my question:
I get the data from r->input_filters. For only sending the HTTP_OK this
is enough. But when i return DECLINED and mod_proxy want to do its dirty
work the r->input_filters is empty. In some FAQ i read "the best way to
get the data are input filters". But i dont know how input filters and
content handlers can communicate. Are filters in this situation the
right way, or is it possible to read form r->input_filters and put the
data back ???
I dont need 100% correct code ( this is my job :) ), i need a advice
mfg
Stephan