[interchange-cvs] interchange - kwalsh modified 4 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Mar 26 17:30:46 EST 2004


User:      kwalsh
Date:      2004-03-26 22:30:45 GMT
Modified:  dist/src/mod_interchange README mod_interchange.c
Modified:           mod_interchange.html mod_interchange.spec
Log:
	* Fixed a weird bug where null HTTP variables were being passed
	  under certain circumstances.

	* Added a SUN_LEN() macro for those operating systems that don't
	  have one already.  I think this was done for Solaris.  I can't
	  remember now. :-)

	* Fixed a bunch of potential buffer overflows.  Each of them would
	  have a very remote possibility of being tripped, unless intentionally.

	* Added a "OrdinaryFileList" directive to DECLINE requests where the
	  path starts with one of the values in the list.  If this module
	  DECLINEs a request then Apache will attempt to serve the request
	  instead.  This is useful for creating excptions to <Location />,
	  for image files etc.

	* Added a "FilesContext" directive so that we can handle ourselves
	  if we are called from within a <Files> context instead of a
	  <Location>.  If I can find a way to determine this automatically
	  then I will drop this directive.  Consider it to be depreciated
	  even though it has only just been added.

	* Added a "URIPathPrefix" directive to replace the leading '/'
	  in the SCRIPT_NAME with the given value, before passing the
	  request on to Interchange.

	* Removed "FilesContext" and "URIPathPrefix" configuration directives
	  and replaced with a new "InterchangeScript" directive.  The new
	  "InterchangeScript" can be used to specify a SCRIPT_NAME to pass
	  to Interchange.  The value will override the SCRIPT_NAME=/foo that
	  would default from <Location /foo>.

	* Lots of minor cleanups.

Revision  Changes    Path
2.8       +58 -2     interchange/dist/src/mod_interchange/README


rev 2.8, prev_rev 2.7
Index: README
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/README,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -r2.7 -r2.8
--- README	13 Jan 2003 17:42:51 -0000	2.7
+++ README	26 Mar 2004 22:30:44 -0000	2.8
@@ -1,9 +1,9 @@
 mod_interchange
 ===============
 
-$Id: README,v 2.7 2003/01/13 17:42:51 kwalsh Exp $
+$Id: README,v 2.8 2004/03/26 22:30:44 kwalsh Exp $
 
-Version: 1.29
+Version: 1.30
 
 Description
 -----------
@@ -112,6 +112,56 @@
 	DropRequestList /default.ida /x.ida /cmd.exe /root.exe
     </Location>
 
+The OrdinaryFileList allows a list of up to 10 space-separated URI path
+components to be specified.  If one of the list entries is found at the
+start of any request then that request will not be passed to Interchange.
+Instead, the file will be directly served by Apache.  For example:
+
+    <Location />
+	SetHandler interchange-handler
+	InterchangeServer localhost:7786
+	DropRequestList /default.ida /x.ida /cmd.exe /root.exe
+	OrdinaryFileList /foundation/ /interchange-5/ /robots.txt /somefile.css
+    </Location>
+
+This will result in the following:
+
+    www.example.com/index.html          (handled by Interchange)
+    www.example.com/ord/basket.html     (handled by Interchange)
+    www.example.com/foundation/images/somefile.gif (served by Apache)
+    www.example.com/robots.txt          (served by Apache)
+
+You should add a trailing slash to directory names to prevent, for instance,
+"/images/foo.gif" from being confused with the likes of "/images.html".
+If OrdinaryFileList was set to "/images" then both of those requests would
+be handled by Apache.  If OrdinaryFileList was set to "/images/" then
+"/images/foo.gif" would be handled by Apache and "/images.html" would be
+handled by Interchange.
+
+If you're using "<Location />" then you will need a dummy "index.html" file
+in your VirtualHost's DocumentRoot directory to avoid permission problems
+assocated with the Apache directory index creation code.
+
+The InterchangeScript parameter allows the SCRIPT_NAME to be different from
+the <Location>.  For example:
+
+    <Location /shop>
+        ...
+    </Location>
+
+The above will set the SCRIPT_NAME to "/shop".
+
+    <Location /shop>
+        ...
+	InterchangeScript /foo
+    </Location>
+
+The above will set the SCRIPT_NAME to "/foo", instead of "/shop"  before
+passing the request to Interchange.
+
+The appropriate SCRIPT_NAME must be configured into the "Catalog"
+directive in your interchange.cfg file.
+
 
 Bugs
 ----
@@ -130,3 +180,9 @@
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation.  You may refer to either version 2 of the
 License or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+



