Beispiel #1
0
/** Register a URI pattern with AOLserver
 */
static void registerURI (jk_env_t* env, jk_uriEnv_t* uriEnv, char* vserver, char* serverName) {
    uriContext* ctx;
    char* uriname;

    if (uriEnv==NULL || uriEnv->mbean==NULL)
	return;

    uriname=uriEnv->mbean->getAttribute (env, uriEnv->mbean, "uri");
    if (uriname==NULL || strcmp(uriname, "/")==0)
        return;

    ctx = Ns_Malloc (sizeof (uriContext));
    if (ctx == NULL)
        return;

    ctx->serverName = serverName;
    ctx->uriEnv = uriEnv;

    if (uriEnv->mbean->debug > 0)
        env->l->jkLog (env, env->l, JK_LOG_DEBUG, "registering URI %s", uriname);

    Ns_RegisterRequest(vserver, "GET", uriname, jk2_handler, NULL, ctx, 0);
    Ns_RegisterRequest(vserver, "HEAD", uriname, jk2_handler, NULL, ctx, 0);
    Ns_RegisterRequest(vserver, "POST", uriname, jk2_handler, NULL, ctx, 0);
}
Beispiel #2
0
static void 
php_ns_config(php_ns_context *ctx, char global)
{
	int i;
	char *path;
	Ns_Set *set;

	path = Ns_ConfigGetPath(ctx->ns_server, ctx->ns_module, NULL);
	set = Ns_ConfigGetSection(path);

	for (i = 0; set && i < Ns_SetSize(set); i++) {
		char *key = Ns_SetKey(set, i);
		char *value = Ns_SetValue(set, i);

		if (global && !strcasecmp(key, "map")) {
			Ns_Log(Notice, "Registering PHP for \"%s\"", value);
			Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
			Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
			Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);

	/* 
	 * Deactivated for now. The ini system will cause random crashes when 
	 * accessed from here (since there are no locks to protect the global 
	 * known_directives) 
	 */

		} else if (!global && !strcasecmp(key, "php_value")) {
			Ns_Log(Notice, "php_value has been deactivated temporarily. Please use a php.ini file to pass directives to PHP. Thanks.");
#if 0
			char *val;

			val = strchr(value, ' ');
			if (val) {
				char *new_key;
				
				new_key = estrndup(value, val - value);
				
				do { 
					val++; 
				} while(*val == ' ');

				Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
				zend_alter_ini_entry(new_key, strlen(new_key) + 1, val, 
						strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
				
				efree(new_key);
			}
#endif
		}
		
	}
}