From: Matej U. <mat...@us...> - 2006-09-17 18:40:45
|
Update of /cvsroot/mod-c/mod_c/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26677/src Modified Files: ChangeLog mod_c.c Log Message: On demand loading works now. Index: mod_c.c =================================================================== RCS file: /cvsroot/mod-c/mod_c/src/mod_c.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mod_c.c 15 Sep 2006 10:38:25 -0000 1.24 --- mod_c.c 17 Sep 2006 18:40:41 -0000 1.25 *************** *** 69,74 **** static int CHandler( request_rec *r ) { ! mod_c_config * config; ! mod_c_dir_config* dir_config; int retVal; ehtml_rec e = { NULL, NULL, 0, 0 }; --- 69,74 ---- static int CHandler( request_rec *r ) { ! mod_c_config * config; ! mod_c_dir_config* dir_config; int retVal; ehtml_rec e = { NULL, NULL, 0, 0 }; *************** *** 97,101 **** // Are we allowed to serve on demand requests? ! if (!config->allow_on_demand) return HTTP_SERVICE_UNAVAILABLE; --- 97,101 ---- // Are we allowed to serve on demand requests? ! if (!config->allow_on_demand || LoadAndCacheEHTML(config->ehtml_cache, r->filename, &e) < 0) return HTTP_SERVICE_UNAVAILABLE; *************** *** 124,131 **** // We have found the library that contains the EHTML application // execute its ehtml_run function ! ehtml_run_func _tmp = ( ehtml_run_func ) e.entryf; ! request_context rc = { r, config, dir_config }; ! retVal = _tmp( &rc ); ! return retVal; } --- 124,131 ---- // We have found the library that contains the EHTML application // execute its ehtml_run function ! ehtml_run_func _tmp = ( ehtml_run_func ) e.entryf; ! request_context rc = { r, config, dir_config }; ! retVal = _tmp( &rc ); ! return retVal; } *************** *** 172,190 **** static void * CCreateDirConfig(apr_pool_t *p, char *dir) { ! mod_c_dir_config * dir_config = (mod_c_dir_config *) apr_palloc( p, sizeof( mod_c_dir_config ) ); ! ! dir_config->dir = dir;//( dir ) ? dir : root_dir_id; ! // Disable sessions by default... ! dir_config->sessions = 0; ! // Set the default duration of a session ! dir_config->session_duration = 10080 /* DEF_SESSION_DURATION*/; ! // Set the default session management type ! dir_config->session_funcs = 0; ! // Set the default cookieless setting ! dir_config->cookieless = 0; ! // Set the default key size setting ! dir_config->key_size = 64 /*DEF_ID_SIZE*/; ! ! return dir_config; } --- 172,190 ---- static void * CCreateDirConfig(apr_pool_t *p, char *dir) { ! mod_c_dir_config * dir_config = (mod_c_dir_config *) apr_palloc( p, sizeof( mod_c_dir_config ) ); ! ! dir_config->dir = dir;//( dir ) ? dir : root_dir_id; ! // Disable sessions by default... ! dir_config->sessions = 0; ! // Set the default duration of a session ! dir_config->session_duration = 10080 /* DEF_SESSION_DURATION*/; ! // Set the default session management type ! dir_config->session_funcs = 0; ! // Set the default cookieless setting ! dir_config->cookieless = 0; ! // Set the default key size setting ! dir_config->key_size = 64 /*DEF_ID_SIZE*/; ! ! return dir_config; } *************** *** 204,214 **** static void * CCreateServerConfig( apr_pool_t *p, server_rec *s ) { ! mod_c_config * config = ( mod_c_config* ) apr_palloc ( p, sizeof( mod_c_config ) ); ! // Initialize the caches (both for session drivers and ehtml files) ! config->ehtml_cache = CreateEHTMLCache(); ! //config->session_drivers = InitSessionDrivers(); ! //config->enable_remote_sessions = 0; ! //config->session_server_port = -1; ! //config->disable_session_server = 0; config->allow_on_demand = 0; config->allow_auto_refresh = 0; --- 204,214 ---- static void * CCreateServerConfig( apr_pool_t *p, server_rec *s ) { ! mod_c_config * config = ( mod_c_config* ) apr_palloc ( p, sizeof( mod_c_config ) ); ! // Initialize the caches (both for session drivers and ehtml files) ! config->ehtml_cache = CreateEHTMLCache(); ! //config->session_drivers = InitSessionDrivers(); ! //config->enable_remote_sessions = 0; ! //config->session_server_port = -1; ! //config->disable_session_server = 0; config->allow_on_demand = 0; config->allow_auto_refresh = 0; *************** *** 219,223 **** // "Error message: '%s'", retVal ); ! return config; } --- 219,223 ---- // "Error message: '%s'", retVal ); ! return config; } *************** *** 227,231 **** static int CPostConfig(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s) { ! return OK; } --- 227,231 ---- static int CPostConfig(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s) { ! return OK; } *************** *** 244,251 **** static void CRegisterHooks( apr_pool_t * pool ) { ! // We like the middle, don't we? ! ap_hook_handler( CHandler, NULL, NULL, APR_HOOK_MIDDLE ); ! ap_hook_post_config( CPostConfig, NULL, NULL, APR_HOOK_MIDDLE ); ! ap_hook_child_init( CChildInit, NULL, NULL, APR_HOOK_MIDDLE ); } --- 244,251 ---- static void CRegisterHooks( apr_pool_t * pool ) { ! // We like the middle, don't we? ! ap_hook_handler( CHandler, NULL, NULL, APR_HOOK_MIDDLE ); ! ap_hook_post_config( CPostConfig, NULL, NULL, APR_HOOK_MIDDLE ); ! ap_hook_child_init( CChildInit, NULL, NULL, APR_HOOK_MIDDLE ); } *************** *** 270,286 **** static char* LoadEHTMLDirective( cmd_parms* parms, void *mconfig, const char * path ) { ! mod_c_config * config = c_sconfig(parms->server); ehtml_rec e; const char* msg = LoadAndCacheEHTML(config->ehtml_cache, path, &e); if (msg != NULL) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTML: Could not load the specified file '%s'. " "Error: '%s'.", path, msg); ! return errorMsg; ! } ! else ! return 0; } --- 270,286 ---- static char* LoadEHTMLDirective( cmd_parms* parms, void *mconfig, const char * path ) { ! mod_c_config * config = c_sconfig(parms->server); ehtml_rec e; const char* msg = LoadAndCacheEHTML(config->ehtml_cache, path, &e); if (msg != NULL) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTML: Could not load the specified file '%s'. " "Error: '%s'.", path, msg); ! return errorMsg; ! } ! else ! return 0; } *************** *** 305,311 **** { if (registerSessionDriver(name, path) < 0) { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTMLSessionDriver: Could not load the session driver '%s' in '%s'. Error message: %s / %s", name, path, dlerror(), strerror(errno)); ! return errorMsg; } return NULL; --- 305,311 ---- { if (registerSessionDriver(name, path) < 0) { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTMLSessionDriver: Could not load the session driver '%s' in '%s'. Error message: %s / %s", name, path, dlerror(), strerror(errno)); ! return errorMsg; } return NULL; *************** *** 318,324 **** { if (registerSessionIDDriver(name, path) < 0) { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTMLSessionIDDriver: Could not load the session id driver '%s' in '%s'. Error message: %s / %s", name, path, dlerror(), strerror(errno)); ! return errorMsg; } return NULL; --- 318,324 ---- { if (registerSessionIDDriver(name, path) < 0) { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "LoadEHTMLSessionIDDriver: Could not load the session id driver '%s' in '%s'. Error message: %s / %s", name, path, dlerror(), strerror(errno)); ! return errorMsg; } return NULL; *************** *** 330,336 **** static char * EHTMLSessionsDirective( cmd_parms * parms, void *mconfig, int on) { ! mod_c_dir_config* dir_config = (mod_c_dir_config*) ap_get_module_config( parms->context, &c_module ); ! dir_config->sessions = ( on != 0 ); ! return 0; } --- 330,336 ---- static char * EHTMLSessionsDirective( cmd_parms * parms, void *mconfig, int on) { ! mod_c_dir_config* dir_config = (mod_c_dir_config*) ap_get_module_config( parms->context, &c_module ); ! dir_config->sessions = ( on != 0 ); ! return 0; } *************** *** 340,356 **** static char * EHTMLSessionDurationDirective( cmd_parms* parms, void *mconfig, const char * minutes ) { ! int mins = atoi( minutes ); ! if ( mins < 1 ) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "EHTMLSessionDuration: Please specify a positive integer." ); ! return errorMsg; ! } ! else ! { ! mod_c_dir_config* dir_config = (mod_c_dir_config*) ap_get_module_config( parms->context, &c_module ); ! dir_config->session_duration = mins; ! return 0; ! } } --- 340,356 ---- static char * EHTMLSessionDurationDirective( cmd_parms* parms, void *mconfig, const char * minutes ) { ! int mins = atoi( minutes ); ! if ( mins < 1 ) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "EHTMLSessionDuration: Please specify a positive integer." ); ! return errorMsg; ! } ! else ! { ! mod_c_dir_config* dir_config = (mod_c_dir_config*) ap_get_module_config( parms->context, &c_module ); ! dir_config->session_duration = mins; ! return 0; ! } } *************** *** 397,403 **** static char * EHTMLCookielessDirective( cmd_parms * parms, void *mconfig, int on) { ! mod_c_dir_config* dir_config = c_pconfig(parms); ! dir_config->cookieless = ( on != 0 ); ! return 0; } --- 397,403 ---- static char * EHTMLCookielessDirective( cmd_parms * parms, void *mconfig, int on) { ! mod_c_dir_config* dir_config = c_pconfig(parms); ! dir_config->cookieless = ( on != 0 ); ! return 0; } *************** *** 407,428 **** static char * EHTMLSessionIdSizeDirective( cmd_parms* parms, void *mconfig, const char * size ) { ! int bytes = atoi( size ); ! if ( bytes < 0 ) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "EHTMLSessionIdSize: Please specify a positive integer." ); ! return errorMsg; ! } ! else ! { ! mod_c_dir_config* dir_config = c_pconfig(parms); ! dir_config->key_size = bytes; ! return 0; ! } } command_rec c_commands[] = { ! AP_INIT_TAKE1("LoadEHTML", (void*)LoadEHTMLDirective, NULL, RSRC_CONF, "Arguments: a valid absolute path to an ehtml file. " "If you change the ehtml file in time the server is running, " --- 407,428 ---- static char * EHTMLSessionIdSizeDirective( cmd_parms* parms, void *mconfig, const char * size ) { ! int bytes = atoi( size ); ! if ( bytes < 0 ) ! { ! char * errorMsg = ( char * ) apr_palloc( parms->temp_pool, 512 ); ! snprintf( errorMsg, 512, "EHTMLSessionIdSize: Please specify a positive integer." ); ! return errorMsg; ! } ! else ! { ! mod_c_dir_config* dir_config = c_pconfig(parms); ! dir_config->key_size = bytes; ! return 0; ! } } command_rec c_commands[] = { ! AP_INIT_TAKE1("LoadEHTML", (void*)LoadEHTMLDirective, NULL, RSRC_CONF, "Arguments: a valid absolute path to an ehtml file. " "If you change the ehtml file in time the server is running, " *************** *** 440,465 **** // Session directives ! AP_INIT_TAKE2("LoadEHTMLSessionDriver", (void*)LoadEHTMLSessionDriver, NULL, RSRC_CONF, "Driver name and a valid absolute path to a session driver file." ), ! AP_INIT_TAKE2("LoadEHTMLSessionIDDriver", (void*)LoadEHTMLSessionIDDriver, NULL, RSRC_CONF, "Driver name and a valid absolute path to a session driver file." ), ! AP_INIT_FLAG("EHTMLSessions", (void*)EHTMLSessionsDirective, NULL, OR_LIMIT, "< on | off > - 'on' enables sessions while 'off' " "disables them." ), ! AP_INIT_TAKE1("EHTMLSessionDuration", (void*)EHTMLSessionDurationDirective, NULL, OR_LIMIT, "Specify the number of minutes, default is 30 " "minutes." ), ! AP_INIT_TAKE12("EHTMLSessionType", (void*)EHTMLSessionTypeDirective, NULL, OR_LIMIT, "< type > [ arguments ] - the first parameter is " "mandatory, while the second one is needed only if the selected " "type of session management needs it." ), ! AP_INIT_TAKE12("EHTMLSessionIDType", (void*)EHTMLSessionIDTypeDirective, NULL, OR_LIMIT, "< type > [ arguments ] - the first parameter is " --- 440,465 ---- // Session directives ! AP_INIT_TAKE2("LoadEHTMLSessionDriver", (void*)LoadEHTMLSessionDriver, NULL, RSRC_CONF, "Driver name and a valid absolute path to a session driver file." ), ! AP_INIT_TAKE2("LoadEHTMLSessionIDDriver", (void*)LoadEHTMLSessionIDDriver, NULL, RSRC_CONF, "Driver name and a valid absolute path to a session driver file." ), ! AP_INIT_FLAG("EHTMLSessions", (void*)EHTMLSessionsDirective, NULL, OR_LIMIT, "< on | off > - 'on' enables sessions while 'off' " "disables them." ), ! AP_INIT_TAKE1("EHTMLSessionDuration", (void*)EHTMLSessionDurationDirective, NULL, OR_LIMIT, "Specify the number of minutes, default is 30 " "minutes." ), ! AP_INIT_TAKE12("EHTMLSessionType", (void*)EHTMLSessionTypeDirective, NULL, OR_LIMIT, "< type > [ arguments ] - the first parameter is " "mandatory, while the second one is needed only if the selected " "type of session management needs it." ), ! AP_INIT_TAKE12("EHTMLSessionIDType", (void*)EHTMLSessionIDTypeDirective, NULL, OR_LIMIT, "< type > [ arguments ] - the first parameter is " *************** *** 467,489 **** "type of session management needs it." ), ! AP_INIT_FLAG("EHTMLCookieless", (void*)EHTMLCookielessDirective, NULL, OR_LIMIT, "< on | off > - 'on' disables cookies while 'off' " "enables them." ), ! AP_INIT_TAKE1("EHTMLSessionIdSize", (void*)EHTMLSessionIdSizeDirective, NULL, OR_LIMIT, "The number of bytes" ), ! { NULL } }; module c_module = { ! STANDARD20_MODULE_STUFF, ! CCreateDirConfig, ! NULL, ! CCreateServerConfig, ! NULL, ! c_commands, ! CRegisterHooks }; --- 467,489 ---- "type of session management needs it." ), ! AP_INIT_FLAG("EHTMLCookieless", (void*)EHTMLCookielessDirective, NULL, OR_LIMIT, "< on | off > - 'on' disables cookies while 'off' " "enables them." ), ! AP_INIT_TAKE1("EHTMLSessionIdSize", (void*)EHTMLSessionIdSizeDirective, NULL, OR_LIMIT, "The number of bytes" ), ! { NULL } }; module c_module = { ! STANDARD20_MODULE_STUFF, ! CCreateDirConfig, ! NULL, ! CCreateServerConfig, ! NULL, ! c_commands, ! CRegisterHooks }; Index: ChangeLog =================================================================== RCS file: /cvsroot/mod-c/mod_c/src/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ChangeLog 15 Sep 2006 10:38:25 -0000 1.5 --- ChangeLog 17 Sep 2006 18:40:41 -0000 1.6 *************** *** 1,2 **** --- 1,6 ---- + 2006-09-17 Matej Urbas <mat...@gm...> + + * mod_c.c: Implemented on demand loading of EHTML files. + 2006-09-15 Matej Urbas <mat...@gm...> |