From 9401f816dd0d9d550fe98a8507224bde51c4b847 Mon Sep 17 00:00:00 2001 From: hongbotian Date: Mon, 30 Nov 2015 02:41:33 -0500 Subject: upload tomcat JIRA: BOTTLENECK-7 Change-Id: I875d474869efd76ca203c30b60ebc0c3ee606d0e Signed-off-by: hongbotian --- .../native/netscape/Makefile.linux | 59 ++ .../native/netscape/Makefile.netware | 277 +++++++++ .../native/netscape/Makefile.solaris | 85 +++ .../native/netscape/Makefile.vc | 287 ++++++++++ .../native/netscape/README | 31 + .../native/netscape/jk_nsapi_plugin.c | 634 +++++++++++++++++++++ .../native/netscape/nsapi.dsp | 283 +++++++++ 7 files changed, 1656 insertions(+) create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.linux create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.netware create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.solaris create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.vc create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/README create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/jk_nsapi_plugin.c create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/nsapi.dsp (limited to 'rubbos/app/tomcat-connectors-1.2.32-src/native/netscape') diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.linux b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.linux new file mode 100644 index 00000000..43e0d0bf --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.linux @@ -0,0 +1,59 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Defines for example NSAPI programs running under Linux + +# gcc +# If you get relocation errors, try: +# 1. compiling with Sun's cc +# 2. statically linking with libgcc +# 3. Adjusting LD_LIBRARY_PATH to grab libgcc_s +CC=gcc +# For 64 Bit builds, add "-m64" to EXTRA_CFLAGS +EXTRA_CFLAGS=-fPIC -pthread +LDFLAGS=-shared + +CC_CMD=$(CC) $(CFLAGS) $(EXTRA_CFLAGS) \ + -DNET_SSL -DSOLARIS -D_REENTRANT -DXP_UNIX -DMCC_HTTPD -DSPAPI20 -DJK_NSAPI + +LD_SHAREDCMD=$(CC) $(LDFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) + +OS_TYPE=linux +INCLUDEDIR=$(IPLANET_HOME)/include +JAVA_INCLUDE=$(JAVA_HOME)/include +JK_DIR=../common +VPATH=.:$(JK_DIR) + +JK_SRCS = $(shell \ls $(JK_DIR)/*.c) +JK_OBJECTS = $(patsubst $(JK_DIR)/%.c,%.o,$(JK_SRCS)) +JK_JNI_OBJECTS = jk_jni_worker.o jk_nwmain.o +JK_OBJS = $(filter-out $(JK_JNI_OBJECTS),$(JK_OBJECTS)) + +PLUGIN_OBJ = jk_nsapi_plugin.o + +INCLUDE_FLAGS= -I$(JK_DIR) -I$(INCLUDEDIR) -I$(INCLUDEDIR)/base \ + -I$(INCLUDEDIR)/frame -I$(JAVA_INCLUDE) -I$(JAVA_INCLUDE)/$(OS_TYPE) + +all: nsapi_redirector.so + + +nsapi_redirector.so: $(JK_OBJS) $(PLUGIN_OBJ) + $(LD_SHAREDCMD) $(JK_OBJS) $(PLUGIN_OBJ) -o nsapi_redirector.so $(EXTRA_LDDEFINES) + +clean: + rm -f *.o nsapi_redirector.so $(JK_OBJS) + +%.o : %.c + $(CC_CMD) $(INCLUDE_FLAGS) -c $< diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.netware b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.netware new file mode 100644 index 00000000..b3244bed --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.netware @@ -0,0 +1,277 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Makefile for jk_nsapi_plugin (NetWare version - gnu make) +# created by Guenter Knauf +# + +# Edit the path below to point to the base of your Netscape includes. +ifndef NS_HOME +NS_HOME = c:/projects/sdks/netscape +endif +# Edit the path below to point to the base of your NetWare Java SDK. +ifndef NW_JDK +NW_JDK = c:/projects/sdks/java-nw +endif +# Edit the path below to point to the base of your Novell NDK. +ifndef NDKBASE +NDKBASE = c:/novell +endif + +ifndef INSTDIR +INSTDIR = s:/sys/novonyx/modules +endif + +# Edit the vars below to change NLM target settings. +TARGET = nsapi_rd +VERSION = $(JK_VERSION) +COPYR = Licensed under the Apache License, Version 2.0 +DESCR = Netscape plugin for Tomcat $(JK_VERSION_STR) +MTSAFE = NO +STACK = 65536 +#SCREEN = System Console +MODULES = nshttpd +EXPORTS = jk_init jk_service +IMPORTS = __nsapi30_table + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +LIBARCH = CLIB +# LIBARCH = LIBC +endif + +# must be equal to DEBUG or NDEBUG +DB = NDEBUG +# DB = DEBUG +# Optimization: -O or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# Include the version info retrieved from jk_version.h +-include $(OBJDIR)/version.inc + +# The following line defines your compiler. +ifdef METROWERKS + CC = mwccnlm +else + CC = gcc +endif +# RM = rm -f +# CP = cp -fv +# if you want to mark the target as MTSAFE you will need a tool for +# generating the xdc data for the linker; here's a minimal tool: +# http://www.gknw.net/development/prgtools/mkxdc.zip +MPKXDC = mkxdc +AWK = awk + +# Global flags for all compilers +CFLAGS = $(OPT) -D$(DB) -DNETWARE -DXP_NETWARE -nostdinc -DJK_NSAPI + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $(OBJS) $(PRELUDE) $(LDLIBS) -o $@ -commandfile +CFLAGS += -gccinc -inline off -opt nointrinsics +#CFLAGS += -w on +ifeq ($(LIBARCH),LIBC) + PRELUDE = $(SDK_LIBC)/imports/libcpre.o + CFLAGS += -align 4 -inst mmx -proc 686 +# CFLAGS += -D__ANSIC__ +else + PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj" + LDLIBS = "$(METROWERKS)/Novell Support/libraries/runtime/mwcrtl.lib" +# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h" + CFLAGS += -align 1 -proc 586 +endif +else +LD = nlmconv +LDFLAGS = -T +CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return +CFLAGS += -Wall -Wno-main # -pedantic +ifeq ($(LIBARCH),LIBC) + PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o +# CFLAGS += -D__ANSIC__ +else + PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +NDK_ROOT = $(NDKBASE)/ndk +SDK_CLIB = $(NDK_ROOT)/nwsdk +SDK_LIBC = $(NDK_ROOT)/libc +JKCOMMON = ../common + +INCLUDES = -I$(NS_HOME)/include -I$(NS_HOME)/include/base +INCLUDES += -I$(JKCOMMON) -I$(NW_JDK)/include -I$(NW_JDK)/include/netware + +ifeq ($(LIBARCH),LIBC) + INCLUDES += -I$(SDK_LIBC)/include + INCLUDES += -I$(SDK_LIBC)/include/winsock +else + INCLUDES += -I$(SDK_CLIB)/include/nlm + # INCLUDES += -I$(NDKBASE)/ws295sdk/include + CFLAGS += -DNETDB_USE_INTERNET + CFLAGS += -DNO_GETTIMEOFDAY + CFLAGS += -DJK_PREFORK +endif +CFLAGS += $(INCLUDES) + +ifeq ($(MTSAFE),YES) + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif + +ifeq ($(findstring linux,$(OSTYPE)),linux) +DL = ' +#-include $(NDKBASE)/nlmconv/ncpfs.inc +endif + +OBJS = \ + $(OBJDIR)/jk_nsapi_plugin.o \ + $(OBJDIR)/jk_nwmain.o \ + $(OBJDIR)/jk_ajp12_worker.o \ + $(OBJDIR)/jk_ajp13.o \ + $(OBJDIR)/jk_ajp13_worker.o \ + $(OBJDIR)/jk_ajp14.o \ + $(OBJDIR)/jk_ajp14_worker.o \ + $(OBJDIR)/jk_ajp_common.o \ + $(OBJDIR)/jk_connect.o \ + $(OBJDIR)/jk_context.o \ + $(OBJDIR)/jk_jni_worker.o \ + $(OBJDIR)/jk_lb_worker.o \ + $(OBJDIR)/jk_map.o \ + $(OBJDIR)/jk_md5.o \ + $(OBJDIR)/jk_msg_buff.o \ + $(OBJDIR)/jk_pool.o \ + $(OBJDIR)/jk_shm.o \ + $(OBJDIR)/jk_sockbuf.o \ + $(OBJDIR)/jk_status.o \ + $(OBJDIR)/jk_uri_worker_map.o \ + $(OBJDIR)/jk_url.o \ + $(OBJDIR)/jk_util.o \ + $(OBJDIR)/jk_worker.o \ + $(OBJDIR)/ap_snprintf.o + +vpath %.c . $(JKCOMMON) + + +all: $(OBJDIR) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).nlm + +$(OBJDIR)/%.o: %.c + @echo Compiling $< + @$(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: $(JKCOMMON)/jk_version.h $(OBJDIR) + @echo Creating $@ + @$(AWK) -f ../../support/get_ver.awk $< > $@ + +dist: all + -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv + -$(RM) $(OBJDIR)/$(TARGET).def $(OBJDIR)/version.inc $(XDCDATA) +# -$(CP) ../changes.txt $(OBJDIR)/ + +install: all + @[ -d $(INSTDIR) ] || mkdir $(INSTDIR) + @$(CP) $(TARGET).nlm $(INSTDIR) + +clean: + -$(RM) -r $(OBJDIR) + +$(OBJDIR): + @mkdir $(OBJDIR) + +$(OBJDIR)/$(TARGET).nlm: $(OBJS) $(OBJDIR)/$(TARGET).def $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def + +$(OBJDIR)/%.xdc: Makefile.netware + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.netware + @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ + @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR)"$(DL) >> $@ + @echo $(DL)version $(VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif +ifdef SCREEN + @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifeq ($(DB),DEBUG) + @echo $(DL)debug$(DL) >> $@ +endif + @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/socklib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +else +ifeq ($(LD),nlmconv) + @echo $(DL)flag_on 64$(DL) >> $@ +else + @echo $(DL)autounload$(DL) >> $@ +endif + @echo $(DL)pseudopreemption$(DL) >> $@ + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/libc/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/libc/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ +endif +ifdef MODULES + @echo $(DL)module $(MODULES)$(DL) >> $@ +endif +ifdef EXPORTS + @echo $(DL)export $(EXPORTS)$(DL) >> $@ +endif +ifdef IMPORTS + @echo $(DL)import $(IMPORTS)$(DL) >> $@ +endif +ifeq ($(LD),nlmconv) + @echo $(DL)input $(OBJS)$(DL) >> $@ + @echo $(DL)input $(PRELUDE)$(DL) >> $@ +ifdef LDLIBS + @echo $(DL)input $(LDLIBS)$(DL) >> $@ +endif + @echo $(DL)output $*.nlm$(DL) >> $@ +endif + + diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.solaris b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.solaris new file mode 100644 index 00000000..eeb7c1ae --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.solaris @@ -0,0 +1,85 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Defines for example NSAPI programs running under SOLARIS + +# Choose between the settings for gcc or Sun Studio compiler + +# gcc +# If you get relocation errors, try: +# 1. compiling with Sun's cc +# 2. statically linking with libgcc +# 3. Adjusting LD_LIBRARY_PATH to grab libgcc_s +CC=gcc +# For 64 Bit builds, add "-m64" to EXTRA_CFLAGS +EXTRA_CFLAGS=-fPIC -pthread +LDFLAGS=-shared + +# Sun Studio cc compiler +#CC=cc +# For 64 Bit builds, add "-xtarget=generic64" to EXTRA_CFLAGS +#EXTRA_CFLAGS=-xcode=pic32 -mt +#LDFLAGS=-G + +# Change this according to location where on installed the server. +# Don't forget to do the ./configure --enable-netscape=/opt/SUNWwbsvr/plugins +# before doing gmake -f Makefile.solaris + +CC_CMD=$(CC) $(CFLAGS) $(EXTRA_CFLAGS) \ + -DNET_SSL -DSOLARIS -D_REENTRANT -DXP_UNIX -DMCC_HTTPD -DSPAPI20 -DJK_NSAPI + +LD_SHAREDCMD=$(CC) $(LDFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) + +all: + +prepare: + +OS_TYPE=solaris +INCLUDEDIR=$(IPLANET_HOME)/include +JAVA_INCLUDE=$(JAVA_HOME)/include +JK_DIR=../common +VPATH=.:$(JK_DIR) + +JK_OBJS = ap_snprintf.o jk_md5.o \ +jk_ajp12_worker.o jk_msg_buff.o \ +jk_ajp13.o jk_nwmain.o \ +jk_ajp13_worker.o jk_pool.o \ +jk_ajp14.o jk_shm.o \ +jk_ajp14_worker.o jk_sockbuf.o \ +jk_ajp_common.o jk_status.o \ +jk_connect.o jk_uri_worker_map.o \ +jk_context.o jk_url.o \ +jk_jni_worker.o jk_util.o \ +jk_lb_worker.o jk_worker.o \ +jk_map.o + + +PLUGIN_OBJ = jk_nsapi_plugin.o + +INCLUDE_FLAGS= -I$(JK_DIR) -I$(INCLUDEDIR) -I$(INCLUDEDIR)/base \ + -I$(INCLUDEDIR)/frame -I$(JAVA_INCLUDE) -I$(JAVA_INCLUDE)/$(OS_TYPE) + +all: nsapi_redirector.so + + +nsapi_redirector.so: $(JK_OBJS) $(PLUGIN_OBJ) + $(LD_SHAREDCMD) $(JK_OBJS) $(PLUGIN_OBJ) -o nsapi_redirector.so $(EXTRA_LDDEFINES) + +clean: + rm -f *.o nsapi_redirector.so $(JK_OBJS) + rm -f $(JK_DIR)/*.o + +%.o : %.c + $(CC_CMD) $(INCLUDE_FLAGS) -c $< diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.vc b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.vc new file mode 100644 index 00000000..2f4aa062 --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/Makefile.vc @@ -0,0 +1,287 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on nsapi.dsp +!IF "$(CFG)" == "" +CFG=nsapi - Win32 Release +!MESSAGE No configuration specified. Defaulting to nsapi - Win32 Release. +!ENDIF + +!IF "$(CFG)" != "nsapi - Win32 Release" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nsapi.mak" CFG="nsapi - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nsapi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +TARGET=nsapi_redirect$(SO_VERSION) + +OUTDIR=.\nsapi_release +INTDIR=.\nsapi_release +# Begin Custom Macros +OutDir=.\nsapi_release +# End Custom Macros + +ALL : "$(OUTDIR)\$(TARGET).dll" + + +CLEAN : + -@erase "$(INTDIR)\jk_ajp12_worker.obj" + -@erase "$(INTDIR)\jk_ajp13.obj" + -@erase "$(INTDIR)\jk_ajp13_worker.obj" + -@erase "$(INTDIR)\jk_ajp14.obj" + -@erase "$(INTDIR)\jk_ajp14_worker.obj" + -@erase "$(INTDIR)\jk_ajp_common.obj" + -@erase "$(INTDIR)\jk_connect.obj" + -@erase "$(INTDIR)\jk_context.obj" + -@erase "$(INTDIR)\jk_jni_worker.obj" + -@erase "$(INTDIR)\jk_lb_worker.obj" + -@erase "$(INTDIR)\jk_map.obj" + -@erase "$(INTDIR)\jk_md5.obj" + -@erase "$(INTDIR)\jk_msg_buff.obj" + -@erase "$(INTDIR)\jk_nsapi_plugin.obj" + -@erase "$(INTDIR)\jk_pool.obj" + -@erase "$(INTDIR)\jk_shm.obj" + -@erase "$(INTDIR)\jk_sockbuf.obj" + -@erase "$(INTDIR)\jk_status.obj" + -@erase "$(INTDIR)\jk_uri_worker_map.obj" + -@erase "$(INTDIR)\jk_url.obj" + -@erase "$(INTDIR)\jk_util.obj" + -@erase "$(INTDIR)\jk_worker.obj" + -@erase "$(OUTDIR)\$(TARGET).dll" + -@erase "$(OUTDIR)\nsapi_redirect.exp" + -@erase "$(OUTDIR)\nsapi_redirect.lib" + -@erase "$(OUTDIR)\$(TARGET).pdb" + -@erase "$(OUTDIR)\nsapi_redirect_src.idb" + -@erase "$(OUTDIR)\\nsapi_redirect_src.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=-nologo -MD -W3 -O2 -Ob2 -Oy- -Zi -EHsc /I "..\common" /I "$(IPLANET_HOME)\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JK_NSAPI" /D "NSAPI_EXPORTS" /D "XP_WIN32" /D "MCC_HTTPD" /D "SPAPI20" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\nsapi_redirect_src" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\jk.res" /i "..\common" /d "JK_NSAPI" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\nsapi.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=ns-httpd40.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib $(EXTRA_LIBS) /nologo /base:"0x6A6B0000" /dll /incremental:no /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).dll" /implib:"$(OUTDIR)\nsapi_redirect.lib" /libpath:"$(IPLANET_HOME)\lib" +LINK32_OBJS= \ + "$(INTDIR)\jk_ajp12_worker.obj" \ + "$(INTDIR)\jk_ajp13.obj" \ + "$(INTDIR)\jk_ajp13_worker.obj" \ + "$(INTDIR)\jk_ajp14.obj" \ + "$(INTDIR)\jk_ajp14_worker.obj" \ + "$(INTDIR)\jk_ajp_common.obj" \ + "$(INTDIR)\jk_connect.obj" \ + "$(INTDIR)\jk_context.obj" \ + "$(INTDIR)\jk_jni_worker.obj" \ + "$(INTDIR)\jk_lb_worker.obj" \ + "$(INTDIR)\jk_map.obj" \ + "$(INTDIR)\jk_md5.obj" \ + "$(INTDIR)\jk_msg_buff.obj" \ + "$(INTDIR)\jk_nsapi_plugin.obj" \ + "$(INTDIR)\jk_pool.obj" \ + "$(INTDIR)\jk_shm.obj" \ + "$(INTDIR)\jk_sockbuf.obj" \ + "$(INTDIR)\jk_status.obj" \ + "$(INTDIR)\jk_uri_worker_map.obj" \ + "$(INTDIR)\jk_url.obj" \ + "$(INTDIR)\jk_util.obj" \ + "$(INTDIR)\jk.res" \ + "$(INTDIR)\jk_worker.obj" + +"$(OUTDIR)\$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + IF EXIST $(OUTDIR)\$(TARGET).manifest \ + mt -nologo -manifest $(OUTDIR)\$(TARGET).manifest -outputresource:$(OUTDIR)\$(TARGET).dll;2 + + +!IF "$(CFG)" == "nsapi - Win32 Release" +SOURCE=..\common\jk.rc + +"$(INTDIR)\jk.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp12_worker.c + +"$(INTDIR)\jk_ajp12_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp13.c + +"$(INTDIR)\jk_ajp13.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp13_worker.c + +"$(INTDIR)\jk_ajp13_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp14.c + +"$(INTDIR)\jk_ajp14.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp14_worker.c + +"$(INTDIR)\jk_ajp14_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_ajp_common.c + +"$(INTDIR)\jk_ajp_common.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_connect.c + +"$(INTDIR)\jk_connect.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_context.c + +"$(INTDIR)\jk_context.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_jni_worker.c + +"$(INTDIR)\jk_jni_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_lb_worker.c + +"$(INTDIR)\jk_lb_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_map.c + +"$(INTDIR)\jk_map.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_md5.c + +"$(INTDIR)\jk_md5.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_msg_buff.c + +"$(INTDIR)\jk_msg_buff.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\jk_nsapi_plugin.c + +"$(INTDIR)\jk_nsapi_plugin.obj" : $(SOURCE) "$(INTDIR)" + + +SOURCE=..\common\jk_pool.c + +"$(INTDIR)\jk_pool.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_shm.c + +"$(INTDIR)\jk_shm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_sockbuf.c + +"$(INTDIR)\jk_sockbuf.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_status.c + +"$(INTDIR)\jk_status.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_uri_worker_map.c + +"$(INTDIR)\jk_uri_worker_map.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_url.c + +"$(INTDIR)\jk_url.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_util.c + +"$(INTDIR)\jk_util.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\common\jk_worker.c + +"$(INTDIR)\jk_worker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + + +!ENDIF + diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/README b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/README new file mode 100644 index 00000000..41710931 --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/README @@ -0,0 +1,31 @@ +ABOUT +----- + +The redirector was originally developed using Visual C++ Ver.6.0, +so having this environment is a prerequisite if you want to perform +a custom build on Windows systems + +On Unix system, a Makefile.solaris and Makefile.linux are provided +and should be adapted to tailor to your own configuration. +Be sure to read the BUILDING.txt file, one directory up. + + +REQUIREMENT for Windows build +----------------------------- + +MS VC 6.0 (+ update, latest service pack is 6) + +BUILDING on Windows +------------------- + +The steps that you need to take are: + + 1. Change directory to the nsapi redirector plugins source directory. + 2. Set the IPLANET_HOME system environment value to iPlanet installation + directory or edit the nsapi.dsp and replace all $(IPLANET_HOME) + occurrences with the real path + 3. Execute the following command: + nmake -f Makefile.vc [SO_VERSION=-1.2.32] + +An alternative will be to open the isapi workspace file (nsapi.dsw) in msdev and +build it using the build menu. diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/jk_nsapi_plugin.c b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/jk_nsapi_plugin.c new file mode 100644 index 00000000..97f64156 --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/jk_nsapi_plugin.c @@ -0,0 +1,634 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*************************************************************************** + * Description: NSAPI plugin for Netscape servers * + * Author: Gal Shachor * + * Version: $Revision: 1078805 $ * + ***************************************************************************/ + +#if defined(WIN32) +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#endif +#include +#endif + +#include "nsapi.h" +#include "jk_global.h" +#include "jk_url.h" +#include "jk_util.h" +#include "jk_map.h" +#include "jk_pool.h" +#include "jk_service.h" +#include "jk_worker.h" +#include "jk_shm.h" +#include "jk_ajp13.h" + +#define URI_PATTERN "path" +#define DEFAULT_WORKER_NAME ("ajp13") +#define REJECT_UNSAFE_TAG "reject_unsafe" + +#define STRNULL_FOR_NULL(x) ((x) ? (x) : "(null)") + +struct nsapi_private_data +{ + jk_pool_t p; + + pblock *pb; + Session *sn; + Request *rq; +}; +typedef struct nsapi_private_data nsapi_private_data_t; + +static int init_on_other_thread_is_done = JK_FALSE; +static int init_on_other_thread_is_ok = JK_FALSE; + +static const char ssl_cert_start[] = "-----BEGIN CERTIFICATE-----\r\n"; +static const char ssl_cert_end[] = "\r\n-----END CERTIFICATE-----\r\n"; + +static jk_logger_t *logger = NULL; +static jk_worker_env_t worker_env; +static jk_map_t *init_map = NULL; +static jk_uri_worker_map_t *uw_map = NULL; +static size_t jk_shm_size = 0; + +#ifdef NETWARE +int (*PR_IsSocketSecure) (SYS_NETFD * csd); /* pointer to PR_IsSocketSecure function */ +#endif + +static int JK_METHOD start_response(jk_ws_service_t *s, + int status, + const char *reason, + const char *const *header_names, + const char *const *header_values, + unsigned num_of_headers); + +static int JK_METHOD ws_read(jk_ws_service_t *s, + void *b, unsigned l, unsigned *a); + +static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l); + +NSAPI_PUBLIC int jk_init(pblock * pb, Session * sn, Request * rq); + +NSAPI_PUBLIC void jk_term(void *p); + +NSAPI_PUBLIC int jk_service(pblock * pb, Session * sn, Request * rq); + +static int init_ws_service(nsapi_private_data_t * private_data, + jk_ws_service_t *s); + +static int setup_http_headers(nsapi_private_data_t * private_data, + jk_ws_service_t *s); + +static void init_workers_on_other_threads(void *init_d) +{ + init_map = (jk_map_t *)init_d; + /* we add the URI->WORKER MAP since workers using AJP14 will feed it */ + /* but where are they here in Netscape ? */ + if (uri_worker_map_alloc(&uw_map, NULL, logger)) { + uw_map->fname = ""; + uw_map->reload = JK_URIMAP_DEF_RELOAD; + uw_map->reject_unsafe = jk_map_get_bool(init_map, "worker." REJECT_UNSAFE_TAG, JK_FALSE); + worker_env.uri_to_worker = uw_map; + worker_env.pool = NULL; + + if (wc_open(init_map, &worker_env, logger)) { + init_on_other_thread_is_ok = JK_TRUE; + uri_worker_map_ext(uw_map, logger); + uri_worker_map_switch(uw_map, logger); + } + else { + jk_log(logger, JK_LOG_EMERG, + "In init_workers_on_other_threads, failed"); + } + } + else { + jk_log(logger, JK_LOG_EMERG, + "In init_workers_on_other_threads, failed"); + } + + init_on_other_thread_is_done = JK_TRUE; +} + +/* + * Convert string to lower case. + * If string is longer than the provided buffer, + * just return the original string. + */ +static const char *to_lower(const char *str, char *buf, int bufsz) +{ + const char *from = str; + char *to = buf; + char *end = buf + (bufsz - 1); + while (to != end && *from) { + *to = (char)tolower(*from); + to++; + from++; + } + if (to != end) { + *to = '\0'; + return buf; + } + return str; +} + +static int JK_METHOD start_response(jk_ws_service_t *s, + int status, + const char *reason, + const char *const *header_names, + const char *const *header_values, + unsigned num_of_headers) +{ + if (s && s->ws_private) { + nsapi_private_data_t *p = s->ws_private; + if (!s->response_started) { + unsigned i; + + s->response_started = JK_TRUE; + + /* Remove "old" content type */ + param_free(pblock_remove("content-type", p->rq->srvhdrs)); + + if (num_of_headers) { + /* + * NSAPI expects http header names to be lower case. + * This is only relevant for the server itself or other + * plugins searching for headers in the pblock. + * We use a buffer of limited length, because conforming + * with this rule should only matter for well-known headers. + */ + char name_buf[64]; + for (i = 0; i < (int)num_of_headers; i++) { + pblock_nvinsert(to_lower(header_names[i], name_buf, 64), + header_values[i], p->rq->srvhdrs); + } + } + else { + pblock_nvinsert("content-type", "text/plain", p->rq->srvhdrs); + } + + protocol_status(p->sn, p->rq, status, (char *)reason); + + protocol_start_response(p->sn, p->rq); + } + return JK_TRUE; + + } + return JK_FALSE; +} + +static int JK_METHOD ws_read(jk_ws_service_t *s, + void *b, unsigned l, unsigned *a) +{ + if (s && s->ws_private && b && a) { + nsapi_private_data_t *p = s->ws_private; + + *a = 0; + if (l) { + unsigned i; + netbuf *inbuf = p->sn->inbuf; + +/* Until we get a service pack for NW5.1 and earlier that has the latest */ +/* Enterprise Server, we have to go through the else version of this code*/ +#if defined(netbuf_getbytes) && !defined(NETWARE) + i = netbuf_getbytes(inbuf, b, l); + if (NETBUF_EOF == i || NETBUF_ERROR == i) { + return JK_FALSE; + } + +#else + char *buf = b; + int ch; + for (i = 0; i < l; i++) { + ch = netbuf_getc(inbuf); + /* + * IO_EOF is 0 (zero) which is a very reasonable byte + * when it comes to binary data. So we are not breaking + * out of the read loop when reading it. + * + * We are protected from an infinit loop by the Java part of + * Tomcat. + */ + if (IO_ERROR == ch) { + break; + } + + buf[i] = ch; + } + + if (0 == i) { + return JK_FALSE; + } +#endif + *a = i; + + } + return JK_TRUE; + } + return JK_FALSE; +} + +static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l) +{ + if (s && s->ws_private && b) { + nsapi_private_data_t *p = s->ws_private; + + if (l) { + if (!s->response_started) { + start_response(s, 200, NULL, NULL, NULL, 0); + } + + if (net_write(p->sn->csd, (char *)b, (int)l) == IO_ERROR) { + return JK_FALSE; + } + } + + return JK_TRUE; + + } + return JK_FALSE; +} + +NSAPI_PUBLIC int jk_init(pblock * pb, Session * sn, Request * rq) +{ + char *worker_prp_file = pblock_findval(JK_WORKER_FILE_TAG, pb); + char *log_level_str = pblock_findval(JK_LOG_LEVEL_TAG, pb); + char *log_file = pblock_findval(JK_LOG_FILE_TAG, pb); + char *shm_file = pblock_findval(JK_SHM_FILE_TAG, pb); + char *shm_file_safe = ""; + char *reject_unsafe = pblock_findval(REJECT_UNSAFE_TAG, pb); + + int rc = REQ_ABORTED; + + if (!worker_prp_file) { + worker_prp_file = JK_WORKER_FILE_DEF; + } + + if (!log_level_str) { + log_level_str = JK_LOG_DEF_VERB; + } + + if (!log_file) { + fprintf(stderr, + "Missing attribute %s in magnus.conf (jk_init) - aborting!\n", JK_LOG_FILE_TAG); + return rc; + } + + if (shm_file) { + shm_file_safe = shm_file; + } +#if !defined(WIN32) && !defined(NETWARE) + else { + fprintf(stderr, + "Missing attribute %s in magnus.conf (jk_init) - aborting!\n", JK_SHM_FILE_TAG); + return rc; + } +#endif + + fprintf(stderr, + "In jk_init.\n Worker file = %s.\n Log level = %s.\n Log File = %s\n SHM File = %s\n", + worker_prp_file, log_level_str, log_file, shm_file); + + if (!jk_open_file_logger(&logger, log_file, + jk_parse_log_level(log_level_str))) { + logger = NULL; + } + + if (jk_map_alloc(&init_map)) { + if (jk_map_read_properties(init_map, NULL, worker_prp_file, NULL, + JK_MAP_HANDLE_DUPLICATES, logger)) { + int rv; + int sleep_cnt; + SYS_THREAD s; + + if (jk_map_resolve_references(init_map, "worker.", 1, 1, logger) == JK_FALSE) { + jk_log(logger, JK_LOG_ERROR, "Error in resolving configuration references"); + } + + if (reject_unsafe) { + jk_map_add(init_map, "worker." REJECT_UNSAFE_TAG, reject_unsafe); + } + + jk_shm_size = jk_shm_calculate_size(init_map, logger); + if ((rv = jk_shm_open(shm_file, jk_shm_size, logger)) != 0) + jk_log(logger, JK_LOG_ERROR, + "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", + jk_shm_name(), rv); + + s = systhread_start(SYSTHREAD_DEFAULT_PRIORITY, + 0, init_workers_on_other_threads, init_map); + for (sleep_cnt = 0; sleep_cnt < 60; sleep_cnt++) { + systhread_sleep(1000); + jk_log(logger, JK_LOG_DEBUG, "jk_init, a second passed"); + if (init_on_other_thread_is_done) { + break; + } + } + + if (init_on_other_thread_is_done && init_on_other_thread_is_ok) { + magnus_atrestart(jk_term, NULL); + rc = REQ_PROCEED; + jk_log(logger, JK_LOG_INFO, "%s initialized", JK_FULL_EXPOSED_VERSION); + } + +/* if(wc_open(init_map, NULL, logger)) { + magnus_atrestart(jk_term, NULL); + rc = REQ_PROCEED; + } +*/ + } + } + +#ifdef NETWARE + PR_IsSocketSecure = + (int (*)(void **))ImportSymbol(GetNLMHandle(), "PR_IsSocketSecure"); +#endif + return rc; +} + +NSAPI_PUBLIC void jk_term(void *p) +{ +#ifdef NETWARE + if (NULL != PR_IsSocketSecure) { + UnimportSymbol(GetNLMHandle(), "PR_IsSocketSecure"); + PR_IsSocketSecure = NULL; + } +#endif + if (uw_map) { + uri_worker_map_free(&uw_map, logger); + } + + if (init_map) { + jk_map_free(&init_map); + } + + wc_close(logger); + jk_shm_close(); + if (logger) { + jk_close_file_logger(&logger); + } +} + +NSAPI_PUBLIC int jk_service(pblock * pb, Session * sn, Request * rq) +{ + char *worker_name = pblock_findval(JK_WORKER_NAME_TAG, pb); + char *uri_pattern = pblock_findval(URI_PATTERN, pb); + jk_worker_t *worker; + int rc = REQ_ABORTED; + + if (uri_pattern) { + char *uri = pblock_findval("uri", rq->reqpb); + + if (0 != shexp_match(uri, uri_pattern)) { + return REQ_NOACTION; + } + } + + if (!worker_name) { + worker_name = DEFAULT_WORKER_NAME; + } + + worker = wc_get_worker_for_name(worker_name, logger); + if (worker) { + nsapi_private_data_t private_data; + jk_ws_service_t s; + jk_pool_atom_t buf[SMALL_POOL_SIZE]; + + jk_open_pool(&private_data.p, buf, sizeof(buf)); + + private_data.pb = pb; + private_data.sn = sn; + private_data.rq = rq; + + jk_init_ws_service(&s); + + s.ws_private = &private_data; + s.pool = &private_data.p; + + wc_maintain(logger); + if (init_ws_service(&private_data, &s)) { + jk_endpoint_t *e = NULL; + if (worker->get_endpoint(worker, &e, logger)) { + int is_error = JK_HTTP_SERVER_ERROR; + int result; + if ((result = e->service(e, &s, logger, &is_error)) > 0) { + rc = REQ_PROCEED; + if (JK_IS_DEBUG_LEVEL(logger)) + jk_log(logger, JK_LOG_DEBUG, + "service() returned OK"); + } + else { + protocol_status(sn, rq, is_error, NULL); + if ((result == JK_CLIENT_ERROR) && (is_error == JK_HTTP_OK)) { + rc = REQ_EXIT; + jk_log(logger, JK_LOG_INFO, + "service() failed because client aborted connection"); + } + else { + rc = REQ_ABORTED; + jk_log(logger, JK_LOG_ERROR, + "service() failed with http error %d", is_error); + } + } + + e->done(&e, logger); + } + } + jk_close_pool(&private_data.p); + } + + return rc; +} + +static int init_ws_service(nsapi_private_data_t * private_data, + jk_ws_service_t *s) +{ + char *tmp; + int size; + int rc; + + s->start_response = start_response; + s->read = ws_read; + s->write = ws_write; + + s->auth_type = pblock_findval("auth-type", private_data->rq->vars); + s->remote_user = pblock_findval("auth-user", private_data->rq->vars); + + tmp = NULL; + rc = request_header("content-length", + &tmp, private_data->sn, private_data->rq); + + if ((rc != REQ_ABORTED) && tmp) { + sscanf(tmp, "%" JK_UINT64_T_FMT, &(s->content_length)); + } + + s->method = pblock_findval("method", private_data->rq->reqpb); + s->protocol = pblock_findval("protocol", private_data->rq->reqpb); + + s->remote_host = session_dns(private_data->sn); + s->remote_addr = pblock_findval("ip", private_data->sn->client); + /* Remote port is not available from NSAPI. */ + s->remote_port = "0"; + + tmp = pblock_findval("uri", private_data->rq->reqpb); + size = 3 * strlen(tmp) + 1; + s->req_uri = jk_pool_alloc(s->pool, size); + jk_canonenc(tmp, s->req_uri, size); + + s->query_string = pblock_findval("query", private_data->rq->reqpb); + + s->server_name = server_hostname; + +#ifdef NETWARE + /* On NetWare, since we have virtual servers, we have a different way of + * getting the port that we need to try first. + */ + tmp = pblock_findval("server_port", private_data->sn->client); + if (NULL != tmp) + s->server_port = atoi(tmp); + else +#endif + s->server_port = server_portnum; + s->server_software = system_version(); + + s->uw_map = uw_map; + +#ifdef NETWARE + /* on NetWare, we can have virtual servers that are secure. + * PR_IsSocketSecure is an api made available with virtual servers to check + * if the socket is secure or not + */ + if (NULL != PR_IsSocketSecure) + s->is_ssl = PR_IsSocketSecure(private_data->sn->csd); + else +#endif + s->is_ssl = security_active; + + if (s->is_ssl) { + char *ssl_cert = pblock_findval("auth-cert", private_data->rq->vars); + if (ssl_cert != NULL) { + s->ssl_cert = jk_pool_alloc(s->pool, sizeof(ssl_cert_start)+ + strlen(ssl_cert)+ + sizeof(ssl_cert_end)); + strcpy(s->ssl_cert, ssl_cert_start); + strcat(s->ssl_cert, ssl_cert); + strcat(s->ssl_cert, ssl_cert_end); + s->ssl_cert_len = strlen(s->ssl_cert); + } + s->ssl_cipher = pblock_findval("cipher", private_data->sn->client); + s->ssl_session = pblock_findval("ssl-id", private_data->sn->client); + /* XXX: We need to investigate how to set s->ssl_key_size */ + } + + rc = setup_http_headers(private_data, s); + + /* Dump all connection param so we can trace what's going to + * the remote tomcat + */ + if (JK_IS_DEBUG_LEVEL(logger)) { + jk_log(logger, JK_LOG_DEBUG, + "Service protocol=%s method=%s host=%s addr=%s name=%s port=%d auth=%s user=%s uri=%s", + STRNULL_FOR_NULL(s->protocol), + STRNULL_FOR_NULL(s->method), + STRNULL_FOR_NULL(s->remote_host), + STRNULL_FOR_NULL(s->remote_addr), + STRNULL_FOR_NULL(s->server_name), + s->server_port, + STRNULL_FOR_NULL(s->auth_type), + STRNULL_FOR_NULL(s->remote_user), + STRNULL_FOR_NULL(s->req_uri)); + } + + return rc; + +} + +static int setup_http_headers(nsapi_private_data_t * private_data, + jk_ws_service_t *s) +{ + int need_content_length_header = + (s->content_length == 0) ? JK_TRUE : JK_FALSE; + + pblock *headers_jar = private_data->rq->headers; + int cnt; + int i; + + for (i = 0, cnt = 0; i < headers_jar->hsize; i++) { + struct pb_entry *h = headers_jar->ht[i]; + while (h && h->param) { + cnt++; + h = h->next; + } + } + + s->headers_names = NULL; + s->headers_values = NULL; + s->num_headers = cnt; + if (cnt) { + /* allocate an extra header slot in case we need to add a content-length header */ + s->headers_names = + jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char *)); + s->headers_values = + jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char *)); + + if (s->headers_names && s->headers_values) { + for (i = 0, cnt = 0; i < headers_jar->hsize; i++) { + struct pb_entry *h = headers_jar->ht[i]; + while (h && h->param) { + s->headers_names[cnt] = h->param->name; + s->headers_values[cnt] = h->param->value; + if (need_content_length_header && + !strncmp(h->param->name, "content-length", 14)) { + need_content_length_header = JK_FALSE; + } + cnt++; + h = h->next; + } + } + /* Add a content-length = 0 header if needed. + * Ajp13 assumes an absent content-length header means an unknown, + * but non-zero length body. + */ + if (need_content_length_header) { + s->headers_names[cnt] = "content-length"; + s->headers_values[cnt] = "0"; + cnt++; + } + s->num_headers = cnt; + return JK_TRUE; + } + } + else { + if (need_content_length_header) { + s->headers_names = + jk_pool_alloc(&private_data->p, sizeof(char *)); + s->headers_values = + jk_pool_alloc(&private_data->p, sizeof(char *)); + if (s->headers_names && s->headers_values) { + s->headers_names[0] = "content-length"; + s->headers_values[0] = "0"; + s->num_headers++; + return JK_TRUE; + } + } + else + return JK_TRUE; + } + + return JK_FALSE; +} diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/nsapi.dsp b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/nsapi.dsp new file mode 100644 index 00000000..561dbbc7 --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/native/netscape/nsapi.dsp @@ -0,0 +1,283 @@ +# Microsoft Developer Studio Project File - Name="nsapi" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=nsapi - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "nsapi.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nsapi.mak" CFG="nsapi - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nsapi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "nsapi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "nsapi - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "nsapi_release" +# PROP Intermediate_Dir "nsapi_release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JK_NSAPI" /D "NSAPI_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O2 /I "..\common" /I "$(IPLANET_HOME)\plugins\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JK_NSAPI" /D "NSAPI_EXPORTS" /D "XP_WIN32" /D "MCC_HTTPD" /D "SPAPI20" /Fd"Release/nsapi_redirect_src" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# 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 /nologo /dll /machine:I386 +# ADD LINK32 ns-httpd40.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x6A6B0000" /dll /debug /machine:I386 /out:"nsapi_release/nsapi_redirect.dll" /libpath:"$(IPLANET_HOME)\plugins\lib" + +!ELSEIF "$(CFG)" == "nsapi - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "nsapi___Win32_Debug" +# PROP BASE Intermediate_Dir "nsapi___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "nsapi_debug" +# PROP Intermediate_Dir "nsapi_debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JK_NSAPI" /D "NSAPI_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\common" /I "$(IPLANET_HOME)\plugins\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JK_NSAPI" /D "NSAPI_EXPORTS" /D "XP_WIN32" /D "MCC_HTTPD" /D "SPAPI20" /Fd"Debug/nsapi_redirect_src" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ns-httpd40.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x6A6B0000" /dll /debug /machine:I386 /out:"nsapi_debug/nsapi_redirect.dll" /pdbtype:sept /libpath:"$(IPLANET_HOME)\plugins\lib" + +!ENDIF + +# Begin Target + +# Name "nsapi - Win32 Release" +# Name "nsapi - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\common\jk_ajp12_worker.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp13.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp13_worker.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp14.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp14_worker.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp_common.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_connect.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_context.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_jni_worker.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_lb_worker.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_map.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_md5.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_msg_buff.c +# End Source File +# Begin Source File + +SOURCE=.\jk_nsapi_plugin.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_pool.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_shm.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_sockbuf.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_status.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_uri_worker_map.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_url.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_util.c +# End Source File +# Begin Source File + +SOURCE=..\common\jk_worker.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\common\jk_ajp13.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp13_worker.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp14.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp14_worker.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_ajp_common.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_connect.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_context.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_global.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_jni_worker.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_lb_worker.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_logger.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_map.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_md5.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_msg_buff.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_mt.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_pool.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_service.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_shm.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_status.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_uri_worker_map.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_url.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_util.h +# End Source File +# Begin Source File + +SOURCE=..\common\jk_worker.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project -- cgit 1.2.3-korg