tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4380] New: - Multiple ISAPI redirectors on single IIS website
Date Tue, 23 Oct 2001 20:29:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4380>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4380

Multiple ISAPI redirectors on single IIS website

           Summary: Multiple ISAPI redirectors on single IIS website
           Product: Tomcat 3
           Version: Unknown
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Connectors
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: timw@ihug.co.nz


The current tomcat ISAPI redirector cannot cope with more than
one filter / website => you can only have one redirector / website.

In some installation environments it is useful to allow multiple
redirectors on the one website, though having too many could affect
performance.

This patch changes the headers used by the Filter to communicate
to the Extension so that they are unique(ish) for each installed redirector.

The FilterProc clobbers these headers on entry (for security reasons) so
the next filter in the chain used to clobber the entries for a succesful
uri/worker mapping, meaning you couldn't have 2 redirectors on the one 
website.

The headers are currently a munge of the extension_uri.
Anyone got a better unique id?

Diff follows ... 

Index: jk_isapi_plugin.c
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/native/mod_jk/iis/jk_isapi_plugin.c,v
retrieving revision 1.9
diff -u -r1.9 jk_isapi_plugin.c
--- jk_isapi_plugin.c	2001/10/01 00:27:11	1.9
+++ jk_isapi_plugin.c	2001/10/07 21:15:04
@@ -86,13 +86,14 @@
  * 2. The name of the worker to be used.
  *
  */
-#define URI_HEADER_NAME         ("TOMCATURI:")
-#define WORKER_HEADER_NAME      ("TOMCATWORKER:")
 #define CONTENT_LENGTH          ("CONTENT_LENGTH:")
 
-#define HTTP_URI_HEADER_NAME     ("HTTP_TOMCATURI")
-#define HTTP_WORKER_HEADER_NAME  ("HTTP_TOMCATWORKER")
+char URI_HEADER_NAME[INTERNET_MAX_URL_LENGTH];
+char WORKER_HEADER_NAME[INTERNET_MAX_URL_LENGTH];
 
+char HTTP_URI_HEADER_NAME[INTERNET_MAX_URL_LENGTH];
+char HTTP_WORKER_HEADER_NAME[INTERNET_MAX_URL_LENGTH];
+
 #define REGISTRY_LOCATION       ("Software\\Apache Software Foundation\\Jakarta Isapi Redirector\\1.0")
 #define EXTENSION_URI_TAG       ("extension_uri")
 
@@ -790,6 +791,8 @@
 static int initialize_extension(void)
 {
     int rc = JK_FALSE;  
+	char *tmp;
+	char extension_header[INTERNET_MAX_URL_LENGTH];
 
     if(read_registry_init_data()) {
         jk_map_t *map;
@@ -805,13 +808,41 @@
 		} else {
 			 jk_log(logger, JK_LOG_DEBUG, "Using registry.\n");
 		}
+
+		// Construct and normalise the headers to be used
+		// to track redirections from filter to extension
+		// these must be unique / filter to support multiple filters
+ 		strcpy(URI_HEADER_NAME, "TOMCATURI");
+ 		strcpy(WORKER_HEADER_NAME, "TOMCATWORKER");
+		// Take the extension_uri and mangle it
+		strcpy(extension_header, extension_uri);
+		tmp = extension_header;
+		while(*tmp) {
+			if('_' == *tmp) {
+				*tmp = '-';
+			}
+			tmp++;
+		}
+		*tmp = '\0';
+		
+		strcat(URI_HEADER_NAME, extension_header);
+		strcat(WORKER_HEADER_NAME, extension_header);
+		strcpy(HTTP_URI_HEADER_NAME, "HTTP_");
+		strcpy(HTTP_WORKER_HEADER_NAME, "HTTP_");
+		strcat(HTTP_URI_HEADER_NAME, URI_HEADER_NAME);
+		strcat(HTTP_WORKER_HEADER_NAME, WORKER_HEADER_NAME);
+		strcat(URI_HEADER_NAME, ":");
+		strcat(WORKER_HEADER_NAME, ":");
+		
 		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);
 
-        
+		jk_log(logger, JK_LOG_DEBUG, "Using tomcat headers '%s' and '%s'.\n", URI_HEADER_NAME,
WORKER_HEADER_NAME);
+		jk_log(logger, JK_LOG_DEBUG, "Using http tomcat headers '%s' and '%s'.\n", HTTP_URI_HEADER_NAME,
HTTP_WORKER_HEADER_NAME);
+       
         if(map_alloc(&map)) {
             if(map_read_properties(map, worker_mount_file)) {
                 if(uri_worker_map_alloc(&uw_map, map, logger)) {
@@ -987,6 +1018,8 @@
     GET_SERVER_VARIABLE_VALUE(HTTP_WORKER_HEADER_NAME, (*worker_name));           
     GET_SERVER_VARIABLE_VALUE(HTTP_URI_HEADER_NAME, s->req_uri);     
 
+    jk_log(logger, JK_LOG_DEBUG, "Into init_ws_service for uri '%s' using worker '%s'.\n",
s->req_uri, (*worker_name));
+
     if(s->req_uri) {
         char *t = strchr(s->req_uri, '?');
         if(t) {
@@ -1005,6 +1038,8 @@
             return JK_FALSE;
         getparents(s->req_uri);
     }
+	
+    jk_log(logger, JK_LOG_DEBUG, "Initing service for uri '%s' using worker '%s'.\n", s->req_uri,
(*worker_name));
     
     GET_SERVER_VARIABLE_VALUE("AUTH_TYPE", s->auth_type);
     GET_SERVER_VARIABLE_VALUE("REMOTE_USER", s->remote_user);

Mime
View raw message