andya 2004/05/06 06:33:53
Modified: jk/native2/server/dsapi jk_dsapi_plugin.c
jk/native2/server/dsapi/test test.c test.dsp
Log:
Changes so that the test subproject builds cleanly. Should only effect the Windows
version.
Revision Changes Path
1.14 +19 -7
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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- jk_dsapi_plugin.c 29 Apr 2004 17:37:32 -0000 1.13
+++ jk_dsapi_plugin.c 6 May 2004 13:33:53 -0000 1.14
@@ -51,11 +51,13 @@
#include "apr_general.h"
/* Domino DSAPI filter definitions */
+#if !defined(TESTING)
#include <global.h>
#include <addin.h>
-#include <dsapi.h>
#include <osmem.h>
#include <lookup.h>
+#endif
+#include <dsapi.h>
int JK_METHOD jk2_logger_domino_factory(jk_env_t *env, jk_pool_t *pool, jk_bean_t
*result, const char *type, const char *name);
@@ -66,6 +68,9 @@
#define LOGGER "logger.domino"
#endif
+#define NULLSTR(s) \
+ (NULL == (s) || '\0' == (s)[0])
+
#ifdef WIN32
static char libFileName[MAX_PATH];
static char iniFileName[MAX_PATH];
@@ -661,6 +666,7 @@
return kFilterHandledRequest;
}
+#if !defined(TESTING)
/* Get the info from the lookup buffer
*/
static int getLookupInfo(FilterContext *context, char *pMatch, WORD itemNumber,
char **pInfo) {
@@ -704,10 +710,15 @@
return -1;
}
+#endif
/* Lookup the user and return the user's full name
*/
static int getUserName(FilterContext *context, char *userName, char **pUserName) {
+#if defined(TESTING)
+ *pUserName = userName;
+ return NOERROR;
+#else
STATUS error = NOERROR;
HANDLE hLookup = NULLHANDLE;
unsigned short nMatches = 0;
@@ -759,6 +770,7 @@
OSMemFree(hLookup);
}
return rc;
+#endif
}
/* Given all the HTTP headers as a single string parse them into individual
@@ -862,7 +874,7 @@
GETVARIABLE("REMOTE_USER", &s->remote_user, "");
/* If the REMOTE_USER CGI variable doesn't work try asking Domino */
- if (s->remote_user[0] == '\0' && fr->userName[0] != '\0') {
+ if (NULLSTR(s->remote_user) && !NULLSTR(fr->userName)) {
getUserName(ws->context, fr->userName, &s->remote_user);
}
@@ -1180,7 +1192,7 @@
isInited = JK_FALSE;
}
-#ifndef TESTING
+#if !defined(TESTING)
if (NONBLANK(tomcatStop)) {
AddInLogMessageText("Attempting to stop Tomcat: %s", NOERROR, tomcatStop);
runProg(tomcatStop);
@@ -1230,7 +1242,7 @@
/* Create the logger
*/
-#ifdef TESTING
+#if defined(TESTING)
env->registerFactory(env, "logger.printf", jk2_logger_printf_factory);
#else
env->registerFactory(env, "logger.domino", jk2_logger_domino_factory );
@@ -1265,7 +1277,7 @@
workerEnv->init(env, workerEnv);
-#ifndef TESTING
+#if !defined(TESTING)
/* Attempt to launch Tomcat
*/
if (NONBLANK(tomcatStart)) {
@@ -1317,7 +1329,7 @@
}
#endif
-#ifdef TESTING
+#if defined(TESTING)
/* Handle initialisation in the test harness environment.
*/
void TestMain(void) {
1.4 +6 -2 jakarta-tomcat-connectors/jk/native2/server/dsapi/test/test.c
Index: test.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/dsapi/test/test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- test.c 24 Feb 2004 08:44:42 -0000 1.3
+++ test.c 6 May 2004 13:33:53 -0000 1.4
@@ -37,7 +37,7 @@
#define SERVER "localhost"
#define PORT "80"
-#define URI "/examples/jsp/num/numguess.jsp"
+#define URI "/examples/jsp/snp/snoop.jsp"
#define HTTPVERSION "1.1"
typedef struct _ServerContext {
@@ -134,6 +134,10 @@
static int fprGetHeader(FilterContext *context, char *name, char *buffer,
unsigned int bufferSize, unsigned int
*errID) {
printf("fpr.GetHeader(%p, \"%s\", %p, %u, %p)\n", context, name, buffer,
bufferSize, errID);
+ if (stricmp(name, "host") == 0) {
+ strcpy(buffer, SERVER ":" PORT);
+ return strlen(buffer) + 1;
+ }
return 0;
}
1.3 +3 -3 jakarta-tomcat-connectors/jk/native2/server/dsapi/test/test.dsp
Index: test.dsp
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/dsapi/test/test.dsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- test.dsp 14 Nov 2003 13:08:23 -0000 1.2
+++ test.dsp 6 May 2004 13:33:53 -0000 1.3
@@ -42,7 +42,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
/YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\..\include" /I
"$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I
"..\..\..\..\..\..\apr\include" /I "..\..\..\..\..\..\apr-util\include" /I
"..\..\..\..\..\..\pcre\include" /I "$(NOTESAPI)\include" /D "NDEBUG" /D "WIN32" /D
"_CONSOLE" /D "_MBCS" /D "_USRDLL" /D "HAVE_JNI" /D "HAS_APR" /D "HAS_PCRE" /D "NT" /D
"TESTING" /U "NOUSER" /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "$(NOTESAPI)\include" /I ".." /I
"..\..\..\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I
"..\..\..\..\..\..\apr\include" /I "..\..\..\..\..\..\apr-util\include" /I
"..\..\..\..\..\..\pcre\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D
"_USRDLL" /D "HAVE_JNI" /D "HAS_APR" /D "HAS_PCRE" /D "NT" /D "TESTING" /U "NOUSER"
/FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
@@ -51,7 +51,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console
/machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
ws2_32.lib wsock32.lib pcre.lib pcreposix.lib notes.lib libapr.lib libaprutil.lib
/nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\..\pcre\lib"
/libpath:"..\..\..\..\..\..\apr\Release" /libpath:"..\..\..\..\..\..\apr-util\Release"
/libpath:"$(NOTESAPI)\lib\mswin32"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
ws2_32.lib wsock32.lib pcre.lib pcreposix.lib libapr.lib libaprutil.lib /nologo
/subsystem:console /machine:I386 /libpath:"..\..\..\..\..\..\pcre\lib"
/libpath:"..\..\..\..\..\..\apr\Release" /libpath:"..\..\..\..\..\..\apr-util\Release"
!ELSEIF "$(CFG)" == "test - Win32 Debug"
@@ -76,7 +76,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console
/debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
ws2_32.lib wsock32.lib pcre.lib pcreposix.lib notes.lib libapr.lib libaprutil.lib
/nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
/libpath:"..\..\..\..\..\..\pcre\lib" /libpath:"..\..\..\..\..\..\apr\Release"
/libpath:"..\..\..\..\..\..\apr-util\Release" /libpath:"$(NOTESAPI)\lib\mswin32"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
ws2_32.lib wsock32.lib pcre.lib pcreposix.lib libapr.lib libaprutil.lib /nologo
/subsystem:console /debug /machine:I386 /pdbtype:sept
/libpath:"..\..\..\..\..\..\pcre\lib" /libpath:"..\..\..\..\..\..\apr\Release"
/libpath:"..\..\..\..\..\..\apr-util\Release"
!ENDIF
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]