2.9       +145 -62   interchange/dist/src/mod_interchange/mod_interchange.c


rev 2.9, prev_rev 2.8
Index: mod_interchange.c
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/mod_interchange.c,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -r2.8 -r2.9
--- mod_interchange.c	13 Jan 2003 17:42:51 -0000	2.8
+++ mod_interchange.c	26 Mar 2004 22:30:44 -0000	2.9
@@ -1,6 +1,6 @@
-#define	MODULE_VERSION	"mod_interchange/1.29"
+#define	MODULE_VERSION	"mod_interchange/1.30"
 /*
- *	$Id: mod_interchange.c,v 2.8 2003/01/13 17:42:51 kwalsh Exp $
+ *	$Id: mod_interchange.c,v 2.9 2004/03/26 22:30:44 kwalsh Exp $
  *
  *	Apache Module implementation of the Interchange application server
  *	link programs.
@@ -9,7 +9,7 @@
  *	Based on original code by Francis J. Lacoste <francis.lacoste at iNsu.COM>
  *
  *	Copyright (c) 1999 Francis J. Lacoste, iNsu Innovations.
- *	Copyright (c) 2000-2003 Cursor Software Limited.
+ *	Copyright (c) 2000-2004 Cursor Software Limited.
  *	All rights reserved.
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -53,18 +53,21 @@
 #define	PF_LOCAL	PF_UNIX
 #endif
 
-#ifndef SUN_LEN
-#define SUN_LEN(su)	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
+#ifndef	SUN_LEN
+#define	SUN_LEN(su)	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
 #endif
 
-#define IC_DEFAULT_PORT			7786
-#define IC_DEFAULT_ADDR			"127.0.0.1"
+#define	IC_DEFAULT_PORT			7786
+#define	IC_DEFAULT_ADDR			"127.0.0.1"
 #define	IC_DEFAULT_TIMEOUT		10
 #define	IC_DEFAULT_CONNECT_TRIES	10
 #define	IC_DEFAULT_CONNECT_RETRY_DELAY	2
 
 #define	IC_MAX_DROPLIST			10
-#define IC_MAX_SERVERS			2
+#define	IC_MAX_ORDINARYLIST		10
+#define	IC_MAX_LIST_ENTRYSIZE		40
+#define	IC_MAX_SERVERS			2
+#define	IC_CONFIG_STRING_LEN		100
 
 module MODULE_VAR_EXPORT interchange_module;
 
@@ -79,16 +82,19 @@
 	ic_socket_rec *server[IC_MAX_SERVERS];	/* connection to IC server(s) */
 	int connect_tries;	/* number of times to ret to connect to IC */
 	int connect_retry_delay; /* delay this many seconds between retries */
-	int droplist_no;
-	int loclen;			/* size of the location string */
-	char location[HUGE_STRING_LEN];	/* configured <Location> */
-	char droplist[IC_MAX_DROPLIST][HUGE_STRING_LEN];
+	int droplist_no;	/* number of entries in the "drop list" */
+	int ordinarylist_no;	/* number of entries in the "ordinary file list" */
+	int location_len;	/* length of the configured <Location> path */
+	char location[IC_CONFIG_STRING_LEN+1];	/* configured <Location> path */
+	char script_name[IC_CONFIG_STRING_LEN+1];
+	char droplist[IC_MAX_DROPLIST][IC_MAX_LIST_ENTRYSIZE+1];
+	char ordinarylist[IC_MAX_DROPLIST][IC_MAX_LIST_ENTRYSIZE+1];
 }ic_conf_rec;
 
 typedef struct ic_response_buffer_struct{
 	int buff_size;
 	int pos;
-	char buff[HUGE_STRING_LEN];
+	char buff[MAX_STRING_LEN];
 }ic_response_buffer;
 
 static void ic_initialise(server_rec *,pool *);
@@ -155,22 +161,34 @@
 		conf_rec->server[tmp] = (ic_socket_rec *)NULL;
 
 	if (dir){
-		if (*dir == '/')
+		/*
+		 *	remove leading '/' characters
+		 */
+		while (*dir == '/')
 			dir++;
-		strcpy(conf_rec->location,dir);
-		conf_rec->loclen = strlen(conf_rec->location);
+
+		/*
+		 *	copy the configured <Location> path into place
+		 */
+		strncpy(conf_rec->location,dir,IC_CONFIG_STRING_LEN);
+		conf_rec->location[IC_CONFIG_STRING_LEN] = '\0';
+		conf_rec->location_len = strlen(conf_rec->location);
+
+		/*
+		 *	remove trailing '/' characters
+		 */
+		while (conf_rec->location_len > 1 && conf_rec->location[conf_rec->location_len] == '/'){
+			conf_rec->location[conf_rec->location_len--] = '\0';
+		}
 	}else{
 		conf_rec->location[0] = '\0';
-		conf_rec->loclen = 0;
-	}
-	if (conf_rec->location[conf_rec->loclen] != '/'){
-		conf_rec->location[conf_rec->loclen++] = '/';
-		conf_rec->location[conf_rec->loclen] = '\0';
+		conf_rec->location_len = 0;
 	}
 	conf_rec->connect_tries = IC_DEFAULT_CONNECT_TRIES;
 	conf_rec->connect_retry_delay = IC_DEFAULT_CONNECT_RETRY_DELAY;
 	conf_rec->droplist_no = 0;
