[interchange-cvs] interchange - kwalsh modified 3 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Tue Nov 1 22:08:52 EST 2005
User: kwalsh
Date: 2005-11-02 03:08:51 GMT
Modified: dist/src/mod_interchange README mod_interchange.c
Modified: mod_interchange.html
Log:
* 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>.
* Cleaned up the location_len handling.
* Changed some of the directive description text slightly.
* Fixed a bug with a patch kindly supplied by Josh Lavin.
The OrdinaryFileList code was using the IC_MAX_DROPLIST
configurable setting instead of its own IC_MAX_ORDINARYLIST.
* Strip the location path from the request_uri string
unless the location is "/".
This fixes a problem with [history-scan] regex matches when
using a <Location />.
* Applied a patch supplied by Jonathon Sim of Zeald. Thanks Jon!
The patch fixes a problem where the result code from a call to the
ap_scan_script_header_err_buff() Apache API function was not being
examined closely enough. This apparently caused problems with
GoogleBot and caching proxies that make use of the If-Modified-Since
HTTP header.
* Lots of minor cleanups.
Revision Changes Path
2.9 +24 -15 interchange/dist/src/mod_interchange/README
rev 2.9, prev_rev 2.8
Index: README
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/README,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -r2.8 -r2.9
--- README 26 Mar 2004 22:30:44 -0000 2.8
+++ README 2 Nov 2005 03:08:51 -0000 2.9
@@ -1,9 +1,9 @@
mod_interchange
===============
-$Id: README,v 2.8 2004/03/26 22:30:44 kwalsh Exp $
+$Id: README,v 2.9 2005/11/02 03:08:51 kwalsh Exp $
-Version: 1.30
+Version: 1.33
Description
-----------
@@ -108,7 +108,7 @@
<Location /shop>
SetHandler interchange-handler
- InterchangeServer localhost:7786
+ InterchangeServer /opt/interchange/etc/socket
DropRequestList /default.ida /x.ida /cmd.exe /root.exe
</Location>
@@ -119,7 +119,7 @@
<Location />
SetHandler interchange-handler
- InterchangeServer localhost:7786
+ InterchangeServer /opt/interchange/etc/socket
DropRequestList /default.ida /x.ida /cmd.exe /root.exe
OrdinaryFileList /foundation/ /interchange-5/ /robots.txt /somefile.css
</Location>
@@ -146,13 +146,15 @@
the <Location>. For example:
<Location /shop>
- ...
+ SetHandler interchange-handler
+ InterchangeServer /opt/interchange/etc/socket
</Location>
The above will set the SCRIPT_NAME to "/shop".
<Location /shop>
- ...
+ SetHandler interchange-handler
+ InterchangeServer /opt/interchange/etc/socket
InterchangeScript /foo
</Location>
@@ -172,17 +174,24 @@
Copyright and License
---------------------
+Author: Kevin Walsh <kevin at cursor.biz>
+Based on original code by Francis J. Lacoste <francis.lacoste at iNsu.COM>
+
+Copyright (c) 2000-2005 Cursor Software Limited.
Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc.
-Copyright (c) 2000-2003 Cursor Software Limited.
All rights reserved.
-This program is free software. You can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
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.
+the Free Software Foundation; 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.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
2.10 +46 -20 interchange/dist/src/mod_interchange/mod_interchange.c
rev 2.10, prev_rev 2.9
Index: mod_interchange.c
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/mod_interchange.c,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- mod_interchange.c 26 Mar 2004 22:30:44 -0000 2.9
+++ mod_interchange.c 2 Nov 2005 03:08:51 -0000 2.10
@@ -1,17 +1,21 @@
-#define MODULE_VERSION "mod_interchange/1.30"
+#define MODULE_VERSION "mod_interchange/1.33"
/*
- * $Id: mod_interchange.c,v 2.9 2004/03/26 22:30:44 kwalsh Exp $
+ * $Id: mod_interchange.c,v 2.10 2005/11/02 03:08:51 kwalsh Exp $
*
- * Apache Module implementation of the Interchange application server
+ * Apache Module implementation of the Interchange application server's
* link programs.
*
+ * ----------------------------------------------------------------------
+ *
* Author: Kevin Walsh <kevin at cursor.biz>
* Based on original code by Francis J. Lacoste <francis.lacoste at iNsu.COM>
*
+ * Copyright (c) 2000-2005 Cursor Software Limited.
* Copyright (c) 1999 Francis J. Lacoste, iNsu Innovations.
- * Copyright (c) 2000-2004 Cursor Software Limited.
* All rights reserved.
*
+ * ----------------------------------------------------------------------
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -25,7 +29,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
+ * 02111-1307 USA.
*/
#include "httpd.h"
#include "http_config.h"
@@ -81,14 +85,14 @@
typedef struct ic_conf_struct{
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 connect_retry_delay;/* delay this many seconds between retries */
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];
+ char ordinarylist[IC_MAX_ORDINARYLIST][IC_MAX_LIST_ENTRYSIZE+1];
}ic_conf_rec;
typedef struct ic_response_buffer_struct{
@@ -361,7 +365,7 @@
{
ic_conf_rec *conf_rec = (ic_conf_rec *)mconfig;
- if (conf_rec->ordinarylist_no < IC_MAX_DROPLIST){
+ if (conf_rec->ordinarylist_no < IC_MAX_ORDINARYLIST){
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';
}
@@ -567,11 +571,21 @@
}
rp = request_uri;
+
while (*rp == '/')
rp++;
- if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
- rp += conf_rec->location_len;
+ /*
+ * strip the location path from the request_uri string
+ * unless the location is "/"
+ */
+ if (conf_rec->location[0] != '\0'){
+ if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
+ rp += conf_rec->location_len;
+ }else{
+ if (rp != request_uri)
+ rp--;
+ }
strncpy(request_uri,rp,MAX_STRING_LEN - 1);
request_uri[MAX_STRING_LEN - 1] = '\0';
@@ -603,11 +617,21 @@
*/
if (redirect_url[0] != '\0'){
rp = redirect_url;
+
while (*rp == '/')
rp++;
- if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
- rp += conf_rec->location_len;
+ /*
+ * strip the location path from the request_uri string
+ * unless the location is "/"
+ */
+ if (conf_rec->location[0] != '\0'){
+ if (strncmp(rp,conf_rec->location,conf_rec->location_len) == 0)
+ rp += conf_rec->location_len;
+ }else{
+ if (rp != redirect_url)
+ rp--;
+ }
strncpy(redirect_url,rp,MAX_STRING_LEN - 1);
redirect_url[MAX_STRING_LEN - 1] = '\0';
@@ -717,9 +741,11 @@
/*
* check the HTTP header to make sure that it looks valid
*/
- if (ap_scan_script_header_err_buff(r,ic_buff,sbuf)){
- ap_log_rerror(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,r,"Malformed header return by Interchange: %s",sbuf);
- return HTTP_INTERNAL_SERVER_ERROR;
+ if ((rc = ap_scan_script_header_err_buff(r,ic_buff,sbuf)) != OK) {
+ if (rc == HTTP_INTERNAL_SERVER_ERROR) {
+ ap_log_rerror(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,r,"Malformed header return by Interchange: %s",sbuf);
+ }
+ return rc;
}
/*
@@ -881,7 +907,7 @@
/*
* the module's configuration directives
*/
-static command_rec ic_cmds[] ={
+static command_rec ic_cmds[] = {
{
"InterchangeServer", /* directive name */
ic_server_cmd, /* config action routine */
@@ -920,7 +946,7 @@
NULL, /* argument to include in call */
ACCESS_CONF, /* where available */
ITERATE, /* arguments */
- "Drop the request if the URI path contains one of the specified strings"
+ "Drop the request if the URI path contains one of the specified values"
},
{
"OrdinaryFileList", /* directive name */
@@ -928,7 +954,7 @@
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"
+ "Don't pass to Interchange if the URI path starts with one of the specified values"
},
{
"InterchangeScript", /* directive name */
@@ -944,7 +970,7 @@
/*
* make the name of the content handler known to Apache
*/
-static handler_rec ic_handlers[] ={
+static handler_rec ic_handlers[] = {
{"interchange-handler",ic_handler},
{NULL}
};
@@ -952,7 +978,7 @@
/*
* tell Apache what phases of the transaction we handle
*/
-module MODULE_VAR_EXPORT interchange_module ={
+module MODULE_VAR_EXPORT interchange_module = {
STANDARD_MODULE_STUFF,
ic_initialise, /* module initialiser */
ic_create_dir_config, /* per-directory config creator */
2.10 +56 -9 interchange/dist/src/mod_interchange/mod_interchange.html
rev 2.10, prev_rev 2.9
Index: mod_interchange.html
===================================================================
RCS file: /var/cvs/interchange/dist/src/mod_interchange/mod_interchange.html,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- mod_interchange.html 26 Mar 2004 22:30:45 -0000 2.9
+++ mod_interchange.html 2 Nov 2005 03:08:51 -0000 2.10
@@ -1,23 +1,23 @@
-<!-- $Id: mod_interchange.html,v 2.9 2004/03/26 22:30:45 kwalsh Exp $ -->
+<!-- $Id: mod_interchange.html,v 2.10 2005/11/02 03:08:51 kwalsh Exp $ -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Apache module: mod_interchange (version 1.30)</title>
+ <title>Apache module: mod_interchange (version 1.33)</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
- <h1>Apache module: mod_interchange (version 1.30)</h1>
+ <h1>Apache module: mod_interchange (version 1.33)</h1>
<h2>Apache link module for Interchange</h2>
<p>
This module replaces the <i>tlink</i> and <i>vlink</i> programs
that come with <a href="http://www.icdevgroup.org/">Interchange</a>.
It has been tested with all Interchange versions up to and
- including 4.9.6 (development).
+ including 5.3.1 (development).
Although this module is known to have worked with MiniVend versions 3
and 4, its current compatibility has not been tested.
</p>
<p>
This module has been tested with Apache versions 1.3.6
- through 1.3.29.
+ through 1.3.33.
<b>Note that this module is not compatible with Apache 2.</b>
</p>
@@ -224,7 +224,7 @@
<code>
<b><Location</b> <i>/shop</i><b>></b><br>
<b>SetHandler interchange-handler</b><br>
- <b>InterchangeServer</b> <i>localhost</i>:<i>7786</i><br>
+ <b>InterchangeServer</b> <i>/opt/interchange/etc/socket</i><br>
<b>DropRequestList</b> <i>/default.ida /x.ida /cmd.exe /root.exe</i><br>
<b></Location></b><br>
</code>
@@ -239,7 +239,7 @@
<code>
<b><Location</b> <i>/</i><b>></b><br>
<b>SetHandler interchange-handler</b><br>
- <b>InterchangeServer</b> <i>localhost</i>:<i>7786</i><br>
+ <b>InterchangeServer</b> <i>/opt/interchange/etc/socket</i><br>
<b>OrdinaryFileList</b> <i>/foundation/ /interchange-5/ /robots.txt</i><br>
<b></Location></b><br>
</code>
@@ -276,7 +276,7 @@
<code>
<b><Location</b> <i>/shop</i><b>></b><br>
<b>SetHandler interchange-handler</b><br>
- <b>InterchangeServer</b> <i>localhost</i>:<i>7786</i><br>
+ <b>InterchangeServer</b> <i>/opt/interchange/etc/socket</i><br>
<b>InterchangeScript</b> <i>/foo</i><br>
<b></Location></b><br>
</code>
@@ -295,6 +295,53 @@
<h2><a name="changelog">Change Log</a></h2>
<ul>
<li>
+ 1.33
+ (Mon 07 Jun 2005)
+ Kevin Walsh <kevin at cursor.biz><br>
+ <ul>
+ <li>
+ Applied a patch supplied by Jonathon Sim of Zeald.
+ Thanks Jon!
+ The patch fixes a problem where the result code from
+ a call to the <code>ap_scan_script_header_err_buff()</code>
+ Apache API function was not being examined closely
+ enough.
+ This apparently caused problems with GoogleBot and
+ caching proxies that make use of the
+ <code>If-Modified-Since:</code> HTTP header.
+ </li>
+ </ul>
+ <br>
+ </li><li>
+ 1.32
+ (Mon 21 Jan 2005)
+ Kevin Walsh <kevin at cursor.biz><br>
+ <ul>
+ <li>
+ Fixed a bug that caused problems with
+ <code>[history-scan]</code> regex matches.
+ The entire <code>Location</code> path was being
+ stripped from the URI, which was fine unless
+ <code><Location /></code> was specified.
+ </li>
+ </ul>
+ <br>
+ </li><li>
+ 1.31
+ (Thu 13 Oct 2004)
+ Kevin Walsh <kevin at cursor.biz><br>
+ <ul>
+ <li>
+ Fixed a bug with a patch kindly supplied by Josh Lavin.
+ The <code>OrdinaryFileList</code> code was using the
+ <code>IC_MAX_DROPLIST</code> configurable setting instead
+ of its own <code>IC_MAX_ORDINARYLIST</code>.
+ That'll teach me not to copy/paste when creating new
+ code. :-)
+ </li>
+ </ul>
+ <br>
+ </li><li>
1.30
(Thu 08 Mar 2004)
Kevin Walsh <kevin at cursor.biz><br>
@@ -581,8 +628,8 @@
<br><hr>
<h2><a name="copyright">Copyright and License</a></h2>
<p>
+ Copyright © 2000-2005 Cursor Software Limited.<br>
Copyright © 1999 Francis J. Lacoste and iNsu Innovations Inc.<br>
- Copyright © 2000-2004 Cursor Software Limited.<br>
All rights reserved.
</p>
<p>
More information about the interchange-cvs
mailing list