From: Gonzalo A. <ga...@us...> - 2006-11-06 19:48:34
|
Update of /cvsroot/mod-c/mod_c/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/src Modified Files: mod_c.c Log Message: * Session fixes: the 'Location' based session configuration works now. Basically, we store the name & arguments of the driver in a per-dir config record. Right before calling ehtml handler, we 'select' the driver. Index: mod_c.c =================================================================== RCS file: /cvsroot/mod-c/mod_c/src/mod_c.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** mod_c.c 12 Oct 2006 21:12:07 -0000 1.32 --- mod_c.c 6 Nov 2006 19:48:20 -0000 1.33 *************** *** 38,44 **** --- 38,46 ---- //#include <mod_c_sessions.h> #include <http_log.h> + #include <apr_strings.h> #include <assert.h> + /** * The name of the EHMTL file handler. *************** *** 132,135 **** --- 134,167 ---- } + if (dir_config->sessions) { + if (dir_config->session_driver == NULL) { + RERROR(r, "A session driver must be specified if sessions are to " + "be enabled"); + return HTTP_INTERNAL_SERVER_ERROR; + } + if (dir_config->session_id_driver == NULL) { + RERROR(r, "A session ID driver must be specified if sessions are to " + "be enabled"); + return HTTP_INTERNAL_SERVER_ERROR; + } + if (useSessionDriver(dir_config->session_driver, + dir_config->session_driver_arguments) < 0) { + RERROR(r, "Error selecting session driver %s " + "or applying arguments \"%s\"", + dir_config->session_driver, + dir_config->session_driver_arguments); + return HTTP_INTERNAL_SERVER_ERROR; + } + + if (useSessionIDDriver(dir_config->session_id_driver, + dir_config->session_id_driver_arguments) < 0) { + RERROR(r, "Error selecting session ID driver %s " + "or applying arguments \"%s\"", + dir_config->session_id_driver, + dir_config->session_id_driver_arguments); + return HTTP_INTERNAL_SERVER_ERROR; + } + } + // We have found the library that contains the EHTML application // execute its ehtml_run function *************** *** 277,286 **** // 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; --- 309,321 ---- // Set the default duration of a session dir_config->session_duration = 10080 /* DEF_SESSION_DURATION*/; // Set the default cookieless setting dir_config->cookieless = 0; // Set the default key size setting dir_config->key_size = 64 /*DEF_ID_SIZE*/; + + dir_config->session_driver = NULL; + dir_config->session_driver_arguments = NULL; + dir_config->session_id_driver = NULL; + dir_config->session_id_driver_arguments = NULL; return dir_config; *************** *** 459,466 **** { // mod_c_config * config = c_sconfig(parms->server); ! // mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (useSessionDriver(type, arguments) < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionType: unknown session type %s, " --- 494,501 ---- { // mod_c_config * config = c_sconfig(parms->server); ! mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (checkSessionDriver(type, arguments ? arguments : "") < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionType: unknown session type %s, " *************** *** 468,471 **** --- 503,508 ---- return errorMsg; } + dir_config->session_driver = apr_pstrdup(parms->pool, type); + dir_config->session_driver_arguments = arguments ? apr_pstrdup(parms->pool, arguments) : ""; return NULL; } *************** *** 477,484 **** { // mod_c_config * config = c_sconfig(parms->server); ! // mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (useSessionIDDriver(type, arguments) < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionIDType: unknown session id type %s, " --- 514,521 ---- { // mod_c_config * config = c_sconfig(parms->server); ! mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (checkSessionIDDriver(type, arguments ? arguments : "") < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionIDType: unknown session id type %s, " *************** *** 486,489 **** --- 523,528 ---- return errorMsg; } + dir_config->session_id_driver = apr_pstrdup(parms->pool, type); + dir_config->session_id_driver_arguments = arguments ? apr_pstrdup(parms->pool, arguments) : ""; return NULL; } |