-
+	conf_rec->ordinarylist_no = 0;
+	conf_rec->script_name[0] = '\0';
 	return conf_rec;
 }
 
@@ -319,17 +337,48 @@
 }
 
 /*
- *	ic_droprequest_cmd()
- *	--------------------
+ *	ic_droprequestlist_cmd()
+ *	------------------------
  *	Handle the "DropRequestList" module configuration directive
  */
 static const char *ic_droprequestlist_cmd(cmd_parms *parms,void *mconfig,const char *arg)
 {
 	ic_conf_rec *conf_rec = (ic_conf_rec *)mconfig;
 
-	if (conf_rec->droplist_no < IC_MAX_DROPLIST)
-		strcpy(conf_rec->droplist[conf_rec->droplist_no++],arg);
+	if (conf_rec->droplist_no < IC_MAX_DROPLIST){
+		strncpy(conf_rec->droplist[conf_rec->droplist_no],arg,IC_MAX_LIST_ENTRYSIZE);
+		conf_rec->droplist[conf_rec->droplist_no++][IC_MAX_LIST_ENTRYSIZE] = '\0';
+	}
+	return NULL;
+}
+
+/*
+ *	ic_ordinaryfilelist_cmd()
+ *	-------------------------
+ *	Handle the "OrdinaryFileList" module configuration directive
+ */
+static const char *ic_ordinaryfilelist_cmd(cmd_parms *parms,void *mconfig,const char *arg)
+{
+	ic_conf_rec *conf_rec = (ic_conf_rec *)mconfig;
+
+	if (conf_rec->ordinarylist_no < IC_MAX_DROPLIST){
+		strncpy(conf_rec->ordinarylist[conf_rec->ordinarylist_no],arg,IC_MAX_LIST_ENTRYSIZE);
+		conf_rec->ordinarylist[conf_rec->ordinarylist_no++][IC_MAX_LIST_ENTRYSIZE] = '\0';
+	}
+	return NULL;
+}
+
+/*
+ *	ic_interchangescript_cmd()
+ *	--------------------------
+ *	Handle the "InterchangeScript" module configuration directive
+ */
+static const char *ic_interchangescript_cmd(cmd_parms *parms,void *mconfig,const char *arg)
+{
+	ic_conf_rec *conf_rec = (ic_conf_rec *)mconfig;
 
+	strncpy(conf_rec->script_name,arg,IC_CONFIG_STRING_LEN);
+	conf_rec->script_name[IC_CONFIG_STRING_LEN] = '\0';
 	return NULL;
 }
 
@@ -377,7 +426,7 @@
 			ap_pclosesocket(r->pool,ic_sock);
 		}
 		if (connected)
-		    break;
+			break;
 		sleep(conf_rec->connect_retry_delay);
 	}
 	ap_kill_timeout(r);
