httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lusob <>
Subject Child init process is not initialized with the data stored by master process
Date Thu, 24 Jul 2008 09:05:51 GMT

I have initialized a struct by a directive and I need to access to it in
child init proceses.
But in the child init proceses the struct  is not initialized with the data
stored in setServer.

This is the struct to initialize:

typedef struct
	const char* pszServer;
	const char* pszUser;
	const char* pszPass;
} my_svr_cfg;

And this is the function command called by a directive:

// setServer
extern "C" const char* setServer(cmd_parms* pCmdParams, void* pConfig,
		const char* pszServer, const char* pszUser,const char* pszPass)
	my_svr_cfg* pStructServerConfig;

	// per-server
	server_rec* pServerRec = pCmdParams->server;
	pStructServerConfig = (my_svr_cfg*)ap_get_module_config(
pServerRec->module_config,&my_module );
	pStructServerConfig->pszServer = pszServer;
	pStructServerConfig->pszUser = pszUser;
	pStructServerConfig->pszPass = pszPass;
	return NULL;

This is the child init function:

// my_child_init
extern "C" void my_child_init(apr_pool_t* pool, server_rec* pServerRec )
	my_svr_cfg* pStructServerConfig;
	pStructServerConfig = (my_svr_cfg*)ap_get_module_config(
pServerRec->module_config,&my_module );

        // Here pStructServerConfig is not initialized with the data stored
in setServer

I use per-server config (VirtualHost ) in httpd.conf

Which is the problem?

thanks in advance!!

View this message in context:
Sent from the Apache HTTP Server - Module Writers mailing list archive at

View raw message