You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Tim Whittington <Ti...@orion.co.nz> on 2001/09/10 04:14:44 UTC

[PATCH]: Multiple Tomcat 3.2 ISAPI redirectors on the one machine

Afternoon Larry & Ignacio,

I've updated the patch to use a .properties file and
to remove the dependency on shlwapi.dll (uses _splitpath/_makepath instead).
I also added a flag to indicate in the log what settings (properties or
registry) 
were being used.
Also brought the code style into line with the rest of the file (sorry).
The patch is now against the 1.6 revision in CVS (previously from the 3.2.3
distro)

It was a mission to create a minimal diff for this as the files in CVS have
a 
mix of DOS and Unix LFs. Had to do a manual merge to stop the editor
converting the LFs.

regards

tim

> -----Original Message-----
> From: Larry Isaacs [mailto:Larry.Isaacs@sas.com]
> Sent: Saturday, 8 September 2001 11:16
> To: 'Ignacio J. Ortega '
> Cc: ''Tim.Whittington@orion.co.nz' '
> Subject: RE: PATCH: Multiple Tomcat 3.2 ISAPI redirectors on the one
> machi ne
> 
> 
> Hi, 
> 
> I'm replying directly because my posts from home hit the moderater and
> I don't way to annoy Craig. :)
> 
> I can see the need for this.  I would prefer to hack the string rather
> than add a dependency on shlwapi.dll.
> 
> Cheers,
> Larry
>  
> 
> -----Original Message-----
> From: Ignacio J. Ortega
> To: 'tomcat-dev@jakarta.apache.org'
> Cc: 'Tim.Whittington@orion.co.nz'; 'Larry Isaacs'
> Sent: 9/7/01 4:42 PM
> Subject: RE: PATCH: Multiple Tomcat 3.2 ISAPI redirectors on 
> the one machi ne
> 
> Hola Tim:
> 
> I like this patch.. 
> 
> Larry can we include it for Tomcat 3.3 ?
> 
> I propose to change the file name from .ini to .properties..
> 
> And please send the patch following the guidelines at
> <http://jakarta.apache.org/site/source.html>..
> 
> Basically: 
> 
> * cvs diff -u 
> * As an attached file not inline 
> * follow the same code conventions used by the patched code .
> 
> 
> Saludos ,
> Ignacio J. Ortega
> 
> 
> > -----Mensaje original-----
> > De: Tim Whittington [mailto:Tim.Whittington@orion.co.nz]
> > Enviado el: viernes 7 de septiembre de 2001 7:15
> > Para: 'tomcat-dev@jakarta.apache.org'
> > Asunto: PATCH: Multiple Tomcat 3.2 ISAPI redirectors on the 
> > one machine
> > 
> > 
> > Afternoon tomcat-dev (It's late afternoon down here in New Zealand)
> > 
> > We have multiple applications that use the IIS ASAPI 
> > redirector to talk to 
> > Tomcat instances. They all get installed separately and its a 
> > pain in the 
> > arse to find the worker and worker mount files and merge in 
> > your settings
> > during installation.
> > So I've patched the ISAPI redirector to get the redirector to 
> > load it's 
> > properties from an ini file, with one ini file per filter.
> > 
> > It works like this :
> > 	1) You install the ISAPI filter DLL in a virtual directory.
> > 	2) In the same directory you put a properties file of 
> > the same name
> > (except for the extension)
> > 		i.e. /jakarta/isapi_redirect.dll and
> > /jakarta/isapi_redirect.ini
> > 	3) The ini file is a property file with exactly the 
> > same properties
> > as used to be put in the registry
> > 	i.e.
> > 	worker_file=C:\tomcat\conf\workers.properties
> > 	worker_mount_file=C:\tomcat\conf\uriworkermap.properties
> > 	log_level=error
> > 	log_file=C:\tomcat\logs\isapi_redirector.log
> > 	extension_uri=/jakarta/isapi_redirect.dll
> > 	4) The filter loads this ini file and gets its settings from it.
> > 	5) If the filter can't find the ini file it uses the 
> > registry (old
> > behaviour) == 1 ASAPI per machine.
> > 	6) You can then install another filter, with another 
> > ini file, and
> > not have the two conflict.
> > diffs follow ....
> > 
> > One gotcha, the DLL needs shlwapi.dll for the 
> > PathRenameExtension (Ships in
> > IE 4.0)
> > If this is a problem then someone can hack the 
> ini_file_name string to
> > overwrite the file extension ...
> > Also a flag and DEBUG print to indicate whether the ini file 
> > is being used
> > could be useful ....
> > 
> > 
> > cheers
> > 
> > tim
> > 
> > -- src/native/iis/asapi.dsp ---
> > 56c56
> > < # ADD LINK32 wsock32.lib advapi32.lib /nologo /dll /machine:I386
> > /out:"isapi_release/isapi_redirect.dll"
> > ---
> > > # ADD LINK32 wsock32.lib advapi32.lib shlwapi.lib /nologo /dll
> > /machine:I386 /out:"isapi_release/isapi_redirect.dll"
> > 82c82
> > < # ADD LINK32 wsock32.lib advapi32.lib /nologo /dll /debug 
> > /machine:I386
> > /out:"isapi_debug/isapi_redirect.dll" /pdbtype:sept
> > ---
> > > # ADD LINK32 wsock32.lib advapi32.lib shlwapi.lib /nologo 
> > /dll /debug
> > /machine:I386 /out:"isapi_debug/isapi_redirect.dll" /pdbtype:sept
> > 
> > 
> > -- src/native/iis/jk_isapi_plugin.c ---
> > 
> > 61a62,66
> > > #include <stdio.h>
> > > #include <stdlib.h>
> > > #include <windows.h>
> > > #include <shlwapi.h>
> > > 
> > 121a127
> > > static char ini_file_name[_MAX_PATH];
> > 614a621,629
> > > 	if( GetModuleFileName( hInst, ini_file_name, sizeof( 
> > ini_file_name )
> > ) ) {
> > > 		if( !PathRenameExtension( ini_file_name, ".ini" ) ) {
> > > 			fReturn = FALSE;
> > > 		}
> > > 	} else {
> > > 		fReturn = FALSE;
> > > 	}
> > > 
> > > 
> > 621a637
> > > 
> > 628a645,651
> > >         jk_log(logger, JK_LOG_DEBUG, "Using log file 
> > %s.\n", log_file);
> > >         jk_log(logger, JK_LOG_DEBUG, "Using log level 
> > %d.\n", log_level);
> > >         jk_log(logger, JK_LOG_DEBUG, "Using extension uri %s.\n",
> > extension_uri);
> > >         jk_log(logger, JK_LOG_DEBUG, "Using worker file %s.\n",
> > worker_file);
> > >         jk_log(logger, JK_LOG_DEBUG, "Using worker mount 
> > file %s.\n",
> > worker_mount_file);
> > > 
> > > 
> > 668a692
> > > 	char *tmp;
> > 669a694,735
> > >     
> > > 	jk_map_t *map;
> > > 	if( map_alloc( &map ) ) {
> > > 		if( !map_read_properties( map, ini_file_name ) ) {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 	} else {
> > > 		ok = JK_FALSE;
> > > 	}
> > > 	if( ok ) {
> > > 		tmp = map_get_string( map, JK_LOG_FILE_TAG, NULL );
> > > 		if(tmp) {
> > > 			strcpy(log_file, tmp);
> > > 		} else {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 		tmp = map_get_string( map, JK_LOG_LEVEL_TAG, NULL );
> > > 		if(tmp) {
> > > 			log_level = jk_parse_log_level(tmp);
> > > 		} else {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 		tmp = map_get_string( map, EXTENSION_URI_TAG, NULL );
> > > 		if(tmp) {
> > > 			strcpy(extension_uri, tmp);
> > > 		} else {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 		tmp = map_get_string( map, JK_WORKER_FILE_TAG, NULL );
> > > 		if(tmp) {
> > > 			strcpy(worker_file, tmp);
> > > 		} else {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 		tmp = map_get_string( map, JK_MOUNT_FILE_TAG, NULL );
> > > 		if(tmp) {
> > > 			strcpy(worker_mount_file, tmp);
> > > 		} else {
> > > 			ok = JK_FALSE;
> > > 		}
> > > 	
> > > 	} else {
> > 725c791
> > < 
> > ---
> > > 	}
> > 
> > 
>