@@ -441,8 +490,8 @@
 {
 	char **env,**e,*rp;
 	int env_count,rc;
-	char request_uri[HUGE_STRING_LEN];
-	char redirect_url[HUGE_STRING_LEN];
+	char request_uri[MAX_STRING_LEN];
+	char redirect_url[MAX_STRING_LEN];
 
 	/*
 	 *	send the Interchange-link arg parameter
@@ -488,37 +537,45 @@
 	redirect_url[0] = '\0';
 	for (e = env; *e != NULL; e++){
 		int len;
+		char tmp[MAX_STRING_LEN];
+		char *p = *e;
 
-		if (strncmp(*e,"PATH_INFO=",10) == 0)
+		if (strncmp(p,"PATH_INFO=",10) == 0)
 			continue;
-		if (strncmp(*e,"REDIRECT_URL=",13) == 0){
-			strcpy(redirect_url,(*e) + 13);
+		if (strncmp(p,"REDIRECT_URL=",13) == 0){
+			strncpy(redirect_url,p + 13,MAX_STRING_LEN - 14);
 			continue;
 		}
-		if (strncmp(*e,"REQUEST_URI=",12) == 0)
-			strcpy(request_uri,(*e) + 12);
-		else if (strncmp(*e,"SCRIPT_NAME=",12) == 0){
-			*(*e + 12) = '/';
-			strcpy(*e + 13,conf_rec->location);
-			if (*(*e + 12 + conf_rec->loclen) == '/')
-				*(*e + 12 + conf_rec->loclen) = '\0';
+		if (strncmp(p,"REQUEST_URI=",12) == 0)
+			strncpy(request_uri,p + 12,MAX_STRING_LEN - 13);
+		else if (strncmp(p,"SCRIPT_NAME=",12) == 0){
+			p = tmp;
+			strcpy(p,"SCRIPT_NAME=");
+
+			if (conf_rec->script_name[0])
+				strcat(p,conf_rec->script_name);
+			else{
+				strcat(p,"/");
+				strcat(p,conf_rec->location);
+			}
 		}
-		len = strlen(*e);
-		if (len && ap_bprintf(ic_buff,"%d %s\n",len,*e) < 0){
+		len = strlen(p);
+		if (len && ap_bprintf(ic_buff,"%d %s\n",len,p) < 0){
 			ap_log_reason("error writing to Interchange",r->uri,r);
 			return HTTP_INTERNAL_SERVER_ERROR;
 		}
-		ap_reset_timeout(r);
 	}
 
 	rp = request_uri;
 	while (*rp == '/')
 		rp++;
 
-	if (strncmp(rp,conf_rec->location,conf_rec->loclen) == 0)
-		rp += (conf_rec->loclen - 1);
+	if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
+		rp += conf_rec->location_len;
+
+	strncpy(request_uri,rp,MAX_STRING_LEN - 1);
+	request_uri[MAX_STRING_LEN - 1] = '\0';
 
-	strcpy(request_uri,rp);
 	for (rp = request_uri; *rp != '\0'; rp++){
 		if (*rp == '?'){
 			*rp = '\0';
@@ -549,10 +606,12 @@
 		while (*rp == '/')
 			rp++;
 
-		if (strncmp(rp,conf_rec->location,conf_rec->loclen) == 0)
-			rp += (conf_rec->loclen - 1);
+		if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
+			rp += conf_rec->location_len;
+
+		strncpy(redirect_url,rp,MAX_STRING_LEN - 1);
+		redirect_url[MAX_STRING_LEN - 1] = '\0';
 
-		strcpy(redirect_url,rp);
 		for (rp = redirect_url; *rp != '\0'; rp++){
 			if (*rp == '?'){
 				*rp = '\0';
@@ -577,7 +636,7 @@
 	 *	send the request body, if any
 	 */
 	if (ap_should_client_block(r)){
-		char buffer[HUGE_STRING_LEN];
+		char buffer[MAX_STRING_LEN];
 		int len_read;
 		long length = r->remaining;
 
@@ -641,7 +700,7 @@
 {
 	const char *location;
 	int rc,ic_sock;
-	char sbuf[MAX_STRING_LEN],argsbuffer[HUGE_STRING_LEN];
+	char sbuf[MAX_STRING_LEN],argsbuffer[MAX_STRING_LEN];
 
 	/*
 	 *	get the socket we are using to talk to the
@@ -691,7 +750,7 @@
 		 *	soak up any body-text sent by the Interchange server
 		 */
 		ap_soft_timeout("mod_interchange: Interchange read",r);
-		while (ap_bgets(argsbuffer,HUGE_STRING_LEN,ic_buff) > 0)
+		while (ap_bgets(argsbuffer,MAX_STRING_LEN,ic_buff) > 0)
 			;
 		ap_kill_timeout(r);
 
@@ -769,14 +828,27 @@
 	}
 
 	/*
-	 *	check if the requested URI matches strings
-	 *	in the drop list
+	 *	check if the requested URI matches strings in the
+	 *	"ordinary file" list.  This module will not handle
+	 *	the request if a match is found, and will leave it
+	 *	up to Apache to work out what to do with the request
+	 */
+	for (i = 0; i < conf_rec->ordinarylist_no; i++){
+		if (strncmp(r->uri,conf_rec->ordinarylist[i],strlen(conf_rec->ordinarylist[i])) == 0){
+			return DECLINED;
+		}
+	}
+
+	/*
+	 *	check if the requested URI matches an entry in the drop list.
+	 *	If so then return a 404 (not found) status.  Note that a
+	 *	substring match is used
 	 */
 	for (i = 0; i < conf_rec->droplist_no; i++){
 		if (strstr(r->uri,conf_rec->droplist[i])){
 			ap_log_reason("interchange-handler match found in the drop list",r->uri,r);
 			ap_log_rerror(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,r,"Requested URI (%s) matches drop list entry (%s)",r->uri,conf_rec->droplist[i]);
-			return DECLINED;
+			return HTTP_NOT_FOUND;
 		}
 	}
 
@@ -816,8 +888,7 @@
 		NULL,			/* argument to include in call */
 		ACCESS_CONF,		/* where available */
 		TAKE1,			/* arguments */
-		"Address of the primary Interchange server - for use in a <Location> block"
-					/* directive description */
+		"Address of the primary Interchange server"
 	},
 	{
 		"InterchangeServerBackup",	/* directive name */
@@ -825,8 +896,7 @@
 		NULL,			/* argument to include in call */
 		ACCESS_CONF,		/* where available */
 		TAKE1,			/* arguments */
-		"Address of the backup Interchange server - for use in a <Location> block"
-					/* directive description */
+		"Address of the backup Interchange server"
 	},
 	{
 		"ConnectTries",		/* directive name */
@@ -835,7 +905,6 @@
 		ACCESS_CONF,		/* where available */
 		TAKE1,			/* arguments */
 		"The number of connection attempts to make before giving up"
-					/* directive description */
 	},
 	{
 		"ConnectRetryDelay",	/* directive name */
@@ -844,7 +913,6 @@
 		ACCESS_CONF,		/* where available */
 		TAKE1,			/* arguments */
 		"The number of connection attempts to make before giving up"
-					/* directive description */
 	},
 	{
 		"DropRequestList",	/* directive name */
@@ -852,8 +920,23 @@
 		NULL,			/* argument to include in call */
 		ACCESS_CONF,		/* where available */
 		ITERATE,		/* arguments */
-		"Drop the URI request if it contains the specified string"
-					/* directive description */
+		"Drop the request if the URI path contains one of the specified strings"
+	},
+	{
+		"OrdinaryFileList",	/* directive name */
+		ic_ordinaryfilelist_cmd,/* config action routine */
+		NULL,			/* argument to include in call */
+		ACCESS_CONF,		/* where available */
+		ITERATE,		/* arguments */
+		"Don't pass to Interchange if the URI path matches one of the strings"
+	},
+	{
+		"InterchangeScript",	/* directive name */
+		ic_interchangescript_cmd, /* config action routine */
+		NULL,			/* argument to include in call */
+		ACCESS_CONF,		/* where available */
+		TAKE1,			/* arguments */
+		"Replace the 'script name' with this value before calling Interchange"
 	},
 	{NULL}
 };



