You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by vishal arvindrao ruikar <vi...@rediffmail.com> on 2003/07/16 07:25:22 UTC
vishal (plz help me regarding filter problem )
hello sir ..
i am student of final computer science and engg ..
i read the whole apache server code and understand the
concepts ..
i want to submit also apache documets to u which i
prepare
for that but sir i have one problem regarding filter
inmplentation here.. plz send me correct solution for that
..
the problem is follows as :
i write one filter module just for appending string to
html document what ever i request in brower .
i compiled my code successfully , install and added
by using
apxs -c -i -a append_module.c on linux platform
.
i put one fprintf statment to see the really filter
register or not . but sir meg printed in error fiile .
that mean it evocks the register_hook but i can't say
anything
after that what is going to happen with my code .
i set httpd.conf file
by using
SetOutputFilter APPEND
in proper way .
and also i use
AddOutputFilter APPEND .html
but it doesn't works .
currently i am planing to write filter to add
more functionality in apache .
but sir if i fail to run very simple code then
how can i proceed for big code ..
so sir plz send me correct modification if needed
and needed configuration to run this module succssfully
i have 2.0.46 distribution ...
here is my code :
#include "apr_strings.h"
#include "util_filter.h"
#include "http_request.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_log.h"
#include "http_main.h"
#include "ap_config.h"
#include "http_config.h"
#include "httpd.h"
#include "apr_general.h"
#include "apr_buckets.h"
#include "apr_tables.h"
module AP_MODULE_DECLARE_DATA append_module;
static int append_filter(ap_filter_t *f, apr_bucket_brigade *bb)
{
apr_bucket *e, *n;
request_rec *r = f->r;
conn_rec *c = r->connection;
char *date_val;
apr_size_t len ;
char *buff ;
buff=apr_bucket_alloc(len, c->bucket_alloc);
buff[0]='v';
buff[1]='i';
buff[2]='s';
buff[3]='h';
buff[4]='a';
buff[5]='l';
fprintf(stderr,"hello vishal , we r now in footer
handler ");
if(!strncasecmp(f->r->content_type, "text/html", 9))
{
e=APR_BRIGADE_LAST(bb);
if (APR_BUCKET_IS_EOS(e))
{
n= apr_bucket_pool_create(buff ,len,f->r->pool
, f->c->bucket_alloc );
APR_BUCKET_INSERT_BEFORE(e, n);
apr_table_unset(f->r->headers_out, "ETag");
apr_table_unset(f->r->headers_out,
"Last-Modified");
}
}
ap_pass_brigade(f->next, bb);
return APR_SUCCESS;
}
static void footer_register_hook(apr_pool_t *p)
{
fprintf(stderr,"hello vishal , we r now in register
hook ");
ap_register_output_filter("FOOTERFILTER",
footer_filter,NULL, AP_FTYPE_CONTENT_SET);
}
module AP_MODULE_DECLARE_DATA footer_module =
{
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
append_register_hook
};
so sir plz help me ..
vishal ruikar
vinux
___________________________________________________
Click below to experience Sooraj R Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
& Kareena http://www.mpkdh.com
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
Re: vishal (plz help me regarding filter problem )
Posted by Astrid Keßler <ke...@kess-net.de>.
> * vishal arvindrao ruikar wrote:
>> hello sir ..
>> i am student of final computer science and engg ..
>> i read the whole apache server code and understand the
>> concepts ..
>> i want to submit also apache documets to u which i
>> prepare
>> for that but sir i have one problem regarding filter
>> inmplentation here.. plz send me correct solution for that
>> ..
> You're a bit off-topic here. Such questions are better asked on developer
> mailing lists.
And please, don't send this mail to half the world or every private mail
address you could find. Addressing the correct mailing list will higher
much more your chance to get an answer. :-)
Good luck
Kess
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
Re: vishal (plz help me regarding filter problem )
Posted by André Malo <nd...@perlig.de>.
* vishal arvindrao ruikar wrote:
> hello sir ..
> i am student of final computer science and engg ..
> i read the whole apache server code and understand the
> concepts ..
> i want to submit also apache documets to u which i
> prepare
> for that but sir i have one problem regarding filter
> inmplentation here.. plz send me correct solution for that
> ..
You're a bit off-topic here. Such questions are better asked on developer
mailing lists.
> i put one fprintf statment to see the really filter
> register or not . but sir meg printed in error fiile .
> that mean it evocks the register_hook but i can't say
> anything
I'd guess, some more homework is necessary. <http://www.onlamp.com/pub/ct/38>
seems to be a good entry point for better understanding of filter writing.
Ryan develops there a filter more or less from scratch.
Good luck!
nd
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org