You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by an...@apache.org on 2004/01/29 16:43:24 UTC

cvs commit: jakarta-tomcat-connectors/jk/native2/server/dsapi config.h jk_dsapi_plugin.c

andya       2004/01/29 07:43:24

  Modified:    jk/native2/server/dsapi config.h jk_dsapi_plugin.c
  Log:
  Fixed a bug in path decoding which caused problems with parameters that contained encoded forward slashes.
  Made error reporting slightly more diagnostic.
  
  Revision  Changes    Path
  1.3       +2 -5      jakarta-tomcat-connectors/jk/native2/server/dsapi/config.h
  
  Index: config.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/dsapi/config.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- config.h	14 Nov 2003 13:08:05 -0000	1.2
  +++ config.h	29 Jan 2004 15:43:24 -0000	1.3
  @@ -64,9 +64,6 @@
   #ifndef __config_h
   #define __config_h
   
  -#define MAKEVERSION(a, b, c, d) \
  -	(((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
  -
   #define NONBLANK(s) \
   	(NULL != (s) && '\0' != *(s))
   
  @@ -118,7 +115,7 @@
   #define TOMCAT_START_TAG	"tomcatStart"
   #define TOMCAT_STOP_TAG		"tomcatStop"
   #define TOMCAT_TIMEOUT_TAG	"tomcatTimeout"
  -#define VERSION				"2.0.0"
  +#define VERSION				"2.0.1"
   #define VERSION_STRING		"Jakarta/DSAPI/" VERSION
   #define FILTERDESC			"Apache Tomcat Interceptor (" VERSION_STRING ")"
   #define SERVERDFLT			"Lotus Domino"
  
  
  
  1.3       +25 -10    jakarta-tomcat-connectors/jk/native2/server/dsapi/jk_dsapi_plugin.c
  
  Index: jk_dsapi_plugin.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/dsapi/jk_dsapi_plugin.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_dsapi_plugin.c	14 Nov 2003 13:08:05 -0000	1.2
  +++ jk_dsapi_plugin.c	29 Jan 2004 15:43:24 -0000	1.3
  @@ -682,10 +682,24 @@
   
   /* Called to generate a generic error response.
    */
  -static unsigned int rejectWithError(FilterContext *context) {
  -	static char *msg = "<html><body><h1>Error in Filter</h1></body></html>";
  +static unsigned int rejectWithError(FilterContext *context, const char *diagnostic) {
  +	static char *msg = "<html><body><h1>Error in Filter</h1><p>%s</p></body></html>";
  +	char *mbuf;
  +	int errID;
  +	size_t bufSz;
   
  -	simpleResponse(context, 500, "Error in Filter", msg);
  +	if (!NONBLANK(diagnostic)) {
  +		diagnostic = "Unspecified error";
  +	}
  +
  +	// This assumes that we're just going to expand the diagnostic into
  +	// the page body.
  +	bufSz = strlen(msg) + strlen(diagnostic) + 1;
  +
  +	mbuf = context->AllocMem(context, bufSz, 0, &errID);
  +	sprintf(mbuf, msg, diagnostic);
  +
  +	simpleResponse(context, 500, "Error in Filter", mbuf);
   
   	return kFilterHandledRequest;
   }
  @@ -901,13 +915,13 @@
   		/* env->l->jkLog(env, env->l, JK_LOG_DEBUG, "parsedRequest() - %s\n", uri); */
   
   		if (!context->GetServerVariable(context, "SERVER_PORT", buf, sizeof(buf), &errID)) {
  -			return rejectWithError(context);
  +			return rejectWithError(context, "Failed to retrieve SERVER_PORT");
   		}
   
   		serverPort = atoi(buf);
   
   		if (!context->GetServerVariable(context, "SERVER_NAME", buf, sizeof(buf), &errID)) {
  -			return rejectWithError(context);
  +			return rejectWithError(context, "Failed to retrieve SERVER_NAME");
   		}
   
   		serverName = buf;	/* note serverName just aliases buf
  @@ -927,16 +941,17 @@
   			turi = context->AllocMem(context, uriSz, 0, &errID);
   		}
   		memcpy(turi, uri, uriSz);
  +
  +        if (qp = strchr(turi, '?'), qp != NULL) {
  +			*qp++ = '\0';
  +		}
   	
           rc = jk_requtil_unescapeUrl(turi);
   		if (rc < 0) {
  -			return rejectWithError(context);
  +			return rejectWithError(context, "Failed to unescape URI");
   		}
   
           jk_requtil_getParents(turi);
  -        if (qp = strchr(turi, '?'), qp != NULL) {
  -			*qp++ = '\0';
  -		}
   
   		if (badURI(turi)) {
   			return rejectBadURI(context);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org