2.9       +150 -30   interchange/dist/src/mod_interchange/mod_interchange.html


rev 2.9, prev_rev 2.8
Index: mod_interchange.html
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/mod_interchange.html,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -r2.8 -r2.9
--- mod_interchange.html	13 Jan 2003 17:42:51 -0000	2.8
+++ mod_interchange.html	26 Mar 2004 22:30:45 -0000	2.9
@@ -1,11 +1,11 @@
-<!-- $Id: mod_interchange.html,v 2.8 2003/01/13 17:42:51 kwalsh Exp $ -->
+<!-- $Id: mod_interchange.html,v 2.9 2004/03/26 22:30:45 kwalsh Exp $ -->
 <html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <title>Apache module: mod_interchange (version 1.29)</title>
+   <title>Apache module: mod_interchange (version 1.30)</title>
 </head>
 <body bgcolor="#FFFFFF" text="#000000">
-    <h1>Apache module: mod_interchange (version 1.29)</h1>
+    <h1>Apache module: mod_interchange (version 1.30)</h1>
     <h2>Apache link module for Interchange</h2>
     <p>
 	This module replaces the <i>tlink</i> and <i>vlink</i> programs
@@ -17,7 +17,7 @@
     </p>
     <p>
 	This module has been tested with Apache versions 1.3.6
-	through 1.3.26.&nbsp;
+	through 1.3.29.&nbsp;
 	<b>Note that this module is not compatible with Apache 2.</b>
     </p>
 
@@ -30,6 +30,8 @@
 		<li><a href="#tries">ConnectTries</a></li>
 		<li><a href="#retrydelay">ConnectRetryDelay</a></li>
 		<li><a href="#droplist">DropRequestList</a></li>
+		<li><a href="#ordinaryfilelist">OrdinaryFileList</a></li>
+		<li><a href="#interchangescript">InterchangeScript</a></li>
 	    </ul>
 	    <br>
 	</li>
