Hi,
I have tried with this option AP_FTYPE_PROTOCOL.
But my input filter is not called.
But when I change the type to AP_FTYPE_RESOURCE, my filter did get called
but no header.
I have checked the Apache code where following modules filters are
registered with this option.
ap_register_input_filter("HTTP_IN", ap_http_filter,NULL, AP_FTYPE_PROTOCOL);
ap_register_input_filter (ssl_io_buffer, ssl_io_filter_buffer, NULL,
AP_FTYPE_PROTOCOL - 1);
ap_register_input_filter("NET_TIME", net_time_filter, NULL,
AP_FTYPE_PROTOCOL);
Please find my code snippet below to check if I am doing correct or not.
Let me know if I am doing correct or not.
code snippet
============
module AP_MODULE_DECLARE_DATA input_module = {
STANDARD20_MODULE_STUFF,
NULL, /* module initializer */
NULL, /* create per-dir config structures */
NULL, /* merge per-dir config structures */
NULL, /* create per-server config structures */
my_table, /* merge per-server config structures */
mod_my_register_hooks,
};
static ap_filter_rec_t * globalInputFilter;
static void
mod_my_register_hooks (apr_pool_t * p)
{
ap_hook_child_init (my_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_insert_filter(my_insertfilter , NULL, NULL, APR_HOOK_MIDDLE);
globalInputFilter= ap_register_input_filter("MY_READ_INPUT",
my_input_filter ,NULL, AP_FTYPE_PROTOCOL );
};
static void my_insertfilter (request_rec * r)
{
ReqRspCtx *ctx;
ctx = (ReqRspCtx *)apr_palloc(r->pool,sizeof(ReqRspCtx));
ap_add_input_filter_handle ( globalInputFilter, (void *)ctx, r,
r->connection);
}
static apr_status_t my_input_filter (ap_filter_t * f, apr_bucket_brigade *
bb,
ap_input_mode_t mode,apr_read_type_e
block,
apr_off_t readbytes)
{
//Function Body.
}
Regards,
Ashish
On Tue, Dec 2, 2008 at 2:50 PM, Sorin Manolache <[EMAIL PROTECTED]> wrote:
> On Tue, Dec 2, 2008 at 10:12, Ashish Khare <[EMAIL PROTECTED]> wrote:
> > Hi Ryan,
> >
> > I need to access header in the input filter.
> >
> > I means all the unparsed data sent by the client in the request which
> > contains header information also.
> >
> > Please let me know how to do this.
> >
> > I have tried implementing the input filter but ap_get_brigade() call
> returns
> > empty brigade, which means it is returning only body and no headers.
> >
> > But i want to access header data.
> >
> > Please help me in this.
> >
>
> Make your filter of type AP_FTYPE_PROTOCOL.
>
> S
>