You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Prajakt Deolasee <pd...@in.firstrain.com> on 2002/11/20 10:39:32 UTC

Writing new module for Apache 2.0

Hi All,

I am trying to write a new module for post processing of the response.
I am using Apache 2.0 as a reverse proxy.

I wrote a modeul called mod_xyz. Apache could load the module properly
and the xyz_register_hook method was also called properly. In the "hook"
function I wrote following code,

static void xyz_register_hook(apr_pool_t *p)
{
	xyz_hook_response_handler(ap_xyz_response_handler, NULL, NULL, APR_HOOK_REALLY_LAST);
}

and ap_xyz_response_handler function looks like this,

int ap_xyz_response_handler(request_rec *r)
{
  printf("Hello");
 // Send a message to stderr (apache redirects this to the error log)
  fprintf(stderr,"apache2_mod_tut1: A request was made.\n");

  // We need to flush the stream for messages to appear right away.
  // Performing an fflush() in a production system is not good for
  // performance - don't do this for real.
  fflush(stderr);

  // Return DECLINED so that the Apache core will keep looking for
  // other modules to handle this request.  This effectively makes
  // this module completely transparent.
  return DECLINED;
}

But this function is never called. Can somebody tell me whats wrong with this.

-Prajakt

Re: Writing new module for Apache 2.0

Posted by Jeff Trawick <tr...@attglobal.net>.
"Prajakt Deolasee" <pd...@in.firstrain.com> writes:

> static void xyz_register_hook(apr_pool_t *p)
> {
> 	xyz_hook_response_handler(ap_xyz_response_handler, NULL, NULL, APR_HOOK_REALLY_LAST);
> }
...
> But this function is never called. Can somebody tell me whats wrong with this.

If you hook it really last then you've hooked it *after* whichever
hook is going to handle it, and subsequent hooks won't be called.

Hook it REALLY_FIRST.

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...