@@ -57,7 +59,8 @@
 	Specifies the way Apache should connect to the backup
 	Interchange server in the event that the primary server is
 	unavailable for any reason.
-    </p><p>
+    </p>
+    <p>
 	InterchangeServerBackup takes the same arguments as the
 	InterchangeServer directive but should obviously point to a
 	different Interchange server than the primary.&nbsp;
@@ -95,26 +98,59 @@
 	Space-separated list of URI path components to deny access to.&nbsp;
 	Various attacks are made on Microsoft IIS systems and, while they
 	don't affect Apache, they do tend to waste valuable processor time.
-    </p><p>
+    </p>
+    <p>
 	If any of the entries in the list are found anywhere in the requested
 	URI, the request will be dropped with a 404 (not found) error.
-    </p><p>
+    </p>
+    <p>
 	A maximum of 10 entries may be present in the list.&nbsp;
 	Any other entries will be ignored.&nbsp;
-	If you need more than 10 entries, edit the <code>IC_DROPLIST_NO</code>
+	If you need more than 10 entries, edit the <code>IC_MAX_DROPLIST</code>
 	value in <code>mod_interchange.c</code> and recompile the module.&nbsp;
 	See the example below for a common use of this directive.
     </p>
 
+    <h2><a name="ordinaryfilelist">OrdinaryFileList</a></h2>
+    <b>Syntax:</b> <code>OrdinaryFileList <i>entry entry entry</i></code>
+    <br><b>Context:</b> Location
+    <br><b>Override:</b> None
+    <br><b>Status:</b> Extension
+    <p>
+	Space-separated list of URI path components.&nbsp;
+	If one of the list entries is found at the start of any request then
+	that request will not be passed to Interchange.&nbsp;
+	Instead, the file will be directly served by Apache.
+    </p>
+    <p>
+	A maximum of 10 entries may be present in the list.&nbsp;
+	Any other entries will be ignored.&nbsp;
+	If you need more than 10 entries, edit the <code>IC_MAX_ORDINARYLIST</code>
+	value in <code>mod_interchange.c</code> and recompile the module.&nbsp;
+	See the example below for a common use of this directive.
+    </p>
+
+    <h2><a name="interchangescript">InterchangeScript</a></h2>
+    <b>Syntax:</b> <code>InterchangeScript <i>name</i></code>
+    <br><b>Context:</b> Location
+    <br><b>Override:</b> None
+    <br><b>Status:</b> Extension
+    <p>
+	The InterchangeScript parameter allows the SCRIPT_NAME to be
+	different from the <code>&lt;Location&gt;</code>.
+    </p>
+
     <hr>
     <h2><a name="example">Configuration Examples</a></h2>
     <p>
 	Note: The Apache <Location> URI path should not contain a dot (.) or
 	any other characters except A-Z, a-z, 0-9 or a hyphen (-), so:
-    </p><p>
+    </p>
+    <p>
 	<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<b>Location</b> <i>/shop.name</i>&gt</code>&nbsp; is invalid, whereas:<br>
 	<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<b>Location</b> <i>/shop-name</i>&gt</code>&nbsp; is valid.
-    </p><p>
+    </p>
+    <p>
 	Here is an example UNIX-socket configuration:
     </p>
     <code>
@@ -148,7 +184,8 @@
 	fails to connect to the Interchange server.&nbsp;
 	The most likely reason for a failure to connect is that Interchange
 	is being restarted by the administrator.
-    </p><p>
+    </p>
+    <p>
 	<b>ConnectTries</b> specifies the number of connection attempts
 	to make before giving up.&nbsp;
 	The default is 10.&nbsp;
@@ -172,7 +209,8 @@
 	The <b>ConnectTries</b> and <b>ConnectRetryDelay</b> paramaters will
 	only come into affect if both the primary and backup Interchange
 	servers are found to be unavailable.
-    </p><p>
+    </p>
+    <p>
 	The <b>DropRequestList</b> allows a list of up to 10 space-separated URI
 	components to be specified.&nbsp;
 	If any of the list entries is found anywhere in the requested URI,
@@ -190,11 +228,84 @@
 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>DropRequestList</b> <i>/default.ida /x.ida /cmd.exe /root.exe</i><br>
 	&nbsp;&nbsp;&nbsp;&nbsp;<b>&lt;/Location&gt;</b><br>
     </code>
