You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by luca regini <lu...@gmail.com> on 2005/06/17 17:34:04 UTC

BUG in apache?????

The problem shows itself with the following simple module.
When the hook is of type "ap_hook_post_read_request" per dir configuration 
is not instantiated 
correctly and debug has always value -1. With other kinds of hooks the debug 
variable is correctly is instantiated with the various values found in the 
DIRECTORY LOCATION and FILES directives. 

Is this a bug?

Regards,
Luca


module AP_MODULE_DECLARE_DATA config_module;
typedef struct __my {
int debug;

} config_dir_t;


static const char *debug_cmd(cmd_parms *cmd, void *in_dc,
const char *name)
{
config_dir_t *dc = in_dc;

dc->debug= atoi(name);
return NULL;
}


static void *create_dir_config_t(apr_pool_t *p,char *dummy)
{
config_dir_t *dc = (config_dir_t *)apr_pcalloc(p,sizeof(config_dir_t));
dc->debug = -1;
return dc;
}

static int find_code_page(request_rec *r)
{
config_dir_t *dc = ap_get_module_config(r->per_dir_config,
&config_module);
fprintf(stderr,"Config: %d \n",dc->debug); 
fflush(stderr);
return DECLINED;
}

static const command_rec cmds[] =
{
AP_INIT_TAKE1("debug",
debug_cmd,
NULL,
OR_FILEINFO,
"debug config di m....a"), 

{NULL}
};

static void charset_register_hooks(apr_pool_t *p)
{
ap_hook_post_read_request(find_code_page, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA config_module =
{
STANDARD20_MODULE_STUFF,
create_dir_config_t,
NULL,
NULL,
NULL,
cmds,
charset_register_hooks
};

Re: BUG in apache?????

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 10:34 AM 6/17/2005, luca regini wrote:

>The problem shows itself with the following simple module.
>When the hook is of type "ap_hook_post_read_request" per dir configuration is not   instantiated   

Not a bug; nobody has started to break down the incoming
request yet to figure out any location.  translate name
and map to storage come afterwards.

mod_security and so on would be useless.  They would be unable
to examine the unprocessed request and determine some value.

FWIW - even if we did instantiate a value for the per dir config,
it would be discarded soon after post read request.  It's not the
appropriate hook to look at that member of the request struct.

Please review;

  http://httpd.apache.org/docs-2.1/developer/request.html

and remember that post read request isn't even a request hook!!!
It's a connection hook that happens before request processing.
Bill



Re: Bug in apache?

Posted by André Malo <nd...@perlig.de>.
* luca regini wrote:

> The problem shows itself with the following simple module.
> When the hook is of type "ap_hook_post_read_request" per dir
> configuration is not instantiated
> correctly and debug has always value -1. With other kinds of hooks the
> debug variable is correctly is instantiated with the various values found
> in the DIRECTORY LOCATION and FILES directives.
>
> Is this a bug?

No. This hook is run right after the virtual host was determined, before 
anything about files and directories is known (translate_name, which maps 
URLs to files, runs later).

nd
-- 
"Umfassendes Werk (auch fuer Umsteiger vom Apache 1.3)"
                                          -- aus einer Rezension

<http://pub.perlig.de/books.html#apache2>