Bug 46406

Summary: Supporting relative paths in isapi_redirect.properties.
Product: Tomcat Connectors Reporter: Eugenio Alvarez <ealvarez>
Component: isapiAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 1.2.27   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
Attachments: Updated version of jk_isapi_plugin.c

Description Eugenio Alvarez 2008-12-16 05:50:07 UTC
Created attachment 23030 [details]
Updated version of jk_isapi_plugin.c

I have several hundred instances of Tomcat using the IIS ISAPI
redirect filter. 
I updated to version 1.2.27 of the ISAPI_redirect.dll to use the new
environment variables (JKISAPI_PATH, JKISAPI_NAME) so
that I don't have to edit each property file with full file paths.
However, it appears the ISAPI filter gets confused sometimes
when it gets reloaded multiple times and writes to log files of other instances on the same machine.
So, I would like to propose an enhancement to be able to have an
isapi_redirect.properties file with relative file paths like the following: 
###############################################
# Relative path to the log file for the ISAPI Redirector
log_file=isapi_redirect.log

# Relative path to the workers.properties file
worker_file=workers.properties

# Relative path to the uriworkermap.properties file
worker_mount_file=uriworkermap.properties
###############################################
Attached is a modified version of jk_isapi_plugin.c.
The additional lines added start at line number 2630.
Existing line:
ok = ok && get_config_parameter(src, JK_LOG_FILE_TAG, log_file, sizeof(log_file));
Added lines after 2630:
        if (ok && strrchr(log_file, '\\') == NULL) {
            StringCbCopy(tmpbuf, MAX_PATH, log_file);
            StringCbCopy(log_file, MAX_PATH, dll_file_path);
	    StringCbCat(log_file, MAX_PATH, "\\");
	    StringCbCat(log_file, MAX_PATH, tmpbuf);
	}

Existing line:
ok = ok && get_config_parameter(src, JK_WORKER_FILE_TAG, worker_file, sizeof(worker_file));
Additional lines added after above line:
        if (ok && strrchr(worker_file, '\\') == NULL) {
	    StringCbCopy(tmpbuf, MAX_PATH, worker_file);
	    StringCbCopy(worker_file, MAX_PATH, dll_file_path);
	    StringCbCat(worker_file, MAX_PATH, "\\");
	    StringCbCat(worker_file, MAX_PATH, tmpbuf);
        }
Existing line:
    ok = ok && get_config_parameter(src, JK_MOUNT_FILE_TAG, worker_mount_file, sizeof(worker_mount_file));
Additional lines added after above line:
	if (ok && strrchr(worker_mount_file, '\\') == NULL) {
	    StringCbCopy(tmpbuf, MAX_PATH, worker_mount_file);
	    StringCbCopy(worker_mount_file, MAX_PATH, dll_file_path);
	    StringCbCat(worker_mount_file, MAX_PATH, "\\");
	    StringCbCat(worker_mount_file, MAX_PATH, tmpbuf);
	}
Comment 1 Mladen Turk 2011-11-08 13:42:17 UTC
Fixed in the trunk.
I implemented a 'proper' relative path system which calculates
relative paths from the isapi_redirect.dll location using a
standard directory traversal notation (..\..\..)

So the things like
worker_properties=..\conf\worker.properties
should work now.