+    <p>
+	The <b>OrdinaryFileList</b> allows a list of up to 10 space-separated
+	URI path components to be specified.&nbsp;
+	If one of the list entries is found at the start of any request then
+	that request will not be passed to Interchange.&nbsp;
+	Instead, the file will be directly served by Apache.&nbsp;
+	<b>OrdinaryFileList</b> example:
+    </p>
+    <code>
+	&nbsp;&nbsp;&nbsp;&nbsp;<b>&lt;Location</b> <i>/</i><b>&gt;</b><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>SetHandler interchange-handler</b><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>InterchangeServer</b> <i>localhost</i>:<i>7786</i><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>OrdinaryFileList</b> <i>/foundation/ /interchange-5/ /robots.txt</i><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;<b>&lt;/Location&gt;</b><br>
+    </code>
+    <p>
+	This will result in the following:
+    </p>
+    <code>&nbsp;&nbsp;&nbsp;&nbsp;www.example.com/index.html&nbsp;</code> (Processed by Interchange)<br>
+    <code>&nbsp;&nbsp;&nbsp;&nbsp;www.example.com/ord/basket.html&nbsp;</code> (Processed by Interchange)<br>
+    <code>&nbsp;&nbsp;&nbsp;&nbsp;www.example.com/foundation/images/somefile.gif&nbsp;</code> (Served by Apache)<br>
+    <code>&nbsp;&nbsp;&nbsp;&nbsp;www.example.com/robots.txt&nbsp;</code> (Served by Apache)<br>
+    <p>
+	You should add a trailing slash to directory names to prevent,
+	for instance, &quot;<i>/images/foo.gif</i>&quot; from being confused
+	with the likes of &quot;<i>/images.html</i>&quot;.&nbsp;
+	If <b>OrdinaryFileList</b> was set to &quot;<i>/images</i>&quot;
+	then both of those requests would be handled by Apache.&nbsp;
+	If <b>OrdinaryFileList</b> was set to &quot;<i>/images/</i>&quot; then
+	&quot;<i>/images/foo.gif</i>&quot; would be handled by Apache and
+	&quot;<i>/images.html</i>&quot; would be handled by Interchange.
+    </p>
+	If you're using &quot;<code>&lt;<b>Location</b> <i>/</i>&gt;</code>&quot;
+	then you will need a dummy &quot;<i>index.html</i>&quot; file in your
+	<code><b>VirtualHost</b></code>'s <code><b>DocumentRoot</b></code>
+	directory to avoid permission problems assocated with the Apache
+	directory index creation code.
+    <p>
+    </p>
+    <p>
+	The <b>InterchangeScript</b> parameter allows the
+	<code>SCRIPT_NAME</code> to be different from the
+	&lt;<b>Location</b>&gt;.&nbsp;
+	<b>InterchangeScript</b> example:
+    </p>
+    <code>
+	&nbsp;&nbsp;&nbsp;&nbsp;<b>&lt;Location</b> <i>/shop</i><b>&gt;</b><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>SetHandler interchange-handler</b><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>InterchangeServer</b> <i>localhost</i>:<i>7786</i><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>InterchangeScript</b> <i>/foo</i><br>
+	&nbsp;&nbsp;&nbsp;&nbsp;<b>&lt;/Location&gt;</b><br>
+    </code>
+    <p>
+	The above will set the <code>SCRIPT_NAME</code> to
+	&quot;<i>/foo</i>&quot;, instead of to &quot;<i>/shop</i>&quot;,
+	before passing the request to Interchange.
+    </p>
+    <p>
+	The appropriate <code>SCRIPT_NAME</code> must be configured into the
+	<code>Catalog</code> directive in your <code>interchange.cfg</code>
+	file.
+    </p>
 
     <br><hr>
     <h2><a name="changelog">Change Log</a></h2>
     <ul>
 	<li>
+	    1.30
+	    (Thu 08 Mar 2004)
+	    Kevin Walsh &lt;kevin at cursor.biz&gt;<br>
+	    <ul>
+		<li>
+		    Added the <code>OrdinaryFileList</code> and
+		    <code>InterchangeScript</code> configuration parameters.
+		</li>
+	    </ul>
+	    <br>
+	</li><li>
 	    1.29
 	    (Thu 09 Jan 2003)
 	    Kevin Walsh &lt;kevin at cursor.biz&gt;<br>
@@ -205,10 +316,10 @@
 		    correct page but prevented it from storing the request in
 		    the session's history.&nbsp;
 		    The problem only showed itself when Interchange's
-		    [history-scan] tag was used.&nbsp;
-		    As almost no page history was saved, [history-scan] sent
-		    the user to the default page (usually index) most of the
-		    time.&nbsp;
+		    <code>[history-scan]</code> tag was used.&nbsp;
+		    As almost no page history was saved,
+		    <code>[history-scan]</code> sent the user to the default
+		    page (usually index) most of the time.&nbsp;
 		    This bug seems to have originated in version 1.28.
 		</li>
 	    </ul>
