httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel.Leguy" <Emmanuel.Le...@lifl.fr>
Subject [users@httpd] configuration module array erased?
Date Mon, 26 Jun 2006 12:07:42 GMT
OS: solaris 9
Apache: 2.2

A module directive is defined like that:

AP_INIT_TAKE1("MyDirective", my_directive_function, NULL, 
OR_FILEINFO,"Message"),

Where my_directive_function is:

static const char *my_directive_function (cmd_parms *cmd, void *dummy, 
const char *data)
{
  server_rec* s = cmd->server;
  my_server_conf* sconf = ap_get_module_config(s->module_config, 
&my_module);

  my_item* p = (my_item*)apr_array_push(sconf->array);

  p->field = apr_pstrdup(cmd->pool, data);

  return NULL;
}

my_server_conf:

typedef struct {
    apr_array_header_t* array;
} my_server_conf;

typedef struct {
  char  *field;
} my_item;

The sconf->array is updated with success in my_directive_function(). But 
when i want to use it in a fixup function, it is empty:

static int my_fixup_function (request_rec *r) {

  const apr_array_header_t  *arr;
  my_item   *items;
  int           i;
  my_server_conf *sconf;

...

  sconf = ap_get_module_config(r->server->module_config, &my_module);

  arr = sconf->array;
  items = (my_item *)arr->elts;

  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,"first element = 
%s",items[0].field);

...

}

In the error log i get:

[Mon Jun 26 13:29:43 2006] [error] [client 123.456.78.90] first element 
= (null)

I can't understand it (I browsed the mailing lists, apache faq, source 
code, apr header files). When i look at the configuration with mod_info 
(/server-info), values for this directive are correct. When i use a 
server under solaris 10 that works!!!

Thank you,

Manu.

-- 
Emmanuel Leguy          	LIFL - UMR8022 CNRS - Bat M3
Tel: +33 3 28 77 85 32  	USTL - Universite de Lille 1
Fax: +33 3 28 77 85 37  	59655 VILLENEUVE D'ASCQ CEDEX - FRANCE

mailto:Emmanuel.Leguy@lifl.fr	http://www.lifl.fr/ANNUAIRE/employee.php?login=leguye

Ce mail est signe par un certificat X509 fourni par le CNRS
La verification de ce certificat peut etre faite a l'adresse suivante: 
http://igc.services.cnrs.fr/CNRS-Standard/recherche.html 


Mime
View raw message