andya 2004/04/29 05:22:38 Modified: jk/native2/server/dsapi jk_dsapi_plugin.c Log: Switched to parsing hostname, port directly from the request header because it seems that the Domino GetServerVariable() API clobbers the Remote_User CGI variable and maybe others. This meant that Remote_User was unavailable to Domino for all requests not handled by the redirector. Revision Changes Path 1.10 +21 -11 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_dsapi_plugin.c 28 Apr 2004 15:06:46 -0000 1.9 +++ jk_dsapi_plugin.c 29 Apr 2004 12:22:38 -0000 1.10 @@ -834,6 +834,7 @@ int rc; FilterRequest fr; int result = kFilterNotHandled; + char *h = NULL; /* TODO: presumably this return code should be checked */ rc = context->GetRequest(context, &fr, &errID); @@ -844,6 +845,7 @@ jk_uriEnv_t *uriEnv = NULL; int errID; char buf[256]; /* enough for the server's name */ + char *colon; char *serverName; size_t serverNameSz; int serverPort; @@ -853,19 +855,27 @@ /* 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, "Failed to retrieve SERVER_PORT"); + /* We used to call the context->GetServerVariable() API here but doing so + * seems to clobber some of the server's CGI variables in the case where + * we don't handle the request. + * + * Note also that we're using a static buffer for the host header. Presumably + * hostnames longer than 255 characters are either rare or illegal and there's + * no buffer overrun risk because Domino errors if the supplied buffer is too + * small. + */ + if (!reqData->GetHeader(context, "host", buf, sizeof(buf), &errID)) { + return rejectWithError(context, "Failed to retrieve host"); } - serverPort = atoi(buf); - - if (!context->GetServerVariable(context, "SERVER_NAME", buf, sizeof(buf), &errID)) { - return rejectWithError(context, "Failed to retrieve SERVER_NAME"); + serverName = buf; + /* Parse out the port number */ + if (colon = strchr(serverName, ':'), NULL != colon) { + *colon++ = '\0'; + serverPort = atoi(colon); + } else { + serverPort = 80; } - - serverName = buf; /* note serverName just aliases buf - * and will be destroyed if buf is reused - */ serverNameSz = strlen(serverName) + 1;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]