@@ -230,11 +341,12 @@
 	    Kevin Walsh &lt;kevin at cursor.biz&gt;<br>
 	    <ul>
 		<li>
-		    Implemented a proper (automatic) URILevels mechanism and
-		    removed the URILevels configuration directive.&nbsp;
+		    Implemented a proper (automatic) <code>URILevels</code>
+		    mechanism and removed the <code>URILevels</code>
+		    configuration directive.&nbsp;
 		    This also fixes a bug, reported by Philip Hempel in the
-		    interchange-users mail list, where [PT] redirects were
-		    not being handled correctly.
+		    interchange-users mail list, where <code>[PT]</code>
+		    redirects were not being handled correctly.
 		</li>
 	    </ul>
 	    <br>
@@ -245,7 +357,7 @@
 	    <ul>
 		<li>
 		    Added proper support for internal redirects which will
-		    help with the security of "soft product" delivery.
+		    help with the security of &quot;soft product&quot; delivery.
 		</li>
 	    </ul>
 	    <br>
@@ -271,8 +383,9 @@
 	    <ul>
 		<li>
 		    Fixed a bug reported by Shawn Mathews.&nbsp;
-		    The URILevels directive was not taken into account when
-		    munging the PATH_INFO HTTP environment variable.
+		    The <code>URILevels</code> directive was not taken into
+		    account when munging the <code>PATH_INFO</code> HTTP
+		    environment variable.
 		</li>
 	    </ul>
 	    <br>
@@ -283,9 +396,9 @@
 	    <ul>
 		<li>
 		    Added the module identification to the Apache version
-		    string so that it shows up in the "Server:" response
-		    header field when Apache is configured to show version
-		    information.&nbsp;
+		    string so that it shows up in the &quot;Server:&quot;
+		    response header field when Apache is configured to show
+		    version information.&nbsp;
 		    Of course, suitably paranoid system administrators should
 		    configure Apache so that it doesn't release unnecessay
 		    server information.&nbsp;
@@ -302,8 +415,8 @@
 		<li>
 		    Fixed a bug reported by John Young.&nbsp;
 		    Mod_interchange was not decoding entities in the
-		    REQUEST_URI, which caused Interchange searches (scan)
-		    with encoded spaces to fail.
+		    <code>REQUEST_URI</code>, which caused Interchange searches
+		    (scan) with encoded spaces to fail.
 		</li>
 	    </ul>
 	    <br>
@@ -469,15 +582,22 @@
     <h2><a name="copyright">Copyright and License</a></h2>
     <p>
 	Copyright &copy; 1999 Francis J. Lacoste and iNsu Innovations Inc.<br>
-	Copyright &copy; 2000-2003 Cursor Software Limited.<br>
+	Copyright &copy; 2000-2004 Cursor Software Limited.<br>
 	All rights reserved.
-    </p><p>
+    </p>
+    <p>
 	This program is free software.&nbsp;
 	You can redistribute it and/or modify it under the terms of the
 	GNU General Public License as published by the Free Software
 	Foundation.&nbsp;
 	You may refer to either version 2 of the License or (at your option)
 	any later version.
+    </p>
+    <p>
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp;
+	See the GNU General Public License for more details.
     </p>
 </body>
 </html>



2.3       +7 -1      interchange/dist/src/mod_interchange/mod_interchange.spec


rev 2.3, prev_rev 2.2
Index: mod_interchange.spec
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/mod_interchange.spec,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -r2.2 -r2.3
--- mod_interchange.spec	18 Jun 2003 17:34:44 -0000	2.2
+++ mod_interchange.spec	26 Mar 2004 22:30:45 -0000	2.3
@@ -1,6 +1,6 @@
 Summary: Apache Module to link with Interchange
 Name: mod_interchange
-Version: 1.29
+Version: 1.30
 Release: 1
 License: GPL
 Group: WWW/Applications
@@ -12,6 +12,8 @@
 Apache module that replaces the tlink and vlink program from the 
 Interchange distribution.
 
+Please note that this module is not compatible with Apache 2.
+
 %prep
 %setup -q
 
@@ -36,6 +38,10 @@
 /home/httpd/html/manual/mod/mod_interchange.html
 
 %changelog
+* Fri Mar 26 2004  Kevin Walsh <kevin at cursor.biz>
+  [1.30]
+- Added a note to point out that this module is not compatible with Apache 2.
+
 * Mon Feb 12 2001  Jon Jensen <jon at akopia.com>
   [1.04-1]
 - Renamed to mod_interchange.








More information about the interchange-cvs mailing list