summaryrefslogtreecommitdiffstats
path: root/rubbos/app/httpd-2.0.64/modules/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'rubbos/app/httpd-2.0.64/modules/metadata')
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.deps0
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.indent.pro54
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.abin0 -> 37500 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.la35
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.obin0 -> 37352 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.abin0 -> 55920 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.la35
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.obin0 -> 55768 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/Makefile8
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/Makefile.in3
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUcernmeta248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUexpires248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUheaders248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmakefile252
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmimemagi248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmodversion248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUuniqueid254
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/NWGNUusertrk248
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/config.m424
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.c372
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.c179
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.la35
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_env.obin0 -> 37352 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.c566
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.c620
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.c2477
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.c586
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.la35
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.obin0 -> 55768 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.c367
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.c454
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_version.c312
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_version.dsp128
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/mod_version.exp1
-rw-r--r--rubbos/app/httpd-2.0.64/modules/metadata/modules.mk7
53 files changed, 9348 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.deps b/rubbos/app/httpd-2.0.64/modules/metadata/.deps
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.deps
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.indent.pro b/rubbos/app/httpd-2.0.64/modules/metadata/.indent.pro
new file mode 100644
index 00000000..a9fbe9f9
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.indent.pro
@@ -0,0 +1,54 @@
+-i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1
+-TBUFF
+-TFILE
+-TTRANS
+-TUINT4
+-T_trans
+-Tallow_options_t
+-Tapache_sfio
+-Tarray_header
+-Tbool_int
+-Tbuf_area
+-Tbuff_struct
+-Tbuffy
+-Tcmd_how
+-Tcmd_parms
+-Tcommand_rec
+-Tcommand_struct
+-Tconn_rec
+-Tcore_dir_config
+-Tcore_server_config
+-Tdir_maker_func
+-Tevent
+-Tglobals_s
+-Thandler_func
+-Thandler_rec
+-Tjoblist_s
+-Tlisten_rec
+-Tmerger_func
+-Tmode_t
+-Tmodule
+-Tmodule_struct
+-Tmutex
+-Tn_long
+-Tother_child_rec
+-Toverrides_t
+-Tparent_score
+-Tpid_t
+-Tpiped_log
+-Tpool
+-Trequest_rec
+-Trequire_line
+-Trlim_t
+-Tscoreboard
+-Tsemaphore
+-Tserver_addr_rec
+-Tserver_rec
+-Tserver_rec_chain
+-Tshort_score
+-Ttable
+-Ttable_entry
+-Tthread
+-Tu_wide_int
+-Tvtime_t
+-Twide_int
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.a b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.a
new file mode 100644
index 00000000..7b9b9591
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.a
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.la b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.la
new file mode 100644
index 00000000..80d73dfa
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.la
@@ -0,0 +1,35 @@
+# mod_env.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='mod_env.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib'
+
+# Version information for mod_env.
+current=
+age=
+revision=
+
+# Is this an already installed library?
+installed=no
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir=''
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.o b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.o
new file mode 100644
index 00000000..b98d9d62
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_env.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.a b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.a
new file mode 100644
index 00000000..6e6c84b6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.a
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.la b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.la
new file mode 100644
index 00000000..6562d1dc
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.la
@@ -0,0 +1,35 @@
+# mod_setenvif.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='mod_setenvif.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib'
+
+# Version information for mod_setenvif.
+current=
+age=
+revision=
+
+# Is this an already installed library?
+installed=no
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir=''
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.o b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.o
new file mode 100644
index 00000000..0f0fee97
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/.libs/mod_setenvif.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/Makefile b/rubbos/app/httpd-2.0.64/modules/metadata/Makefile
new file mode 100644
index 00000000..d90900c2
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/Makefile
@@ -0,0 +1,8 @@
+top_srcdir = /bottlenecks/rubbos/app/httpd-2.0.64
+top_builddir = /bottlenecks/rubbos/app/httpd-2.0.64
+srcdir = /bottlenecks/rubbos/app/httpd-2.0.64/modules/metadata
+builddir = /bottlenecks/rubbos/app/httpd-2.0.64/modules/metadata
+VPATH = /bottlenecks/rubbos/app/httpd-2.0.64/modules/metadata
+
+include $(top_srcdir)/build/special.mk
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/Makefile.in b/rubbos/app/httpd-2.0.64/modules/metadata/Makefile.in
new file mode 100644
index 00000000..167b343d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/Makefile.in
@@ -0,0 +1,3 @@
+
+include $(top_srcdir)/build/special.mk
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUcernmeta b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUcernmeta
new file mode 100644
index 00000000..9a642677
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUcernmeta
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = cernmeta
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) CERN Meta Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = CERN Meta Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/cernmeta.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_cern_meta.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ cern_meta_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUexpires b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUexpires
new file mode 100644
index 00000000..eacc10eb
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUexpires
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = expires
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) Expires Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = Expires Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/expires.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_expires.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ expires_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUheaders b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUheaders
new file mode 100644
index 00000000..def6d703
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUheaders
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = headers
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) Headers Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = Headers Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/headers.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_headers.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ headers_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmakefile b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmakefile
new file mode 100644
index 00000000..fe1ecf21
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmakefile
@@ -0,0 +1,252 @@
+#
+# Declare the sub-directories to be built here
+#
+
+SUBDIRS = \
+ $(EOLIST)
+
+#
+# Get the 'head' of the build environment. This includes default targets and
+# paths to tools
+#
+
+include $(AP_WORK)\build\NWGNUhead.inc
+
+#
+# build this level's files
+
+#
+# Make sure all needed macro's are defined
+#
+
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME =
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION =
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME =
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE =
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM =
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM =
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS =
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/cernmeta.nlm \
+ $(OBJDIR)/expires.nlm \
+ $(OBJDIR)/headers.nlm \
+ $(OBJDIR)/mimemagi.nlm \
+ $(OBJDIR)/uniqueid.nlm \
+ $(OBJDIR)/usertrk.nlm \
+ $(OBJDIR)/modversion.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+ copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.*
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmimemagi b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmimemagi
new file mode 100644
index 00000000..c2aa84da
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmimemagi
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = mimemagi
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) Mime Magic Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = CERN Meta Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/mimemagi.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_mime_magic.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ mime_magic_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmodversion b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmodversion
new file mode 100644
index 00000000..fdece687
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUmodversion
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = modversion
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) Version Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = Version Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/$(NLM_NAME).nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_version.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ version_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUuniqueid b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUuniqueid
new file mode 100644
index 00000000..02917f5b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUuniqueid
@@ -0,0 +1,254 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = uniqueid
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) Unique ID Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = Unique ID Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/uniqueid.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_unique_id.o \
+ $(OBJDIR)/libprews.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ @ws2nlm.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ unique_id_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+$(OBJDIR)/%.o: ../arch/netware/%.c $(OBJDIR)\$(NLM_NAME)_cc.opt
+ @echo compiling $<
+ $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\$(NLM_NAME)_cc.opt
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUusertrk b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUusertrk
new file mode 100644
index 00000000..49ee8f84
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/NWGNUusertrk
@@ -0,0 +1,248 @@
+#
+# Make sure all needed macro's are defined
+#
+
+#
+# Get the 'head' of the build environment if necessary. This includes default
+# targets and paths to tools
+#
+
+ifndef EnvironmentDefined
+include $(AP_WORK)\build\NWGNUhead.inc
+endif
+
+#
+# These directories will be at the beginning of the include list, followed by
+# INCDIRS
+#
+XINCDIRS += \
+ $(APR)/include \
+ $(APRUTIL)/include \
+ $(AP_WORK)/include \
+ $(NWOS) \
+ $(EOLIST)
+
+#
+# These flags will come after CFLAGS
+#
+XCFLAGS += \
+ $(EOLIST)
+
+#
+# These defines will come after DEFINES
+#
+XDEFINES += \
+ $(EOLIST)
+
+#
+# These flags will be added to the link.opt file
+#
+XLFLAGS += \
+ $(EOLIST)
+
+#
+# These values will be appended to the correct variables based on the value of
+# RELEASE
+#
+ifeq "$(RELEASE)" "debug"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "noopt"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+ifeq "$(RELEASE)" "release"
+XINCDIRS += \
+ $(EOLIST)
+
+XCFLAGS += \
+ $(EOLIST)
+
+XDEFINES += \
+ $(EOLIST)
+
+XLFLAGS += \
+ $(EOLIST)
+endif
+
+#
+# These are used by the link target if an NLM is being generated
+# This is used by the link 'name' directive to name the nlm. If left blank
+# TARGET_nlm (see below) will be used.
+#
+NLM_NAME = usertrk
+
+#
+# This is used by the link '-desc ' directive.
+# If left blank, NLM_NAME will be used.
+#
+NLM_DESCRIPTION = Apache $(VERSION_STR) User Track Module
+
+#
+# This is used by the '-threadname' directive. If left blank,
+# NLM_NAME Thread will be used.
+#
+NLM_THREAD_NAME = User Track Module
+
+#
+# If this is specified, it will override VERSION value in
+# $(AP_WORK)\build\NWGNUenvironment.inc
+#
+NLM_VERSION =
+
+#
+# If this is specified, it will override the default of 64K
+#
+NLM_STACK_SIZE = 8192
+
+
+#
+# If this is specified it will be used by the link '-entry' directive
+#
+NLM_ENTRY_SYM = _LibCPrelude
+
+#
+# If this is specified it will be used by the link '-exit' directive
+#
+NLM_EXIT_SYM = _LibCPostlude
+
+#
+# If this is specified it will be used by the link '-check' directive
+#
+NLM_CHECK_SYM =
+
+#
+# If these are specified it will be used by the link '-flags' directive
+#
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
+
+#
+# If this is specified it will be linked in with the XDCData option in the def
+# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
+# by setting APACHE_UNIPROC in the environment
+#
+XDCDATA =
+
+#
+# If there is an NLM target, put it here
+#
+TARGET_nlm = \
+ $(OBJDIR)/usertrk.nlm \
+ $(EOLIST)
+
+#
+# If there is an LIB target, put it here
+#
+TARGET_lib = \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the NLM target above.
+# Paths must all use the '/' character
+#
+FILES_nlm_objs = \
+ $(OBJDIR)/mod_usertrack.o \
+ $(EOLIST)
+
+#
+# These are the LIB files needed to create the NLM target above.
+# These will be added as a library command in the link.opt file.
+#
+FILES_nlm_libs = \
+ libcpre.o \
+ $(EOLIST)
+
+#
+# These are the modules that the above NLM target depends on to load.
+# These will be added as a module command in the link.opt file.
+#
+FILES_nlm_modules = \
+ aprlib \
+ libc \
+ $(EOLIST)
+
+#
+# If the nlm has a msg file, put it's path here
+#
+FILE_nlm_msg =
+
+#
+# If the nlm has a hlp file put it's path here
+#
+FILE_nlm_hlp =
+
+#
+# If this is specified, it will override $(NWOS)\copyright.txt.
+#
+FILE_nlm_copyright =
+
+#
+# Any additional imports go here
+#
+FILES_nlm_Ximports = \
+ @$(APR)/aprlib.imp \
+ @$(NWOS)/httpd.imp \
+ @libc.imp \
+ $(EOLIST)
+
+#
+# Any symbols exported to here
+#
+FILES_nlm_exports = \
+ usertrack_module \
+ $(EOLIST)
+
+#
+# These are the OBJ files needed to create the LIB target above.
+# Paths must all use the '/' character
+#
+FILES_lib_objs = \
+ $(EOLIST)
+
+#
+# implement targets and dependancies (leave this section alone)
+#
+
+libs :: $(OBJDIR) $(TARGET_lib)
+
+nlms :: libs $(TARGET_nlm)
+
+#
+# Updated this target to create necessary directories and copy files to the
+# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples)
+#
+install :: nlms FORCE
+
+#
+# Any specialized rules here
+#
+
+#
+# Include the 'tail' makefile that has targets that depend on variables defined
+# in this makefile
+#
+
+include $(AP_WORK)\build\NWGNUtail.inc
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/config.m4 b/rubbos/app/httpd-2.0.64/modules/metadata/config.m4
new file mode 100644
index 00000000..3fc1b2ce
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/config.m4
@@ -0,0 +1,24 @@
+dnl modules enabled in this directory by default
+
+dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
+
+APACHE_MODPATH_INIT(metadata)
+
+APACHE_MODULE(env, clearing/setting of ENV vars, , , yes)
+APACHE_MODULE(mime_magic, automagically determining MIME type)
+APACHE_MODULE(cern_meta, CERN-type meta files)
+APACHE_MODULE(expires, Expires header control, , , most)
+APACHE_MODULE(headers, HTTP header control, , , most)
+
+APACHE_MODULE(usertrack, user-session tracking, , , , [
+ AC_CHECK_HEADERS(sys/times.h)
+ AC_CHECK_FUNCS(times)
+])
+
+APACHE_MODULE(unique_id, per-request unique ids)
+APACHE_MODULE(setenvif, basing ENV vars on headers, , , yes)
+APACHE_MODULE(version, determining httpd version in config files)
+
+APR_ADDTO(LT_LDFLAGS,-export-dynamic)
+
+APACHE_MODPATH_FINISH
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.c
new file mode 100644
index 00000000..18bf1c0b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.c
@@ -0,0 +1,372 @@
+/* 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.
+ */
+
+/*
+ * mod_cern_meta.c
+ * version 0.1.0
+ * status beta
+ *
+ * Andrew Wilson <Andrew.Wilson@cm.cf.ac.uk> 25.Jan.96
+ *
+ * *** IMPORTANT ***
+ * This version of mod_cern_meta.c controls Meta File behaviour on a
+ * per-directory basis. Previous versions of the module defined behaviour
+ * on a per-server basis. The upshot is that you'll need to revisit your
+ * configuration files in order to make use of the new module.
+ * ***
+ *
+ * Emulate the CERN HTTPD Meta file semantics. Meta files are HTTP
+ * headers that can be output in addition to the normal range of
+ * headers for each file accessed. They appear rather like the Apache
+ * .asis files, and are able to provide a crude way of influencing
+ * the Expires: header, as well as providing other curiosities.
+ * There are many ways to manage meta information, this one was
+ * chosen because there is already a large number of CERN users
+ * who can exploit this module. It should be noted that there are probably
+ * more sensitive ways of managing the Expires: header specifically.
+ *
+ * The module obeys the following directives, which can appear
+ * in the server's .conf files and in .htaccess files.
+ *
+ * MetaFiles <on|off>
+ *
+ * turns on|off meta file processing for any directory.
+ * Default value is off
+ *
+ * # turn on MetaFiles in this directory
+ * MetaFiles on
+ *
+ * MetaDir <directory name>
+ *
+ * specifies the name of the directory in which Apache can find
+ * meta information files. The directory is usually a 'hidden'
+ * subdirectory of the directory that contains the file being
+ * accessed. eg:
+ *
+ * # .meta files are in the *same* directory as the
+ * # file being accessed
+ * MetaDir .
+ *
+ * the default is to look in a '.web' subdirectory. This is the
+ * same as for CERN 3.+ webservers and behaviour is the same as
+ * for the directive:
+ *
+ * MetaDir .web
+ *
+ * MetaSuffix <meta file suffix>
+ *
+ * specifies the file name suffix for the file containing the
+ * meta information. eg:
+ *
+ * # our meta files are suffixed with '.cern_meta'
+ * MetaSuffix .cern_meta
+ *
+ * the default is to look for files with the suffix '.meta'. This
+ * behaviour is the same as for the directive:
+ *
+ * MetaSuffix .meta
+ *
+ * When accessing the file
+ *
+ * DOCUMENT_ROOT/somedir/index.html
+ *
+ * this module will look for the file
+ *
+ * DOCUMENT_ROOT/somedir/.web/index.html.meta
+ *
+ * and will use its contents to generate additional MIME header
+ * information.
+ *
+ * For more information on the CERN Meta file semantics see:
+ *
+ * http://www.w3.org/hypertext/WWW/Daemon/User/Config/General.html#MetaDir
+ *
+ * Change-log:
+ * 29.Jan.96 pfopen/pfclose instead of fopen/fclose
+ * DECLINE when real file not found, we may be checking each
+ * of the index.html/index.shtml/index.htm variants and don't
+ * need to report missing ones as spurious errors.
+ * 31.Jan.96 log_error reports about a malformed .meta file, rather
+ * than a script error.
+ * 20.Jun.96 MetaFiles <on|off> default off, added, so that module
+ * can be configured per-directory. Prior to this the module
+ * was running for each request anywhere on the server, naughty..
+ * 29.Jun.96 All directives made per-directory.
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#if APR_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_config.h"
+#include "util_script.h"
+#include "http_log.h"
+#include "http_request.h"
+#include "http_protocol.h"
+#include "apr_lib.h"
+
+#define DIR_CMD_PERMS OR_INDEXES
+
+#define DEFAULT_METADIR ".web"
+#define DEFAULT_METASUFFIX ".meta"
+#define DEFAULT_METAFILES 0
+
+module AP_MODULE_DECLARE_DATA cern_meta_module;
+
+typedef struct {
+ const char *metadir;
+ const char *metasuffix;
+ int metafiles;
+} cern_meta_dir_config;
+
+static void *create_cern_meta_dir_config(apr_pool_t *p, char *dummy)
+{
+ cern_meta_dir_config *new =
+ (cern_meta_dir_config *) apr_palloc(p, sizeof(cern_meta_dir_config));
+
+ new->metadir = NULL;
+ new->metasuffix = NULL;
+ new->metafiles = DEFAULT_METAFILES;
+
+ return new;
+}
+
+static void *merge_cern_meta_dir_configs(apr_pool_t *p, void *basev, void *addv)
+{
+ cern_meta_dir_config *base = (cern_meta_dir_config *) basev;
+ cern_meta_dir_config *add = (cern_meta_dir_config *) addv;
+ cern_meta_dir_config *new =
+ (cern_meta_dir_config *) apr_palloc(p, sizeof(cern_meta_dir_config));
+
+ new->metadir = add->metadir ? add->metadir : base->metadir;
+ new->metasuffix = add->metasuffix ? add->metasuffix : base->metasuffix;
+ new->metafiles = add->metafiles;
+
+ return new;
+}
+
+static const char *set_metadir(cmd_parms *parms, void *in_dconf, const char *arg)
+{
+ cern_meta_dir_config *dconf = in_dconf;
+
+ dconf->metadir = arg;
+ return NULL;
+}
+
+static const char *set_metasuffix(cmd_parms *parms, void *in_dconf, const char *arg)
+{
+ cern_meta_dir_config *dconf = in_dconf;
+
+ dconf->metasuffix = arg;
+ return NULL;
+}
+
+static const char *set_metafiles(cmd_parms *parms, void *in_dconf, int arg)
+{
+ cern_meta_dir_config *dconf = in_dconf;
+
+ dconf->metafiles = arg;
+ return NULL;
+}
+
+
+static const command_rec cern_meta_cmds[] =
+{
+ AP_INIT_FLAG("MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS,
+ "Limited to 'on' or 'off'"),
+ AP_INIT_TAKE1("MetaDir", set_metadir, NULL, DIR_CMD_PERMS,
+ "the name of the directory containing meta files"),
+ AP_INIT_TAKE1("MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS,
+ "the filename suffix for meta files"),
+ {NULL}
+};
+
+/* XXX: this is very similar to ap_scan_script_header_err_core...
+ * are the differences deliberate, or just a result of bit rot?
+ */
+static int scan_meta_file(request_rec *r, apr_file_t *f)
+{
+ char w[MAX_STRING_LEN];
+ char *l;
+ int p;
+ apr_table_t *tmp_headers;
+
+ tmp_headers = apr_table_make(r->pool, 5);
+ while (apr_file_gets(w, MAX_STRING_LEN - 1, f) == APR_SUCCESS) {
+
+ /* Delete terminal (CR?)LF */
+
+ p = strlen(w);
+ if (p > 0 && w[p - 1] == '\n') {
+ if (p > 1 && w[p - 2] == '\015')
+ w[p - 2] = '\0';
+ else
+ w[p - 1] = '\0';
+ }
+
+ if (w[0] == '\0') {
+ return OK;
+ }
+
+ /* if we see a bogus header don't ignore it. Shout and scream */
+
+ if (!(l = strchr(w, ':'))) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "malformed header in meta file: %s", r->filename);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ *l++ = '\0';
+ while (*l && apr_isspace(*l))
+ ++l;
+
+ if (!strcasecmp(w, "Content-type")) {
+ char *tmp;
+ /* Nuke trailing whitespace */
+
+ char *endp = l + strlen(l) - 1;
+ while (endp > l && apr_isspace(*endp))
+ *endp-- = '\0';
+
+ tmp = apr_pstrdup(r->pool, l);
+ ap_content_type_tolower(tmp);
+ ap_set_content_type(r, tmp);
+ }
+ else if (!strcasecmp(w, "Status")) {
+ sscanf(l, "%d", &r->status);
+ r->status_line = apr_pstrdup(r->pool, l);
+ }
+ else {
+ apr_table_set(tmp_headers, w, l);
+ }
+ }
+ apr_table_overlap(r->headers_out, tmp_headers, APR_OVERLAP_TABLES_SET);
+ return OK;
+}
+
+static int add_cern_meta_data(request_rec *r)
+{
+ char *metafilename;
+ char *leading_slash;
+ char *last_slash;
+ char *real_file;
+ char *scrap_book;
+ apr_file_t *f = NULL;
+ apr_status_t retcode;
+ cern_meta_dir_config *dconf;
+ int rv;
+ request_rec *rr;
+
+ dconf = ap_get_module_config(r->per_dir_config, &cern_meta_module);
+
+ if (!dconf->metafiles) {
+ return DECLINED;
+ };
+
+ /* if ./.web/$1.meta exists then output 'asis' */
+
+ if (r->finfo.filetype == 0) {
+ return DECLINED;
+ };
+
+ /* is this a directory? */
+ if (r->finfo.filetype == APR_DIR || r->uri[strlen(r->uri) - 1] == '/') {
+ return DECLINED;
+ };
+
+ /* what directory is this file in? */
+ scrap_book = apr_pstrdup(r->pool, r->filename);
+
+ leading_slash = strchr(scrap_book, '/');
+ last_slash = strrchr(scrap_book, '/');
+ if ((last_slash != NULL) && (last_slash != leading_slash)) {
+ /* skip over last slash */
+ real_file = last_slash;
+ real_file++;
+ *last_slash = '\0';
+ }
+ else {
+ /* no last slash, buh?! */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "internal error in mod_cern_meta: %s", r->filename);
+ /* should really barf, but hey, let's be friends... */
+ return DECLINED;
+ };
+
+ metafilename = apr_pstrcat(r->pool, scrap_book, "/",
+ dconf->metadir ? dconf->metadir : DEFAULT_METADIR,
+ "/", real_file,
+ dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX,
+ NULL);
+
+ /* It sucks to require this subrequest to complete, because this
+ * means people must leave their meta files accessible to the world.
+ * A better solution might be a "safe open" feature of pfopen to avoid
+ * pipes, symlinks, and crap like that.
+ *
+ * In fact, this doesn't suck. Because <Location > blocks are never run
+ * against sub_req_lookup_file, the meta can be somewhat protected by
+ * either masking it with a <Location > directive or alias, or stowing
+ * the file outside of the web document tree, while providing the
+ * appropriate directory blocks to allow access to it as a file.
+ */
+ rr = ap_sub_req_lookup_file(metafilename, r, NULL);
+ if (rr->status != HTTP_OK) {
+ ap_destroy_sub_req(rr);
+ return DECLINED;
+ }
+ ap_destroy_sub_req(rr);
+
+ retcode = apr_file_open(&f, metafilename, APR_READ, APR_OS_DEFAULT, r->pool);
+ if (retcode != APR_SUCCESS) {
+ if (APR_STATUS_IS_ENOENT(retcode)) {
+ return DECLINED;
+ }
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "meta file permissions deny server access: %s", metafilename);
+ return HTTP_FORBIDDEN;
+ };
+
+ /* read the headers in */
+ rv = scan_meta_file(r, f);
+ apr_file_close(f);
+
+ return rv;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_fixups(add_cern_meta_data,NULL,NULL,APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA cern_meta_module =
+{
+ STANDARD20_MODULE_STUFF,
+ create_cern_meta_dir_config,/* dir config creater */
+ merge_cern_meta_dir_configs,/* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ cern_meta_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.dsp
new file mode 100644
index 00000000..c50e9085
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_cern_meta" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_cern_meta - Win32 Release
+!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 "mod_cern_meta.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 "mod_cern_meta.mak" CFG="mod_cern_meta - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_cern_meta - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_cern_meta - 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)" == "mod_cern_meta - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_cern_meta_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_cern_meta.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_cern_meta.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_cern_meta - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_cern_meta_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_cern_meta.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_cern_meta.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_cern_meta - Win32 Release"
+# Name "mod_cern_meta - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_cern_meta.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_cern_meta.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_cern_meta - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_cern_meta.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_cern_meta.so "cern_meta_module for Apache" ../../include/ap_release.h > .\mod_cern_meta.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_cern_meta - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_cern_meta.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_cern_meta.so "cern_meta_module for Apache" ../../include/ap_release.h > .\mod_cern_meta.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.exp
new file mode 100644
index 00000000..d36e2be6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_cern_meta.exp
@@ -0,0 +1 @@
+cern_meta_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.c
new file mode 100644
index 00000000..9ce1ccbc
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.c
@@ -0,0 +1,179 @@
+/* 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.
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_config.h"
+#include "http_request.h"
+#include "http_log.h"
+
+typedef struct {
+ apr_table_t *vars;
+ apr_table_t *unsetenv;
+} env_dir_config_rec;
+
+module AP_MODULE_DECLARE_DATA env_module;
+
+static void *create_env_dir_config(apr_pool_t *p, char *dummy)
+{
+ env_dir_config_rec *conf = apr_palloc(p, sizeof(*conf));
+
+ conf->vars = apr_table_make(p, 10);
+ conf->unsetenv = apr_table_make(p, 10);
+
+ return conf;
+}
+
+static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv)
+{
+ env_dir_config_rec *base = basev;
+ env_dir_config_rec *add = addv;
+ env_dir_config_rec *res = apr_palloc(p, sizeof(*res));
+
+ const apr_table_entry_t *elts;
+ const apr_array_header_t *arr;
+
+ int i;
+
+ /*
+ * res->vars = copy_table( p, base->vars );
+ * foreach $unsetenv ( @add->unsetenv )
+ * table_unset( res->vars, $unsetenv );
+ * foreach $element ( @add->vars )
+ * table_set( res->vars, $element.key, $element.val );
+ *
+ * add->unsetenv already removed the vars from add->vars,
+ * if they preceeded the UnsetEnv directive.
+ */
+ res->vars = apr_table_copy(p, base->vars);
+ res->unsetenv = NULL;
+
+ arr = apr_table_elts(add->unsetenv);
+ if (arr) {
+ elts = (const apr_table_entry_t *)arr->elts;
+
+ for (i = 0; i < arr->nelts; ++i) {
+ apr_table_unset(res->vars, elts[i].key);
+ }
+ }
+
+ arr = apr_table_elts(add->vars);
+ if (arr) {
+ elts = (const apr_table_entry_t *)arr->elts;
+
+ for (i = 0; i < arr->nelts; ++i) {
+ apr_table_setn(res->vars, elts[i].key, elts[i].val);
+ }
+ }
+
+ return res;
+}
+
+static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
+ const char *arg)
+{
+ env_dir_config_rec *sconf = sconf_;
+ apr_table_t *vars = sconf->vars;
+ const char *env_var;
+
+ env_var = getenv(arg);
+ if (env_var != NULL) {
+ apr_table_setn(vars, arg, apr_pstrdup(cmd->pool, env_var));
+ }
+ else {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+ "PassEnv variable %s was undefined", arg);
+ }
+
+ return NULL;
+}
+
+static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
+ const char *name, const char *value)
+{
+ env_dir_config_rec *sconf = sconf_;
+
+ /* name is mandatory, value is optional. no value means
+ * set the variable to an empty string
+ */
+ apr_table_setn(sconf->vars, name, value ? value : "");
+
+ return NULL;
+}
+
+static const char *add_env_module_vars_unset(cmd_parms *cmd, void *sconf_,
+ const char *arg)
+{
+ env_dir_config_rec *sconf = sconf_;
+
+ /* Always UnsetEnv FOO in the same context as {Set,Pass}Env FOO
+ * only if this UnsetEnv follows the {Set,Pass}Env. The merge
+ * will only apply unsetenv to the parent env (main server).
+ */
+ apr_table_set(sconf->unsetenv, arg, NULL);
+ apr_table_unset(sconf->vars, arg);
+
+ return NULL;
+}
+
+static const command_rec env_module_cmds[] =
+{
+AP_INIT_ITERATE("PassEnv", add_env_module_vars_passed, NULL,
+ OR_FILEINFO, "a list of environment variables to pass to CGI."),
+AP_INIT_TAKE12("SetEnv", add_env_module_vars_set, NULL,
+ OR_FILEINFO, "an environment variable name and optional value to pass to CGI."),
+AP_INIT_ITERATE("UnsetEnv", add_env_module_vars_unset, NULL,
+ OR_FILEINFO, "a list of variables to remove from the CGI environment."),
+ {NULL},
+};
+
+static int fixup_env_module(request_rec *r)
+{
+ apr_table_t *e = r->subprocess_env;
+ env_dir_config_rec *sconf = ap_get_module_config(r->per_dir_config,
+ &env_module);
+ apr_table_t *vars = sconf->vars;
+
+ if (!apr_table_elts(sconf->vars)->nelts)
+ return DECLINED;
+
+ r->subprocess_env = apr_table_overlay(r->pool, e, vars);
+
+ return OK;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_fixups(fixup_env_module, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA env_module =
+{
+ STANDARD20_MODULE_STUFF,
+ create_env_dir_config, /* dir config creater */
+ merge_env_dir_configs, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ env_module_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.dsp
new file mode 100644
index 00000000..9a841cb6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_env" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_env - Win32 Release
+!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 "mod_env.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 "mod_env.mak" CFG="mod_env - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_env - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_env - 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)" == "mod_env - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_env_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_env - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_env_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_env - Win32 Release"
+# Name "mod_env - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_env.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_env.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_env - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_env.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_env.so "env_module for Apache" ../../include/ap_release.h > .\mod_env.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_env - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_env.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_env.so "env_module for Apache" ../../include/ap_release.h > .\mod_env.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.exp
new file mode 100644
index 00000000..b487bf09
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.exp
@@ -0,0 +1 @@
+env_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.la b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.la
new file mode 100644
index 00000000..80d73dfa
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.la
@@ -0,0 +1,35 @@
+# mod_env.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='mod_env.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib'
+
+# Version information for mod_env.
+current=
+age=
+revision=
+
+# Is this an already installed library?
+installed=no
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir=''
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.lo b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.lo
new file mode 100644
index 00000000..134c2b05
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.lo
@@ -0,0 +1,12 @@
+# mod_env.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/mod_env.o'
+
+# Name of the non-PIC object.
+non_pic_object='mod_env.o'
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.o b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.o
new file mode 100644
index 00000000..b98d9d62
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_env.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.c
new file mode 100644
index 00000000..7c2b78a5
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.c
@@ -0,0 +1,566 @@
+/* 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.
+ */
+
+/*
+ * mod_expires.c
+ * version 0.0.11
+ * status beta
+ *
+ * Andrew Wilson <Andrew.Wilson@cm.cf.ac.uk> 26.Jan.96
+ *
+ * This module allows you to control the form of the Expires: header
+ * that Apache issues for each access. Directives can appear in
+ * configuration files or in .htaccess files so expiry semantics can
+ * be defined on a per-directory basis.
+ *
+ * DIRECTIVE SYNTAX
+ *
+ * Valid directives are:
+ *
+ * ExpiresActive on | off
+ * ExpiresDefault <code><seconds>
+ * ExpiresByType type/encoding <code><seconds>
+ *
+ * Valid values for <code> are:
+ *
+ * 'M' expires header shows file modification date + <seconds>
+ * 'A' expires header shows access time + <seconds>
+ *
+ * [I'm not sure which of these is best under different
+ * circumstances, I guess it's for other people to explore.
+ * The effects may be indistinguishable for a number of cases]
+ *
+ * <seconds> should be an integer value [acceptable to atoi()]
+ *
+ * There is NO space between the <code> and <seconds>.
+ *
+ * For example, a directory which contains information which changes
+ * frequently might contain:
+ *
+ * # reports generated by cron every hour. don't let caches
+ * # hold onto stale information
+ * ExpiresDefault M3600
+ *
+ * Another example, our html pages can change all the time, the gifs
+ * tend not to change often:
+ *
+ * # pages are hot (1 week), images are cold (1 month)
+ * ExpiresByType text/html A604800
+ * ExpiresByType image/gif A2592000
+ *
+ * Expires can be turned on for all URLs on the server by placing the
+ * following directive in a conf file:
+ *
+ * ExpiresActive on
+ *
+ * ExpiresActive can also appear in .htaccess files, enabling the
+ * behaviour to be turned on or off for each chosen directory.
+ *
+ * # turn off Expires behaviour in this directory
+ * # and subdirectories
+ * ExpiresActive off
+ *
+ * Directives defined for a directory are valid in subdirectories
+ * unless explicitly overridden by new directives in the subdirectory
+ * .htaccess files.
+ *
+ * ALTERNATIVE DIRECTIVE SYNTAX
+ *
+ * Directives can also be defined in a more readable syntax of the form:
+ *
+ * ExpiresDefault "<base> [plus] {<num> <type>}*"
+ * ExpiresByType type/encoding "<base> [plus] {<num> <type>}*"
+ *
+ * where <base> is one of:
+ * access
+ * now equivalent to 'access'
+ * modification
+ *
+ * where the 'plus' keyword is optional
+ *
+ * where <num> should be an integer value [acceptable to atoi()]
+ *
+ * where <type> is one of:
+ * years
+ * months
+ * weeks
+ * days
+ * hours
+ * minutes
+ * seconds
+ *
+ * For example, any of the following directives can be used to make
+ * documents expire 1 month after being accessed, by default:
+ *
+ * ExpiresDefault "access plus 1 month"
+ * ExpiresDefault "access plus 4 weeks"
+ * ExpiresDefault "access plus 30 days"
+ *
+ * The expiry time can be fine-tuned by adding several '<num> <type>'
+ * clauses:
+ *
+ * ExpiresByType text/html "access plus 1 month 15 days 2 hours"
+ * ExpiresByType image/gif "modification plus 5 hours 3 minutes"
+ *
+ * ---
+ *
+ * Change-log:
+ * 29.Jan.96 Hardened the add_* functions. Server will now bail out
+ * if bad directives are given in the conf files.
+ * 02.Feb.96 Returns DECLINED if not 'ExpiresActive on', giving other
+ * expires-aware modules a chance to play with the same
+ * directives. [Michael Rutman]
+ * 03.Feb.96 Call tzset() before localtime(). Trying to get the module
+ * to work properly in non GMT timezones.
+ * 12.Feb.96 Modified directive syntax to allow more readable commands:
+ * ExpiresDefault "now plus 10 days 20 seconds"
+ * ExpiresDefault "access plus 30 days"
+ * ExpiresDefault "modification plus 1 year 10 months 30 days"
+ * 13.Feb.96 Fix call to table_get() with NULL 2nd parameter [Rob Hartill]
+ * 19.Feb.96 Call gm_timestr_822() to get time formatted correctly, can't
+ * rely on presence of HTTP_TIME_FORMAT in Apache 1.1+.
+ * 21.Feb.96 This version (0.0.9) reverses assumptions made in 0.0.8
+ * about star/star handlers. Reverting to 0.0.7 behaviour.
+ * 08.Jun.96 allows ExpiresDefault to be used with responses that use
+ * the DefaultType by not DECLINING, but instead skipping
+ * the table_get check and then looking for an ExpiresDefault.
+ * [Rob Hartill]
+ * 04.Nov.96 'const' definitions added.
+ *
+ * TODO
+ * add support for Cache-Control: max-age=20 from the HTTP/1.1
+ * proposal (in this case, a ttl of 20 seconds) [ask roy]
+ * add per-file expiry and explicit expiry times - duplicates some
+ * of the mod_cern_meta.c functionality. eg:
+ * ExpiresExplicit index.html "modification plus 30 days"
+ *
+ * BUGS
+ * Hi, welcome to the internet.
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_lib.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_config.h"
+#include "http_log.h"
+#include "http_request.h"
+#include "http_protocol.h"
+
+typedef struct {
+ int active;
+ int wildcards;
+ char *expiresdefault;
+ apr_table_t *expiresbytype;
+} expires_dir_config;
+
+/* from mod_dir, why is this alias used?
+ */
+#define DIR_CMD_PERMS OR_INDEXES
+
+#define ACTIVE_ON 1
+#define ACTIVE_OFF 0
+#define ACTIVE_DONTCARE 2
+
+module AP_MODULE_DECLARE_DATA expires_module;
+
+static void *create_dir_expires_config(apr_pool_t *p, char *dummy)
+{
+ expires_dir_config *new =
+ (expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config));
+ new->active = ACTIVE_DONTCARE;
+ new->wildcards = 0;
+ new->expiresdefault = NULL;
+ new->expiresbytype = apr_table_make(p, 4);
+ return (void *) new;
+}
+
+static const char *set_expiresactive(cmd_parms *cmd, void *in_dir_config, int arg)
+{
+ expires_dir_config *dir_config = in_dir_config;
+
+ /* if we're here at all it's because someone explicitly
+ * set the active flag
+ */
+ dir_config->active = ACTIVE_ON;
+ if (arg == 0) {
+ dir_config->active = ACTIVE_OFF;
+ }
+ return NULL;
+}
+
+/* check_code() parse 'code' and return NULL or an error response
+ * string. If we return NULL then real_code contains code converted
+ * to the cnnnn format.
+ */
+static char *check_code(apr_pool_t *p, const char *code, char **real_code)
+{
+ char *word;
+ char base = 'X';
+ int modifier = 0;
+ int num = 0;
+ int factor = 0;
+
+ /* 0.0.4 compatibility?
+ */
+ if ((code[0] == 'A') || (code[0] == 'M')) {
+ *real_code = (char *)code;
+ return NULL;
+ }
+
+ /* <base> [plus] {<num> <type>}*
+ */
+
+ /* <base>
+ */
+ word = ap_getword_conf(p, &code);
+ if (!strncasecmp(word, "now", 1) ||
+ !strncasecmp(word, "access", 1)) {
+ base = 'A';
+ }
+ else if (!strncasecmp(word, "modification", 1)) {
+ base = 'M';
+ }
+ else {
+ return apr_pstrcat(p, "bad expires code, unrecognised <base> '",
+ word, "'", NULL);
+ }
+
+ /* [plus]
+ */
+ word = ap_getword_conf(p, &code);
+ if (!strncasecmp(word, "plus", 1)) {
+ word = ap_getword_conf(p, &code);
+ }
+
+ /* {<num> <type>}*
+ */
+ while (word[0]) {
+ /* <num>
+ */
+ if (apr_isdigit(word[0])) {
+ num = atoi(word);
+ }
+ else {
+ return apr_pstrcat(p, "bad expires code, numeric value expected <num> '",
+ word, "'", NULL);
+ }
+
+ /* <type>
+ */
+ word = ap_getword_conf(p, &code);
+ if (word[0]) {
+ /* do nothing */
+ }
+ else {
+ return apr_pstrcat(p, "bad expires code, missing <type>", NULL);
+ }
+
+ factor = 0;
+ if (!strncasecmp(word, "years", 1)) {
+ factor = 60 * 60 * 24 * 365;
+ }
+ else if (!strncasecmp(word, "months", 2)) {
+ factor = 60 * 60 * 24 * 30;
+ }
+ else if (!strncasecmp(word, "weeks", 1)) {
+ factor = 60 * 60 * 24 * 7;
+ }
+ else if (!strncasecmp(word, "days", 1)) {
+ factor = 60 * 60 * 24;
+ }
+ else if (!strncasecmp(word, "hours", 1)) {
+ factor = 60 * 60;
+ }
+ else if (!strncasecmp(word, "minutes", 2)) {
+ factor = 60;
+ }
+ else if (!strncasecmp(word, "seconds", 1)) {
+ factor = 1;
+ }
+ else {
+ return apr_pstrcat(p, "bad expires code, unrecognised <type>",
+ "'", word, "'", NULL);
+ }
+
+ modifier = modifier + factor * num;
+
+ /* next <num>
+ */
+ word = ap_getword_conf(p, &code);
+ }
+
+ *real_code = apr_psprintf(p, "%c%d", base, modifier);
+
+ return NULL;
+}
+
+static const char *set_expiresbytype(cmd_parms *cmd, void *in_dir_config,
+ const char *mime, const char *code)
+{
+ expires_dir_config *dir_config = in_dir_config;
+ char *response, *real_code;
+ const char *check;
+
+ check = ap_strrchr_c(mime, '/');
+ if ((strlen(++check) == 1) && (*check == '*')) {
+ dir_config->wildcards = 1;
+ }
+
+ if ((response = check_code(cmd->pool, code, &real_code)) == NULL) {
+ apr_table_setn(dir_config->expiresbytype, mime, real_code);
+ return NULL;
+ }
+ return apr_pstrcat(cmd->pool,
+ "'ExpiresByType ", mime, " ", code, "': ", response, NULL);
+}
+
+static const char *set_expiresdefault(cmd_parms *cmd, void *in_dir_config,
+ const char *code)
+{
+ expires_dir_config * dir_config = in_dir_config;
+ char *response, *real_code;
+
+ if ((response = check_code(cmd->pool, code, &real_code)) == NULL) {
+ dir_config->expiresdefault = real_code;
+ return NULL;
+ }
+ return apr_pstrcat(cmd->pool,
+ "'ExpiresDefault ", code, "': ", response, NULL);
+}
+
+static const command_rec expires_cmds[] =
+{
+ AP_INIT_FLAG("ExpiresActive", set_expiresactive, NULL, DIR_CMD_PERMS,
+ "Limited to 'on' or 'off'"),
+ AP_INIT_TAKE2("ExpiresByType", set_expiresbytype, NULL, DIR_CMD_PERMS,
+ "a MIME type followed by an expiry date code"),
+ AP_INIT_TAKE1("ExpiresDefault", set_expiresdefault, NULL, DIR_CMD_PERMS,
+ "an expiry date code"),
+ {NULL}
+};
+
+static void *merge_expires_dir_configs(apr_pool_t *p, void *basev, void *addv)
+{
+ expires_dir_config *new = (expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config));
+ expires_dir_config *base = (expires_dir_config *) basev;
+ expires_dir_config *add = (expires_dir_config *) addv;
+
+ if (add->active == ACTIVE_DONTCARE) {
+ new->active = base->active;
+ }
+ else {
+ new->active = add->active;
+ }
+
+ if (add->expiresdefault != NULL) {
+ new->expiresdefault = add->expiresdefault;
+ }
+ else {
+ new->expiresdefault = base->expiresdefault;
+ }
+ new->wildcards = add->wildcards;
+ new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
+ base->expiresbytype);
+ return new;
+}
+
+/*
+ * Handle the setting of the expiration response header fields according
+ * to our criteria.
+ */
+
+static int set_expiration_fields(request_rec *r, const char *code,
+ apr_table_t *t)
+{
+ apr_time_t base;
+ apr_time_t additional;
+ apr_time_t expires;
+ int additional_sec;
+ char *timestr;
+
+ switch (code[0]) {
+ case 'M':
+ if (r->finfo.filetype == 0) {
+ /* file doesn't exist on disk, so we can't do anything based on
+ * modification time. Note that this does _not_ log an error.
+ */
+ return DECLINED;
+ }
+ base = r->finfo.mtime;
+ additional_sec = atoi(&code[1]);
+ additional = apr_time_from_sec(additional_sec);
+ break;
+ case 'A':
+ /* there's been some discussion and it's possible that
+ * 'access time' will be stored in request structure
+ */
+ base = r->request_time;
+ additional_sec = atoi(&code[1]);
+ additional = apr_time_from_sec(additional_sec);
+ break;
+ default:
+ /* expecting the add_* routines to be case-hardened this
+ * is just a reminder that module is beta
+ */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "internal error: bad expires code: %s", r->filename);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ expires = base + additional;
+ if (expires < r->request_time) {
+ expires = r->request_time;
+ }
+ apr_table_mergen(t, "Cache-Control",
+ apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
+ apr_time_sec(expires - r->request_time)));
+ timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
+ apr_rfc822_date(timestr, expires);
+ apr_table_setn(t, "Expires", timestr);
+ return OK;
+}
+
+/*
+ * Output filter to set the Expires response header field
+ * according to the content-type of the response -- if it hasn't
+ * already been set.
+ */
+static apr_status_t expires_filter(ap_filter_t *f,
+ apr_bucket_brigade *b)
+{
+ request_rec *r;
+ expires_dir_config *conf;
+ const char *expiry;
+ apr_table_t *t;
+
+ r = f->r;
+ conf = (expires_dir_config *) ap_get_module_config(r->per_dir_config,
+ &expires_module);
+
+ /*
+ * Check to see which output header table we should use;
+ * mod_cgi loads script fields into r->err_headers_out,
+ * for instance.
+ */
+ expiry = apr_table_get(r->err_headers_out, "Expires");
+ if (expiry != NULL) {
+ t = r->err_headers_out;
+ }
+ else {
+ expiry = apr_table_get(r->headers_out, "Expires");
+ t = r->headers_out;
+ }
+ if (expiry == NULL) {
+ /*
+ * No expiration has been set, so we can apply any managed by
+ * this module. First, check to see if there is an applicable
+ * ExpiresByType directive.
+ */
+ expiry = apr_table_get(conf->expiresbytype,
+ ap_field_noparam(r->pool, r->content_type));
+ if (expiry == NULL) {
+ int usedefault = 1;
+ /*
+ * See if we have a wildcard entry for the major type.
+ */
+ if (conf->wildcards) {
+ char *checkmime;
+ char *spos;
+ checkmime = apr_pstrdup(r->pool, r->content_type);
+ spos = checkmime ? ap_strchr(checkmime, '/') : NULL;
+ if (spos != NULL) {
+ /*
+ * Without a '/' character, nothing we have will match.
+ * However, we have one.
+ */
+ if (strlen(++spos) > 0) {
+ *spos++ = '*';
+ *spos = '\0';
+ }
+ else {
+ checkmime = apr_pstrcat(r->pool, checkmime, "*", NULL);
+ }
+ expiry = apr_table_get(conf->expiresbytype, checkmime);
+ usedefault = (expiry == NULL);
+ }
+ }
+ if (usedefault) {
+ /*
+ * Use the ExpiresDefault directive
+ */
+ expiry = conf->expiresdefault;
+ }
+ }
+ if (expiry != NULL) {
+ set_expiration_fields(r, expiry, t);
+ }
+ }
+ ap_remove_output_filter(f);
+ return ap_pass_brigade(f->next, b);
+}
+
+static void expires_insert_filter(request_rec *r)
+{
+ expires_dir_config *conf;
+
+ /* Don't add Expires headers to errors */
+ if (ap_is_HTTP_ERROR(r->status)) {
+ return;
+ }
+ /* Say no to subrequests */
+ if (r->main != NULL) {
+ return;
+ }
+ conf = (expires_dir_config *) ap_get_module_config(r->per_dir_config,
+ &expires_module);
+
+ /* Check to see if the filter is enabled and if there are any applicable
+ * config directives for this directory scope
+ */
+ if (conf->active != ACTIVE_ON ||
+ (apr_is_empty_table(conf->expiresbytype) && !conf->expiresdefault)) {
+ return;
+ }
+ ap_add_output_filter("MOD_EXPIRES", NULL, r, r->connection);
+ return;
+}
+static void register_hooks(apr_pool_t *p)
+{
+ /* mod_expires needs to run *before* the cache save filter which is
+ * AP_FTYPE_CONTENT_SET-1. Otherwise, our expires won't be honored.
+ */
+ ap_register_output_filter("MOD_EXPIRES", expires_filter, NULL,
+ AP_FTYPE_CONTENT_SET-2);
+ ap_hook_insert_error_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_insert_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA expires_module =
+{
+ STANDARD20_MODULE_STUFF,
+ create_dir_expires_config, /* dir config creater */
+ merge_expires_dir_configs, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ expires_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.dsp
new file mode 100644
index 00000000..6cb9f91f
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_expires" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_expires - Win32 Release
+!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 "mod_expires.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 "mod_expires.mak" CFG="mod_expires - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_expires - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_expires - 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)" == "mod_expires - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_expires_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_expires.so" /base:@..\..\os\win32\BaseAddr.ref,mod_expires.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_expires.so" /base:@..\..\os\win32\BaseAddr.ref,mod_expires.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_expires - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_expires_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_expires.so" /base:@..\..\os\win32\BaseAddr.ref,mod_expires.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_expires.so" /base:@..\..\os\win32\BaseAddr.ref,mod_expires.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_expires - Win32 Release"
+# Name "mod_expires - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_expires.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_expires.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_expires - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_expires.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_expires.so "expires_module for Apache" ../../include/ap_release.h > .\mod_expires.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_expires - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_expires.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_expires.so "expires_module for Apache" ../../include/ap_release.h > .\mod_expires.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.exp
new file mode 100644
index 00000000..863a9687
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_expires.exp
@@ -0,0 +1 @@
+expires_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.c
new file mode 100644
index 00000000..ce4460d4
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.c
@@ -0,0 +1,620 @@
+/* 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.
+ */
+
+/*
+ * mod_headers.c: Add/append/remove HTTP response headers
+ * Written by Paul Sutton, paul@ukweb.com, 1 Oct 1996
+ *
+ * The Header directive can be used to add/replace/remove HTTP headers
+ * within the response message. The RequestHeader directive can be used
+ * to add/replace/remove HTTP headers before a request message is processed.
+ * Valid in both per-server and per-dir configurations.
+ *
+ * Syntax is:
+ *
+ * Header action header value
+ * RequestHeader action header value
+ *
+ * Where action is one of:
+ * set - set this header, replacing any old value
+ * add - add this header, possible resulting in two or more
+ * headers with the same name
+ * append - append this text onto any existing header of this same
+ * unset - remove this header
+ *
+ * Where action is unset, the third argument (value) should not be given.
+ * The header name can include the colon, or not.
+ *
+ * The Header and RequestHeader directives can only be used where allowed
+ * by the FileInfo override.
+ *
+ * When the request is processed, the header directives are processed in
+ * this order: firstly, the main server, then the virtual server handling
+ * this request (if any), then any <Directory> sections (working downwards
+ * from the root dir), then an <Location> sections (working down from
+ * shortest URL component), the any <File> sections. This order is
+ * important if any 'set' or 'unset' actions are used. For example,
+ * the following two directives have different effect if applied in
+ * the reverse order:
+ *
+ * Header append Author "John P. Doe"
+ * Header unset Author
+ *
+ * Examples:
+ *
+ * To set the "Author" header, use
+ * Header add Author "John P. Doe"
+ *
+ * To remove a header:
+ * Header unset Author
+ *
+ */
+
+#include "apr.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+#include "apr_buckets.h"
+
+#include "apr_hash.h"
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_request.h"
+#include "http_log.h"
+#include "util_filter.h"
+#include "http_protocol.h" /* ap_hook_insert_error_filter */
+
+/* format_tag_hash is initialized during pre-config */
+static apr_hash_t *format_tag_hash;
+
+typedef enum {
+ hdr_add = 'a', /* add header (could mean multiple hdrs) */
+ hdr_set = 's', /* set (replace old value) */
+ hdr_append = 'm', /* append (merge into any old value) */
+ hdr_unset = 'u', /* unset header */
+ hdr_echo = 'e' /* echo headers from request to response */
+} hdr_actions;
+
+/*
+ * magic cmd->info values
+ */
+static char hdr_in = '0'; /* RequestHeader */
+static char hdr_out = '1'; /* Header onsuccess */
+static char hdr_err = '2'; /* Header always */
+
+/*
+ * There is an array of struct format_tag per Header/RequestHeader
+ * config directive
+ */
+typedef struct {
+ const char* (*func)(request_rec *r,char *arg);
+ char *arg;
+} format_tag;
+
+/*
+ * There is one "header_entry" per Header/RequestHeader config directive
+ */
+typedef struct {
+ hdr_actions action;
+ char *header;
+ apr_array_header_t *ta; /* Array of format_tag structs */
+ regex_t *regex;
+ const char *condition_var;
+} header_entry;
+
+/* echo_do is used for Header echo to iterate through the request headers*/
+typedef struct {
+ request_rec *r;
+ header_entry *hdr;
+} echo_do;
+
+/*
+ * headers_conf is our per-module configuration. This is used as both
+ * a per-dir and per-server config
+ */
+typedef struct {
+ apr_array_header_t *fixup_in;
+ apr_array_header_t *fixup_out;
+ apr_array_header_t *fixup_err;
+} headers_conf;
+
+module AP_MODULE_DECLARE_DATA headers_module;
+
+/*
+ * Tag formatting functions
+ */
+static const char *constant_item(request_rec *r, char *stuff)
+{
+ return stuff;
+}
+static const char *header_request_duration(request_rec *r, char *a)
+{
+ return apr_psprintf(r->pool, "D=%" APR_TIME_T_FMT,
+ (apr_time_now() - r->request_time));
+}
+static const char *header_request_time(request_rec *r, char *a)
+{
+ return apr_psprintf(r->pool, "t=%" APR_TIME_T_FMT, r->request_time);
+}
+static const char *header_request_env_var(request_rec *r, char *a)
+{
+ const char *s = apr_table_get(r->subprocess_env,a);
+
+ if (s)
+ return s;
+ else
+ return "(null)";
+}
+/*
+ * Config routines
+ */
+static void *create_headers_config(apr_pool_t *p, char *dummy)
+{
+ headers_conf *conf = apr_palloc(p, sizeof(*conf));
+
+ conf->fixup_in = apr_array_make(p, 2, sizeof(header_entry));
+ conf->fixup_out = apr_array_make(p, 2, sizeof(header_entry));
+ conf->fixup_err = apr_array_make(p, 2, sizeof(header_entry));
+
+ return conf;
+}
+
+static void *merge_headers_config(apr_pool_t *p, void *basev, void *overridesv)
+{
+ headers_conf *newconf = apr_palloc(p, sizeof(*newconf));
+ headers_conf *base = basev;
+ headers_conf *overrides = overridesv;
+
+ newconf->fixup_in = apr_array_append(p, base->fixup_in, overrides->fixup_in);
+ newconf->fixup_out = apr_array_append(p, base->fixup_out, overrides->fixup_out);
+ newconf->fixup_err = apr_array_append(p, base->fixup_err, overrides->fixup_err);
+
+ return newconf;
+}
+
+static char *parse_misc_string(apr_pool_t *p, format_tag *tag, const char **sa)
+{
+ const char *s;
+ char *d;
+
+ tag->func = constant_item;
+
+ s = *sa;
+ while (*s && *s != '%') {
+ s++;
+ }
+ /*
+ * This might allocate a few chars extra if there's a backslash
+ * escape in the format string.
+ */
+ tag->arg = apr_palloc(p, s - *sa + 1);
+
+ d = tag->arg;
+ s = *sa;
+ while (*s && *s != '%') {
+ if (*s != '\\') {
+ *d++ = *s++;
+ }
+ else {
+ s++;
+ switch (*s) {
+ case '\\':
+ *d++ = '\\';
+ s++;
+ break;
+ case 'r':
+ *d++ = '\r';
+ s++;
+ break;
+ case 'n':
+ *d++ = '\n';
+ s++;
+ break;
+ case 't':
+ *d++ = '\t';
+ s++;
+ break;
+ default:
+ /* copy verbatim */
+ *d++ = '\\';
+ /*
+ * Allow the loop to deal with this *s in the normal
+ * fashion so that it handles end of string etc.
+ * properly.
+ */
+ break;
+ }
+ }
+ }
+ *d = '\0';
+
+ *sa = s;
+ return NULL;
+}
+
+static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
+{
+ const char *s = *sa;
+ const char * (*tag_handler)(request_rec *,char *);
+
+ /* Handle string literal/conditionals */
+ if (*s != '%') {
+ return parse_misc_string(p, tag, sa);
+ }
+ s++; /* skip the % */
+ tag->arg = '\0';
+ /* grab the argument if there is one */
+ if (*s == '{') {
+ ++s;
+ tag->arg = ap_getword(p,&s,'}');
+ }
+
+ tag_handler = (const char * (*)(request_rec *,char *))apr_hash_get(format_tag_hash, s++, 1);
+
+ if (!tag_handler) {
+ char dummy[2];
+ dummy[0] = s[-1];
+ dummy[1] = '\0';
+ return apr_pstrcat(p, "Unrecognized Header or RequestHeader directive %",
+ dummy, NULL);
+ }
+ tag->func = tag_handler;
+
+ *sa = s;
+ return NULL;
+}
+
+/*
+ * A format string consists of white space, text and optional format
+ * tags in any order. E.g.,
+ *
+ * Header add MyHeader "Free form text %D %t more text"
+ *
+ * Decompose the format string into its tags. Each tag (struct format_tag)
+ * contains a pointer to the function used to format the tag. Then save each
+ * tag in the tag array anchored in the header_entry.
+ */
+static char *parse_format_string(apr_pool_t *p, header_entry *hdr, const char *s)
+{
+ char *res;
+
+ /* No string to parse with unset and copy commands */
+ if (hdr->action == hdr_unset ||
+ hdr->action == hdr_echo) {
+ return NULL;
+ }
+
+ hdr->ta = apr_array_make(p, 10, sizeof(format_tag));
+
+ while (*s) {
+ if ((res = parse_format_tag(p, (format_tag *) apr_array_push(hdr->ta), &s))) {
+ return res;
+ }
+ }
+ return NULL;
+}
+
+/* handle RequestHeader and Header directive */
+static const char *header_inout_cmd(cmd_parms *cmd, void *indirconf,
+ const char *action, const char *inhdr,
+ const char *value, const char* envclause)
+{
+ headers_conf *dirconf = indirconf;
+ const char *condition_var = NULL;
+ char *colon;
+ char *hdr = apr_pstrdup(cmd->pool, inhdr);
+ header_entry *new;
+ apr_array_header_t *fixup = (cmd->info == &hdr_in)
+ ? dirconf->fixup_in : (cmd->info == &hdr_err)
+ ? dirconf->fixup_err
+ : dirconf->fixup_out;
+
+ new = (header_entry *) apr_array_push(fixup);
+
+ if (!strcasecmp(action, "set"))
+ new->action = hdr_set;
+ else if (!strcasecmp(action, "add"))
+ new->action = hdr_add;
+ else if (!strcasecmp(action, "append"))
+ new->action = hdr_append;
+ else if (!strcasecmp(action, "unset"))
+ new->action = hdr_unset;
+ else if (!strcasecmp(action, "echo"))
+ new->action = hdr_echo;
+ else
+ return "first argument must be add, set, append, unset or echo.";
+
+ if (new->action == hdr_unset) {
+ if (value)
+ return "header unset takes two arguments";
+ }
+ else if (new->action == hdr_echo) {
+ regex_t *regex;
+ if (value)
+ return "Header echo takes two arguments";
+ else if (cmd->info == &hdr_in)
+ return "Header echo only valid on Header directive";
+ else {
+ regex = ap_pregcomp(cmd->pool, hdr, REG_EXTENDED | REG_NOSUB);
+ if (regex == NULL) {
+ return "Header echo regex could not be compiled";
+ }
+ }
+ new->regex = regex;
+ }
+ else if (!value)
+ return "header requires three arguments";
+
+ /* Handle the envclause on Header */
+ if (envclause != NULL) {
+ if (strncasecmp(envclause, "env=", 4) != 0) {
+ return "error: envclause should be in the form env=envar";
+ }
+ if ((envclause[4] == '\0')
+ || ((envclause[4] == '!') && (envclause[5] == '\0'))) {
+ return "error: missing environment variable name. envclause should be in the form env=envar ";
+ }
+ condition_var = apr_pstrdup(cmd->pool, &envclause[4]);
+ }
+
+ if ((colon = strchr(hdr, ':')))
+ *colon = '\0';
+
+ new->header = hdr;
+ new->condition_var = condition_var;
+
+ return parse_format_string(cmd->pool, new, value);
+}
+
+/* Handle all (xxx)Header directives */
+static const char *header_cmd(cmd_parms *cmd, void *indirconf,
+ const char *args)
+{
+ const char *s;
+ const char *action;
+ const char *hdr;
+ const char *val;
+ const char *envclause;
+
+ s = apr_pstrdup(cmd->pool, args);
+ action = ap_getword_conf(cmd->pool, &s);
+ if (cmd->info == &hdr_out) {
+ if (!strcasecmp(action, "always")) {
+ cmd->info = &hdr_err;
+ action = ap_getword_conf(cmd->pool, &s);
+ }
+ else if (!strcasecmp(action, "onsuccess")) {
+ action = ap_getword_conf(cmd->pool, &s);
+ }
+ }
+ hdr = ap_getword_conf(cmd->pool, &s);
+ val = *s ? ap_getword_conf(cmd->pool, &s) : NULL;
+ envclause = *s ? ap_getword_conf(cmd->pool, &s) : NULL;
+
+ if (*s) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " has too many arguments", NULL);
+ }
+
+ return header_inout_cmd(cmd, indirconf, action, hdr, val, envclause);
+}
+
+/*
+ * Process the tags in the format string. Tags may be format specifiers
+ * (%D, %t, etc.), whitespace or text strings. For each tag, run the handler
+ * (formatter) specific to the tag. Handlers return text strings.
+ * Concatenate the return from each handler into one string that is
+ * returned from this call.
+ */
+static char* process_tags(header_entry *hdr, request_rec *r)
+{
+ int i;
+ const char *s;
+ char *str = NULL;
+
+ format_tag *tag = (format_tag*) hdr->ta->elts;
+
+ for (i = 0; i < hdr->ta->nelts; i++) {
+ s = tag[i].func(r, tag[i].arg);
+ if (str == NULL)
+ str = apr_pstrdup(r->pool, s);
+ else
+ str = apr_pstrcat(r->pool, str, s, NULL);
+ }
+ return str ? str : "";
+}
+
+static int echo_header(echo_do *v, const char *key, const char *val)
+{
+ /* If the input header (key) matches the regex, echo it intact to
+ * r->headers_out.
+ */
+ if (!ap_regexec(v->hdr->regex, key, 0, NULL, 0)) {
+ apr_table_add(v->r->headers_out, key, val);
+ }
+
+ return 1;
+}
+
+static void do_headers_fixup(request_rec *r, apr_table_t *headers,
+ apr_array_header_t *fixup)
+{
+ int i;
+
+ for (i = 0; i < fixup->nelts; ++i) {
+ header_entry *hdr = &((header_entry *) (fixup->elts))[i];
+
+ /* Have any conditional envar-controlled Header processing to do? */
+ if (hdr->condition_var) {
+ const char *envar = hdr->condition_var;
+ if (*envar != '!') {
+ if (apr_table_get(r->subprocess_env, envar) == NULL)
+ continue;
+ }
+ else {
+ if (apr_table_get(r->subprocess_env, &envar[1]) != NULL)
+ continue;
+ }
+ }
+
+ switch (hdr->action) {
+ case hdr_add:
+ apr_table_addn(headers, hdr->header, process_tags(hdr, r));
+ break;
+ case hdr_append:
+ apr_table_mergen(headers, hdr->header, process_tags(hdr, r));
+ break;
+ case hdr_set:
+ apr_table_setn(headers, hdr->header, process_tags(hdr, r));
+ break;
+ case hdr_unset:
+ apr_table_unset(headers, hdr->header);
+ break;
+ case hdr_echo:
+ {
+ echo_do v;
+ v.r = r;
+ v.hdr = hdr;
+ apr_table_do((int (*) (void *, const char *, const char *))
+ echo_header, (void *) &v, r->headers_in, NULL);
+ break;
+ }
+ }
+ }
+}
+
+static void ap_headers_insert_output_filter(request_rec *r)
+{
+ headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
+ &headers_module);
+
+ if (dirconf->fixup_out->nelts || dirconf->fixup_err->nelts) {
+ ap_add_output_filter("FIXUP_HEADERS_OUT", NULL, r, r->connection);
+ }
+}
+
+static void ap_headers_insert_error_filter(request_rec *r)
+{
+ headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
+ &headers_module);
+
+ if (dirconf->fixup_err->nelts) {
+ ap_add_output_filter("FIXUP_HEADERS_ERR", NULL, r, r->connection);
+ }
+}
+
+static apr_status_t ap_headers_output_filter(ap_filter_t *f,
+ apr_bucket_brigade *in)
+{
+ headers_conf *dirconf = ap_get_module_config(f->r->per_dir_config,
+ &headers_module);
+
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->r->server,
+ "headers: ap_headers_output_filter()");
+
+ /* do the fixup */
+ do_headers_fixup(f->r, f->r->err_headers_out, dirconf->fixup_err);
+ do_headers_fixup(f->r, f->r->headers_out, dirconf->fixup_out);
+
+ /* remove ourselves from the filter chain */
+ ap_remove_output_filter(f);
+
+ /* send the data up the stack */
+ return ap_pass_brigade(f->next,in);
+}
+
+static apr_status_t ap_headers_error_filter(ap_filter_t *f,
+ apr_bucket_brigade *in)
+{
+ headers_conf *dirconf = ap_get_module_config(f->r->per_dir_config,
+ &headers_module);
+
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->r->server,
+ "headers: ap_headers_error_filter()");
+
+ /* do the fixup */
+ do_headers_fixup(f->r, f->r->err_headers_out, dirconf->fixup_err);
+
+ /* remove ourselves from the filter chain */
+ ap_remove_output_filter(f);
+
+ /* send the data up the stack */
+ return ap_pass_brigade(f->next,in);
+}
+
+static apr_status_t ap_headers_fixup(request_rec *r)
+{
+ headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
+ &headers_module);
+
+ /* do the fixup */
+ if (dirconf->fixup_in->nelts) {
+ do_headers_fixup(r, r->headers_in, dirconf->fixup_in);
+ }
+
+ return DECLINED;
+}
+
+static const command_rec headers_cmds[] =
+{
+ AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out, OR_FILEINFO,
+ "an optional condition, an action, header and value "
+ "followed by optional env clause"),
+ AP_INIT_RAW_ARGS("RequestHeader", header_cmd, &hdr_in, OR_FILEINFO,
+ "an action, header and value"),
+ {NULL}
+};
+
+static void register_format_tag_handler(apr_pool_t *p, char *tag, void *tag_handler, int def)
+{
+ const void *h = apr_palloc(p, sizeof(h));
+ h = tag_handler;
+ apr_hash_set(format_tag_hash, tag, 1, h);
+}
+static int header_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
+{
+ format_tag_hash = apr_hash_make(p);
+ register_format_tag_handler(p, "D", (void*) header_request_duration, 0);
+ register_format_tag_handler(p, "t", (void*) header_request_time, 0);
+ register_format_tag_handler(p, "e", (void*) header_request_env_var, 0);
+
+ return OK;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_pre_config(header_pre_config,NULL,NULL,APR_HOOK_MIDDLE);
+ ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST);
+ ap_hook_insert_error_filter(ap_headers_insert_error_filter, NULL, NULL, APR_HOOK_LAST);
+ ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST);
+ ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter,
+ NULL, AP_FTYPE_CONTENT_SET);
+ ap_register_output_filter("FIXUP_HEADERS_ERR", ap_headers_error_filter,
+ NULL, AP_FTYPE_CONTENT_SET);
+}
+
+module AP_MODULE_DECLARE_DATA headers_module =
+{
+ STANDARD20_MODULE_STUFF,
+ create_headers_config, /* dir config creater */
+ merge_headers_config, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ headers_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.dsp
new file mode 100644
index 00000000..3e5a016f
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_headers" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_headers - Win32 Release
+!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 "mod_headers.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 "mod_headers.mak" CFG="mod_headers - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_headers - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_headers - 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)" == "mod_headers - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_headers_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_headers.so" /base:@..\..\os\win32\BaseAddr.ref,mod_headers.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_headers.so" /base:@..\..\os\win32\BaseAddr.ref,mod_headers.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_headers - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_headers_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_headers.so" /base:@..\..\os\win32\BaseAddr.ref,mod_headers.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_headers.so" /base:@..\..\os\win32\BaseAddr.ref,mod_headers.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_headers - Win32 Release"
+# Name "mod_headers - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_headers.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_headers.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_headers - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_headers.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_headers.so "headers_module for Apache" ../../include/ap_release.h > .\mod_headers.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_headers - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_headers.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_headers.so "headers_module for Apache" ../../include/ap_release.h > .\mod_headers.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.exp
new file mode 100644
index 00000000..3f306380
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_headers.exp
@@ -0,0 +1 @@
+headers_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.c
new file mode 100644
index 00000000..329d3898
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.c
@@ -0,0 +1,2477 @@
+/* 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.
+ */
+
+/*
+ * mod_mime_magic: MIME type lookup via file magic numbers
+ * Copyright (c) 1996-1997 Cisco Systems, Inc.
+ *
+ * This software was submitted by Cisco Systems to the Apache Software Foundation in July
+ * 1997. Future revisions and derivatives of this source code must
+ * acknowledge Cisco Systems as the original contributor of this module.
+ * All other licensing and usage conditions are those of the Apache Software Foundation.
+ *
+ * Some of this code is derived from the free version of the file command
+ * originally posted to comp.sources.unix. Copyright info for that program
+ * is included below as required.
+ * ---------------------------------------------------------------------------
+ * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
+ *
+ * This software is not subject to any license of the American Telephone and
+ * Telegraph Company or of the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on any
+ * computer system, and to alter it and redistribute it freely, subject to
+ * the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources, credits
+ * must appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users ever read
+ * sources, credits must appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ * -------------------------------------------------------------------------
+ *
+ * For compliance with Mr Darwin's terms: this has been very significantly
+ * modified from the free "file" command.
+ * - all-in-one file for compilation convenience when moving from one
+ * version of Apache to the next.
+ * - Memory allocation is done through the Apache API's apr_pool_t structure.
+ * - All functions have had necessary Apache API request or server
+ * structures passed to them where necessary to call other Apache API
+ * routines. (i.e. usually for logging, files, or memory allocation in
+ * itself or a called function.)
+ * - struct magic has been converted from an array to a single-ended linked
+ * list because it only grows one record at a time, it's only accessed
+ * sequentially, and the Apache API has no equivalent of realloc().
+ * - Functions have been changed to get their parameters from the server
+ * configuration instead of globals. (It should be reentrant now but has
+ * not been tested in a threaded environment.)
+ * - Places where it used to print results to stdout now saves them in a
+ * list where they're used to set the MIME type in the Apache request
+ * record.
+ * - Command-line flags have been removed since they will never be used here.
+ *
+ * Ian Kluft <ikluft@cisco.com>
+ * Engineering Information Framework
+ * Central Engineering
+ * Cisco Systems, Inc.
+ * San Jose, CA, USA
+ *
+ * Initial installation July/August 1996
+ * Misc bug fixes May 1997
+ * Submission to Apache Software Foundation July 1997
+ *
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_lib.h"
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#if APR_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_config.h"
+#include "http_request.h"
+#include "http_core.h"
+#include "http_log.h"
+#include "http_protocol.h"
+#include "util_script.h"
+
+/* ### this isn't set by configure? does anybody set this? */
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
+/*
+ * data structures and related constants
+ */
+
+#define MODNAME "mod_mime_magic"
+#define MIME_MAGIC_DEBUG 0
+
+#define MIME_BINARY_UNKNOWN "application/octet-stream"
+#define MIME_TEXT_UNKNOWN "text/plain"
+
+#define MAXMIMESTRING 256
+
+/* HOWMANY must be at least 4096 to make gzip -dcq work */
+#define HOWMANY 4096
+/* SMALL_HOWMANY limits how much work we do to figure out text files */
+#define SMALL_HOWMANY 1024
+#define MAXDESC 50 /* max leng of text description */
+#define MAXstring 64 /* max leng of "string" types */
+
+struct magic {
+ struct magic *next; /* link to next entry */
+ int lineno; /* line number from magic file */
+
+ short flag;
+#define INDIR 1 /* if '>(...)' appears, */
+#define UNSIGNED 2 /* comparison is unsigned */
+ short cont_level; /* level of ">" */
+ struct {
+ char type; /* byte short long */
+ long offset; /* offset from indirection */
+ } in;
+ long offset; /* offset to magic number */
+ unsigned char reln; /* relation (0=eq, '>'=gt, etc) */
+ char type; /* int, short, long or string. */
+ char vallen; /* length of string value, if any */
+#define BYTE 1
+#define SHORT 2
+#define LONG 4
+#define STRING 5
+#define DATE 6
+#define BESHORT 7
+#define BELONG 8
+#define BEDATE 9
+#define LESHORT 10
+#define LELONG 11
+#define LEDATE 12
+ union VALUETYPE {
+ unsigned char b;
+ unsigned short h;
+ unsigned long l;
+ char s[MAXstring];
+ unsigned char hs[2]; /* 2 bytes of a fixed-endian "short" */
+ unsigned char hl[4]; /* 2 bytes of a fixed-endian "long" */
+ } value; /* either number or string */
+ unsigned long mask; /* mask before comparison with value */
+ char nospflag; /* supress space character */
+
+ /* NOTE: this string is suspected of overrunning - find it! */
+ char desc[MAXDESC]; /* description */
+};
+
+/*
+ * data structures for tar file recognition
+ * --------------------------------------------------------------------------
+ * Header file for public domain tar (tape archive) program.
+ *
+ * @(#)tar.h 1.20 86/10/29 Public Domain. Created 25 August 1985 by John
+ * Gilmore, ihnp4!hoptoad!gnu.
+ *
+ * Header block on tape.
+ *
+ * I'm going to use traditional DP naming conventions here. A "block" is a big
+ * chunk of stuff that we do I/O on. A "record" is a piece of info that we
+ * care about. Typically many "record"s fit into a "block".
+ */
+#define RECORDSIZE 512
+#define NAMSIZ 100
+#define TUNMLEN 32
+#define TGNMLEN 32
+
+union record {
+ char charptr[RECORDSIZE];
+ struct header {
+ char name[NAMSIZ];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char chksum[8];
+ char linkflag;
+ char linkname[NAMSIZ];
+ char magic[8];
+ char uname[TUNMLEN];
+ char gname[TGNMLEN];
+ char devmajor[8];
+ char devminor[8];
+ } header;
+};
+
+/* The magic field is filled with this if uname and gname are valid. */
+#define TMAGIC "ustar " /* 7 chars and a null */
+
+/*
+ * file-function prototypes
+ */
+static int ascmagic(request_rec *, unsigned char *, apr_size_t);
+static int is_tar(unsigned char *, apr_size_t);
+static int softmagic(request_rec *, unsigned char *, apr_size_t);
+static int tryit(request_rec *, unsigned char *, apr_size_t, int);
+static int zmagic(request_rec *, unsigned char *, apr_size_t);
+
+static int getvalue(server_rec *, struct magic *, char **);
+static int hextoint(int);
+static char *getstr(server_rec *, char *, char *, int, int *);
+static int parse(server_rec *, apr_pool_t *p, char *, int);
+
+static int match(request_rec *, unsigned char *, apr_size_t);
+static int mget(request_rec *, union VALUETYPE *, unsigned char *,
+ struct magic *, apr_size_t);
+static int mcheck(request_rec *, union VALUETYPE *, struct magic *);
+static void mprint(request_rec *, union VALUETYPE *, struct magic *);
+
+static int uncompress(request_rec *, int,
+ unsigned char **, apr_size_t);
+static long from_oct(int, char *);
+static int fsmagic(request_rec *r, const char *fn);
+
+/*
+ * includes for ASCII substring recognition formerly "names.h" in file
+ * command
+ *
+ * Original notes: names and types used by ascmagic in file(1). These tokens are
+ * here because they can appear anywhere in the first HOWMANY bytes, while
+ * tokens in /etc/magic must appear at fixed offsets into the file. Don't
+ * make HOWMANY too high unless you have a very fast CPU.
+ */
+
+/* these types are used to index the apr_table_t 'types': keep em in sync! */
+/* HTML inserted in first because this is a web server module now */
+#define L_HTML 0 /* HTML */
+#define L_C 1 /* first and foremost on UNIX */
+#define L_FORT 2 /* the oldest one */
+#define L_MAKE 3 /* Makefiles */
+#define L_PLI 4 /* PL/1 */
+#define L_MACH 5 /* some kinda assembler */
+#define L_ENG 6 /* English */
+#define L_PAS 7 /* Pascal */
+#define L_MAIL 8 /* Electronic mail */
+#define L_NEWS 9 /* Usenet Netnews */
+
+static char *types[] =
+{
+ "text/html", /* HTML */
+ "text/plain", /* "c program text", */
+ "text/plain", /* "fortran program text", */
+ "text/plain", /* "make commands text", */
+ "text/plain", /* "pl/1 program text", */
+ "text/plain", /* "assembler program text", */
+ "text/plain", /* "English text", */
+ "text/plain", /* "pascal program text", */
+ "message/rfc822", /* "mail text", */
+ "message/news", /* "news text", */
+ "application/binary", /* "can't happen error on names.h/types", */
+ 0
+};
+
+static struct names {
+ char *name;
+ short type;
+} names[] = {
+
+ /* These must be sorted by eye for optimal hit rate */
+ /* Add to this list only after substantial meditation */
+ {
+ "<html>", L_HTML
+ },
+ {
+ "<HTML>", L_HTML
+ },
+ {
+ "<head>", L_HTML
+ },
+ {
+ "<HEAD>", L_HTML
+ },
+ {
+ "<title>", L_HTML
+ },
+ {
+ "<TITLE>", L_HTML
+ },
+ {
+ "<h1>", L_HTML
+ },
+ {
+ "<H1>", L_HTML
+ },
+ {
+ "<!--", L_HTML
+ },
+ {
+ "<!DOCTYPE HTML", L_HTML
+ },
+ {
+ "/*", L_C
+ }, /* must precede "The", "the", etc. */
+ {
+ "#include", L_C
+ },
+ {
+ "char", L_C
+ },
+ {
+ "The", L_ENG
+ },
+ {
+ "the", L_ENG
+ },
+ {
+ "double", L_C
+ },
+ {
+ "extern", L_C
+ },
+ {
+ "float", L_C
+ },
+ {
+ "real", L_C
+ },
+ {
+ "struct", L_C
+ },
+ {
+ "union", L_C
+ },
+ {
+ "CFLAGS", L_MAKE
+ },
+ {
+ "LDFLAGS", L_MAKE
+ },
+ {
+ "all:", L_MAKE
+ },
+ {
+ ".PRECIOUS", L_MAKE
+ },
+ /*
+ * Too many files of text have these words in them. Find another way to
+ * recognize Fortrash.
+ */
+#ifdef NOTDEF
+ {
+ "subroutine", L_FORT
+ },
+ {
+ "function", L_FORT
+ },
+ {
+ "block", L_FORT
+ },
+ {
+ "common", L_FORT
+ },
+ {
+ "dimension", L_FORT
+ },
+ {
+ "integer", L_FORT
+ },
+ {
+ "data", L_FORT
+ },
+#endif /* NOTDEF */
+ {
+ ".ascii", L_MACH
+ },
+ {
+ ".asciiz", L_MACH
+ },
+ {
+ ".byte", L_MACH
+ },
+ {
+ ".even", L_MACH
+ },
+ {
+ ".globl", L_MACH
+ },
+ {
+ "clr", L_MACH
+ },
+ {
+ "(input,", L_PAS
+ },
+ {
+ "dcl", L_PLI
+ },
+ {
+ "Received:", L_MAIL
+ },
+ {
+ ">From", L_MAIL
+ },
+ {
+ "Return-Path:", L_MAIL
+ },
+ {
+ "Cc:", L_MAIL
+ },
+ {
+ "Newsgroups:", L_NEWS
+ },
+ {
+ "Path:", L_NEWS
+ },
+ {
+ "Organization:", L_NEWS
+ },
+ {
+ NULL, 0
+ }
+};
+
+#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)
+
+/*
+ * Result String List (RSL)
+ *
+ * The file(1) command prints its output. Instead, we store the various
+ * "printed" strings in a list (allocating memory as we go) and concatenate
+ * them at the end when we finally know how much space they'll need.
+ */
+
+typedef struct magic_rsl_s {
+ char *str; /* string, possibly a fragment */
+ struct magic_rsl_s *next; /* pointer to next fragment */
+} magic_rsl;
+
+/*
+ * Apache module configuration structures
+ */
+
+/* per-server info */
+typedef struct {
+ const char *magicfile; /* where magic be found */
+ struct magic *magic; /* head of magic config list */
+ struct magic *last;
+} magic_server_config_rec;
+
+/* per-request info */
+typedef struct {
+ magic_rsl *head; /* result string list */
+ magic_rsl *tail;
+ unsigned suf_recursion; /* recursion depth in suffix check */
+} magic_req_rec;
+
+/*
+ * configuration functions - called by Apache API routines
+ */
+
+module AP_MODULE_DECLARE_DATA mime_magic_module;
+
+static void *create_magic_server_config(apr_pool_t *p, server_rec *d)
+{
+ /* allocate the config - use pcalloc because it needs to be zeroed */
+ return apr_pcalloc(p, sizeof(magic_server_config_rec));
+}
+
+static void *merge_magic_server_config(apr_pool_t *p, void *basev, void *addv)
+{
+ magic_server_config_rec *base = (magic_server_config_rec *) basev;
+ magic_server_config_rec *add = (magic_server_config_rec *) addv;
+ magic_server_config_rec *new = (magic_server_config_rec *)
+ apr_palloc(p, sizeof(magic_server_config_rec));
+
+ new->magicfile = add->magicfile ? add->magicfile : base->magicfile;
+ new->magic = NULL;
+ new->last = NULL;
+ return new;
+}
+
+static const char *set_magicfile(cmd_parms *cmd, void *dummy, const char *arg)
+{
+ magic_server_config_rec *conf = (magic_server_config_rec *)
+ ap_get_module_config(cmd->server->module_config,
+ &mime_magic_module);
+
+ if (!conf) {
+ return MODNAME ": server structure not allocated";
+ }
+ conf->magicfile = arg;
+ return NULL;
+}
+
+/*
+ * configuration file commands - exported to Apache API
+ */
+
+static const command_rec mime_magic_cmds[] =
+{
+ AP_INIT_TAKE1("MimeMagicFile", set_magicfile, NULL, RSRC_CONF,
+ "Path to MIME Magic file (in file(1) format)"),
+ {NULL}
+};
+
+/*
+ * RSL (result string list) processing routines
+ *
+ * These collect strings that would have been printed in fragments by file(1)
+ * into a list of magic_rsl structures with the strings. When complete,
+ * they're concatenated together to become the MIME content and encoding
+ * types.
+ *
+ * return value conventions for these functions: functions which return int:
+ * failure = -1, other = result functions which return pointers: failure = 0,
+ * other = result
+ */
+
+/* allocate a per-request structure and put it in the request record */
+static magic_req_rec *magic_set_config(request_rec *r)
+{
+ magic_req_rec *req_dat = (magic_req_rec *) apr_palloc(r->pool,
+ sizeof(magic_req_rec));
+
+ req_dat->head = req_dat->tail = (magic_rsl *) NULL;
+ ap_set_module_config(r->request_config, &mime_magic_module, req_dat);
+ return req_dat;
+}
+
+/* add a string to the result string list for this request */
+/* it is the responsibility of the caller to allocate "str" */
+static int magic_rsl_add(request_rec *r, char *str)
+{
+ magic_req_rec *req_dat = (magic_req_rec *)
+ ap_get_module_config(r->request_config, &mime_magic_module);
+ magic_rsl *rsl;
+
+ /* make sure we have a list to put it in */
+ if (!req_dat) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_EINVAL, r,
+ MODNAME ": request config should not be NULL");
+ if (!(req_dat = magic_set_config(r))) {
+ /* failure */
+ return -1;
+ }
+ }
+
+ /* allocate the list entry */
+ rsl = (magic_rsl *) apr_palloc(r->pool, sizeof(magic_rsl));
+
+ /* fill it */
+ rsl->str = str;
+ rsl->next = (magic_rsl *) NULL;
+
+ /* append to the list */
+ if (req_dat->head && req_dat->tail) {
+ req_dat->tail->next = rsl;
+ req_dat->tail = rsl;
+ }
+ else {
+ req_dat->head = req_dat->tail = rsl;
+ }
+
+ /* success */
+ return 0;
+}
+
+/* RSL hook for puts-type functions */
+static int magic_rsl_puts(request_rec *r, char *str)
+{
+ return magic_rsl_add(r, str);
+}
+
+/* RSL hook for printf-type functions */
+static int magic_rsl_printf(request_rec *r, char *str,...)
+{
+ va_list ap;
+
+ char buf[MAXMIMESTRING];
+
+ /* assemble the string into the buffer */
+ va_start(ap, str);
+ apr_vsnprintf(buf, sizeof(buf), str, ap);
+ va_end(ap);
+
+ /* add the buffer to the list */
+ return magic_rsl_add(r, apr_pstrdup(r->pool, buf));
+}
+
+/* RSL hook for putchar-type functions */
+static int magic_rsl_putchar(request_rec *r, char c)
+{
+ char str[2];
+
+ /* high overhead for 1 char - just hope they don't do this much */
+ str[0] = c;
+ str[1] = '\0';
+ return magic_rsl_add(r, str);
+}
+
+/* allocate and copy a contiguous string from a result string list */
+static char *rsl_strdup(request_rec *r, int start_frag, int start_pos, int len)
+{
+ char *result; /* return value */
+ int cur_frag, /* current fragment number/counter */
+ cur_pos, /* current position within fragment */
+ res_pos; /* position in result string */
+ magic_rsl *frag; /* list-traversal pointer */
+ magic_req_rec *req_dat = (magic_req_rec *)
+ ap_get_module_config(r->request_config, &mime_magic_module);
+
+ /* allocate the result string */
+ result = (char *) apr_palloc(r->pool, len + 1);
+
+ /* loop through and collect the string */
+ res_pos = 0;
+ for (frag = req_dat->head, cur_frag = 0;
+ frag->next;
+ frag = frag->next, cur_frag++) {
+ /* loop to the first fragment */
+ if (cur_frag < start_frag)
+ continue;
+
+ /* loop through and collect chars */
+ for (cur_pos = (cur_frag == start_frag) ? start_pos : 0;
+ frag->str[cur_pos];
+ cur_pos++) {
+ if (cur_frag >= start_frag
+ && cur_pos >= start_pos
+ && res_pos <= len) {
+ result[res_pos++] = frag->str[cur_pos];
+ if (res_pos > len) {
+ break;
+ }
+ }
+ }
+ }
+
+ /* clean up and return */
+ result[res_pos] = 0;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": rsl_strdup() %d chars: %s", res_pos - 1, result);
+#endif
+ return result;
+}
+
+/* states for the state-machine algorithm in magic_rsl_to_request() */
+typedef enum {
+ rsl_leading_space, rsl_type, rsl_subtype, rsl_separator, rsl_encoding
+} rsl_states;
+
+/* process the RSL and set the MIME info in the request record */
+static int magic_rsl_to_request(request_rec *r)
+{
+ int cur_frag, /* current fragment number/counter */
+ cur_pos, /* current position within fragment */
+ type_frag, /* content type starting point: fragment */
+ type_pos, /* content type starting point: position */
+ type_len, /* content type length */
+ encoding_frag, /* content encoding starting point: fragment */
+ encoding_pos, /* content encoding starting point: position */
+ encoding_len; /* content encoding length */
+
+ magic_rsl *frag; /* list-traversal pointer */
+ rsl_states state;
+
+ magic_req_rec *req_dat = (magic_req_rec *)
+ ap_get_module_config(r->request_config, &mime_magic_module);
+
+ /* check if we have a result */
+ if (!req_dat || !req_dat->head) {
+ /* empty - no match, we defer to other Apache modules */
+ return DECLINED;
+ }
+
+ /* start searching for the type and encoding */
+ state = rsl_leading_space;
+ type_frag = type_pos = type_len = 0;
+ encoding_frag = encoding_pos = encoding_len = 0;
+ for (frag = req_dat->head, cur_frag = 0;
+ frag && frag->next;
+ frag = frag->next, cur_frag++) {
+ /* loop through the characters in the fragment */
+ for (cur_pos = 0; frag->str[cur_pos]; cur_pos++) {
+ if (apr_isspace(frag->str[cur_pos])) {
+ /* process whitespace actions for each state */
+ if (state == rsl_leading_space) {
+ /* eat whitespace in this state */
+ continue;
+ }
+ else if (state == rsl_type) {
+ /* whitespace: type has no slash! */
+ return DECLINED;
+ }
+ else if (state == rsl_subtype) {
+ /* whitespace: end of MIME type */
+ state++;
+ continue;
+ }
+ else if (state == rsl_separator) {
+ /* eat whitespace in this state */
+ continue;
+ }
+ else if (state == rsl_encoding) {
+ /* whitespace: end of MIME encoding */
+ /* we're done */
+ frag = req_dat->tail;
+ break;
+ }
+ else {
+ /* should not be possible */
+ /* abandon malfunctioning module */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": bad state %d (ws)", state);
+ return DECLINED;
+ }
+ /* NOTREACHED */
+ }
+ else if (state == rsl_type &&
+ frag->str[cur_pos] == '/') {
+ /* copy the char and go to rsl_subtype state */
+ type_len++;
+ state++;
+ }
+ else {
+ /* process non-space actions for each state */
+ if (state == rsl_leading_space) {
+ /* non-space: begin MIME type */
+ state++;
+ type_frag = cur_frag;
+ type_pos = cur_pos;
+ type_len = 1;
+ continue;
+ }
+ else if (state == rsl_type ||
+ state == rsl_subtype) {
+ /* non-space: adds to type */
+ type_len++;
+ continue;
+ }
+ else if (state == rsl_separator) {
+ /* non-space: begin MIME encoding */
+ state++;
+ encoding_frag = cur_frag;
+ encoding_pos = cur_pos;
+ encoding_len = 1;
+ continue;
+ }
+ else if (state == rsl_encoding) {
+ /* non-space: adds to encoding */
+ encoding_len++;
+ continue;
+ }
+ else {
+ /* should not be possible */
+ /* abandon malfunctioning module */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": bad state %d (ns)", state);
+ return DECLINED;
+ }
+ /* NOTREACHED */
+ }
+ /* NOTREACHED */
+ }
+ }
+
+ /* if we ended prior to state rsl_subtype, we had incomplete info */
+ if (state != rsl_subtype && state != rsl_separator &&
+ state != rsl_encoding) {
+ /* defer to other modules */
+ return DECLINED;
+ }
+
+ /* save the info in the request record */
+ if (state == rsl_subtype || state == rsl_encoding ||
+ state == rsl_encoding) {
+ char *tmp;
+ tmp = rsl_strdup(r, type_frag, type_pos, type_len);
+ /* XXX: this could be done at config time I'm sure... but I'm
+ * confused by all this magic_rsl stuff. -djg */
+ ap_content_type_tolower(tmp);
+ ap_set_content_type(r, tmp);
+ }
+ if (state == rsl_encoding) {
+ char *tmp;
+ tmp = rsl_strdup(r, encoding_frag,
+ encoding_pos, encoding_len);
+ /* XXX: this could be done at config time I'm sure... but I'm
+ * confused by all this magic_rsl stuff. -djg */
+ ap_str_tolower(tmp);
+ r->content_encoding = tmp;
+ }
+
+ /* detect memory allocation or other errors */
+ if (!r->content_type ||
+ (state == rsl_encoding && !r->content_encoding)) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": unexpected state %d; could be caused by bad "
+ "data in magic file",
+ state);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ /* success! */
+ return OK;
+}
+
+/*
+ * magic_process - process input file r Apache API request record
+ * (formerly called "process" in file command, prefix added for clarity) Opens
+ * the file and reads a fixed-size buffer to begin processing the contents.
+ */
+static int magic_process(request_rec *r)
+{
+ apr_file_t *fd = NULL;
+ unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */
+ apr_size_t nbytes = 0; /* number of bytes read from a datafile */
+ int result;
+
+ /*
+ * first try judging the file based on its filesystem status
+ */
+ switch ((result = fsmagic(r, r->filename))) {
+ case DONE:
+ magic_rsl_putchar(r, '\n');
+ return OK;
+ case OK:
+ break;
+ default:
+ /* fatal error, bail out */
+ return result;
+ }
+
+ if (apr_file_open(&fd, r->filename, APR_READ, APR_OS_DEFAULT, r->pool) != APR_SUCCESS) {
+ /* We can't open it, but we were able to stat it. */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": can't read `%s'", r->filename);
+ /* let some other handler decide what the problem is */
+ return DECLINED;
+ }
+
+ /*
+ * try looking at the first HOWMANY bytes
+ */
+ nbytes = sizeof(buf) - 1;
+ if ((result = apr_file_read(fd, (char *) buf, &nbytes)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, result, r,
+ MODNAME ": read failed: %s", r->filename);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ if (nbytes == 0) {
+ return DECLINED;
+ }
+ else {
+ buf[nbytes++] = '\0'; /* null-terminate it */
+ result = tryit(r, buf, nbytes, 1);
+ if (result != OK) {
+ return result;
+ }
+ }
+
+ (void) apr_file_close(fd);
+ (void) magic_rsl_putchar(r, '\n');
+
+ return OK;
+}
+
+
+static int tryit(request_rec *r, unsigned char *buf, apr_size_t nb,
+ int checkzmagic)
+{
+ /*
+ * Try compression stuff
+ */
+ if (checkzmagic == 1) {
+ if (zmagic(r, buf, nb) == 1)
+ return OK;
+ }
+
+ /*
+ * try tests in /etc/magic (or surrogate magic file)
+ */
+ if (softmagic(r, buf, nb) == 1)
+ return OK;
+
+ /*
+ * try known keywords, check for ascii-ness too.
+ */
+ if (ascmagic(r, buf, nb) == 1)
+ return OK;
+
+ /*
+ * abandon hope, all ye who remain here
+ */
+ return DECLINED;
+}
+
+#define EATAB {while (apr_isspace(*l)) ++l;}
+
+/*
+ * apprentice - load configuration from the magic file r
+ * API request record
+ */
+static int apprentice(server_rec *s, apr_pool_t *p)
+{
+ apr_file_t *f = NULL;
+ apr_status_t result;
+ char line[BUFSIZ + 1];
+ int errs = 0;
+ int lineno;
+#if MIME_MAGIC_DEBUG
+ int rule = 0;
+ struct magic *m, *prevm;
+#endif
+ magic_server_config_rec *conf = (magic_server_config_rec *)
+ ap_get_module_config(s->module_config, &mime_magic_module);
+ const char *fname = ap_server_root_relative(p, conf->magicfile);
+
+ if (!fname) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
+ MODNAME ": Invalid magic file path %s", conf->magicfile);
+ return -1;
+ }
+ if ((result = apr_file_open(&f, fname, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, p) != APR_SUCCESS)) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, result, s,
+ MODNAME ": can't read magic file %s", fname);
+ return -1;
+ }
+
+ /* set up the magic list (empty) */
+ conf->magic = conf->last = NULL;
+
+ /* parse it */
+ for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) {
+ int ws_offset;
+ char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an
+ * "empty" line contains a '\n'
+ */
+
+ /* delete newline and any other trailing whitespace */
+ while (last >= line
+ && apr_isspace(*last)) {
+ *last = '\0';
+ --last;
+ }
+
+ /* skip leading whitespace */
+ ws_offset = 0;
+ while (line[ws_offset] && apr_isspace(line[ws_offset])) {
+ ws_offset++;
+ }
+
+ /* skip blank lines */
+ if (line[ws_offset] == 0) {
+ continue;
+ }
+
+ /* comment, do not parse */
+ if (line[ws_offset] == '#')
+ continue;
+
+#if MIME_MAGIC_DEBUG
+ /* if we get here, we're going to use it so count it */
+ rule++;
+#endif
+
+ /* parse it */
+ if (parse(s, p, line + ws_offset, lineno) != 0)
+ ++errs;
+ }
+
+ (void) apr_file_close(f);
+
+#if MIME_MAGIC_DEBUG
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": apprentice conf=%x file=%s m=%s m->next=%s last=%s",
+ conf,
+ conf->magicfile ? conf->magicfile : "NULL",
+ conf->magic ? "set" : "NULL",
+ (conf->magic && conf->magic->next) ? "set" : "NULL",
+ conf->last ? "set" : "NULL");
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": apprentice read %d lines, %d rules, %d errors",
+ lineno, rule, errs);
+#endif
+
+#if MIME_MAGIC_DEBUG
+ prevm = 0;
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": apprentice test");
+ for (m = conf->magic; m; m = m->next) {
+ if (apr_isprint((((unsigned long) m) >> 24) & 255) &&
+ apr_isprint((((unsigned long) m) >> 16) & 255) &&
+ apr_isprint((((unsigned long) m) >> 8) & 255) &&
+ apr_isprint(((unsigned long) m) & 255)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": apprentice: POINTER CLOBBERED! "
+ "m=\"%c%c%c%c\" line=%d",
+ (((unsigned long) m) >> 24) & 255,
+ (((unsigned long) m) >> 16) & 255,
+ (((unsigned long) m) >> 8) & 255,
+ ((unsigned long) m) & 255,
+ prevm ? prevm->lineno : -1);
+ break;
+ }
+ prevm = m;
+ }
+#endif
+
+ return (errs ? -1 : 0);
+}
+
+/*
+ * extend the sign bit if the comparison is to be signed
+ */
+static unsigned long signextend(server_rec *s, struct magic *m, unsigned long v)
+{
+ if (!(m->flag & UNSIGNED))
+ switch (m->type) {
+ /*
+ * Do not remove the casts below. They are vital. When later
+ * compared with the data, the sign extension must have happened.
+ */
+ case BYTE:
+ v = (char) v;
+ break;
+ case SHORT:
+ case BESHORT:
+ case LESHORT:
+ v = (short) v;
+ break;
+ case DATE:
+ case BEDATE:
+ case LEDATE:
+ case LONG:
+ case BELONG:
+ case LELONG:
+ v = (long) v;
+ break;
+ case STRING:
+ break;
+ default:
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+ MODNAME ": can't happen: m->type=%d", m->type);
+ return -1;
+ }
+ return v;
+}
+
+/*
+ * parse one line from magic file, put into magic[index++] if valid
+ */
+static int parse(server_rec *serv, apr_pool_t *p, char *l, int lineno)
+{
+ struct magic *m;
+ char *t, *s;
+ magic_server_config_rec *conf = (magic_server_config_rec *)
+ ap_get_module_config(serv->module_config, &mime_magic_module);
+
+ /* allocate magic structure entry */
+ m = (struct magic *) apr_pcalloc(p, sizeof(struct magic));
+
+ /* append to linked list */
+ m->next = NULL;
+ if (!conf->magic || !conf->last) {
+ conf->magic = conf->last = m;
+ }
+ else {
+ conf->last->next = m;
+ conf->last = m;
+ }
+
+ /* set values in magic structure */
+ m->flag = 0;
+ m->cont_level = 0;
+ m->lineno = lineno;
+
+ while (*l == '>') {
+ ++l; /* step over */
+ m->cont_level++;
+ }
+
+ if (m->cont_level != 0 && *l == '(') {
+ ++l; /* step over */
+ m->flag |= INDIR;
+ }
+
+ /* get offset, then skip over it */
+ m->offset = (int) strtol(l, &t, 0);
+ if (l == t) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv,
+ MODNAME ": offset %s invalid", l);
+ }
+ l = t;
+
+ if (m->flag & INDIR) {
+ m->in.type = LONG;
+ m->in.offset = 0;
+ /*
+ * read [.lbs][+-]nnnnn)
+ */
+ if (*l == '.') {
+ switch (*++l) {
+ case 'l':
+ m->in.type = LONG;
+ break;
+ case 's':
+ m->in.type = SHORT;
+ break;
+ case 'b':
+ m->in.type = BYTE;
+ break;
+ default:
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv,
+ MODNAME ": indirect offset type %c invalid", *l);
+ break;
+ }
+ l++;
+ }
+ s = l;
+ if (*l == '+' || *l == '-')
+ l++;
+ if (apr_isdigit((unsigned char) *l)) {
+ m->in.offset = strtol(l, &t, 0);
+ if (*s == '-')
+ m->in.offset = -m->in.offset;
+ }
+ else
+ t = l;
+ if (*t++ != ')') {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv,
+ MODNAME ": missing ')' in indirect offset");
+ }
+ l = t;
+ }
+
+
+ while (apr_isdigit((unsigned char) *l))
+ ++l;
+ EATAB;
+
+#define NBYTE 4
+#define NSHORT 5
+#define NLONG 4
+#define NSTRING 6
+#define NDATE 4
+#define NBESHORT 7
+#define NBELONG 6
+#define NBEDATE 6
+#define NLESHORT 7
+#define NLELONG 6
+#define NLEDATE 6
+
+ if (*l == 'u') {
+ ++l;
+ m->flag |= UNSIGNED;
+ }
+
+ /* get type, skip it */
+ if (strncmp(l, "byte", NBYTE) == 0) {
+ m->type = BYTE;
+ l += NBYTE;
+ }
+ else if (strncmp(l, "short", NSHORT) == 0) {
+ m->type = SHORT;
+ l += NSHORT;
+ }
+ else if (strncmp(l, "long", NLONG) == 0) {
+ m->type = LONG;
+ l += NLONG;
+ }
+ else if (strncmp(l, "string", NSTRING) == 0) {
+ m->type = STRING;
+ l += NSTRING;
+ }
+ else if (strncmp(l, "date", NDATE) == 0) {
+ m->type = DATE;
+ l += NDATE;
+ }
+ else if (strncmp(l, "beshort", NBESHORT) == 0) {
+ m->type = BESHORT;
+ l += NBESHORT;
+ }
+ else if (strncmp(l, "belong", NBELONG) == 0) {
+ m->type = BELONG;
+ l += NBELONG;
+ }
+ else if (strncmp(l, "bedate", NBEDATE) == 0) {
+ m->type = BEDATE;
+ l += NBEDATE;
+ }
+ else if (strncmp(l, "leshort", NLESHORT) == 0) {
+ m->type = LESHORT;
+ l += NLESHORT;
+ }
+ else if (strncmp(l, "lelong", NLELONG) == 0) {
+ m->type = LELONG;
+ l += NLELONG;
+ }
+ else if (strncmp(l, "ledate", NLEDATE) == 0) {
+ m->type = LEDATE;
+ l += NLEDATE;
+ }
+ else {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv,
+ MODNAME ": type %s invalid", l);
+ return -1;
+ }
+ /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
+ if (*l == '&') {
+ ++l;
+ m->mask = signextend(serv, m, strtol(l, &l, 0));
+ }
+ else
+ m->mask = ~0L;
+ EATAB;
+
+ switch (*l) {
+ case '>':
+ case '<':
+ /* Old-style anding: "0 byte &0x80 dynamically linked" */
+ case '&':
+ case '^':
+ case '=':
+ m->reln = *l;
+ ++l;
+ break;
+ case '!':
+ if (m->type != STRING) {
+ m->reln = *l;
+ ++l;
+ break;
+ }
+ /* FALL THROUGH */
+ default:
+ if (*l == 'x' && apr_isspace(l[1])) {
+ m->reln = *l;
+ ++l;
+ goto GetDesc; /* Bill The Cat */
+ }
+ m->reln = '=';
+ break;
+ }
+ EATAB;
+
+ if (getvalue(serv, m, &l))
+ return -1;
+ /*
+ * now get last part - the description
+ */
+ GetDesc:
+ EATAB;
+ if (l[0] == '\b') {
+ ++l;
+ m->nospflag = 1;
+ }
+ else if ((l[0] == '\\') && (l[1] == 'b')) {
+ ++l;
+ ++l;
+ m->nospflag = 1;
+ }
+ else
+ m->nospflag = 0;
+ strncpy(m->desc, l, sizeof(m->desc) - 1);
+ m->desc[sizeof(m->desc) - 1] = '\0';
+
+#if MIME_MAGIC_DEBUG
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, serv,
+ MODNAME ": parse line=%d m=%x next=%x cont=%d desc=%s",
+ lineno, m, m->next, m->cont_level, m->desc);
+#endif /* MIME_MAGIC_DEBUG */
+
+ return 0;
+}
+
+/*
+ * Read a numeric value from a pointer, into the value union of a magic
+ * pointer, according to the magic type. Update the string pointer to point
+ * just after the number read. Return 0 for success, non-zero for failure.
+ */
+static int getvalue(server_rec *s, struct magic *m, char **p)
+{
+ int slen;
+
+ if (m->type == STRING) {
+ *p = getstr(s, *p, m->value.s, sizeof(m->value.s), &slen);
+ m->vallen = slen;
+ }
+ else if (m->reln != 'x')
+ m->value.l = signextend(s, m, strtol(*p, p, 0));
+ return 0;
+}
+
+/*
+ * Convert a string containing C character escapes. Stop at an unescaped
+ * space or tab. Copy the converted version to "p", returning its length in
+ * *slen. Return updated scan pointer as function result.
+ */
+static char *getstr(server_rec *serv, register char *s, register char *p,
+ int plen, int *slen)
+{
+ char *origs = s, *origp = p;
+ char *pmax = p + plen - 1;
+ register int c;
+ register int val;
+
+ while ((c = *s++) != '\0') {
+ if (apr_isspace(c))
+ break;
+ if (p >= pmax) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv,
+ MODNAME ": string too long: %s", origs);
+ break;
+ }
+ if (c == '\\') {
+ switch (c = *s++) {
+
+ case '\0':
+ goto out;
+
+ default:
+ *p++ = (char) c;
+ break;
+
+ case 'n':
+ *p++ = '\n';
+ break;
+
+ case 'r':
+ *p++ = '\r';
+ break;
+
+ case 'b':
+ *p++ = '\b';
+ break;
+
+ case 't':
+ *p++ = '\t';
+ break;
+
+ case 'f':
+ *p++ = '\f';
+ break;
+
+ case 'v':
+ *p++ = '\v';
+ break;
+
+ /* \ and up to 3 octal digits */
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ val = c - '0';
+ c = *s++; /* try for 2 */
+ if (c >= '0' && c <= '7') {
+ val = (val << 3) | (c - '0');
+ c = *s++; /* try for 3 */
+ if (c >= '0' && c <= '7')
+ val = (val << 3) | (c - '0');
+ else
+ --s;
+ }
+ else
+ --s;
+ *p++ = (char) val;
+ break;
+
+ /* \x and up to 3 hex digits */
+ case 'x':
+ val = 'x'; /* Default if no digits */
+ c = hextoint(*s++); /* Get next char */
+ if (c >= 0) {
+ val = c;
+ c = hextoint(*s++);
+ if (c >= 0) {
+ val = (val << 4) + c;
+ c = hextoint(*s++);
+ if (c >= 0) {
+ val = (val << 4) + c;
+ }
+ else
+ --s;
+ }
+ else
+ --s;
+ }
+ else
+ --s;
+ *p++ = (char) val;
+ break;
+ }
+ }
+ else
+ *p++ = (char) c;
+ }
+ out:
+ *p = '\0';
+ *slen = p - origp;
+ return s;
+}
+
+
+/* Single hex char to int; -1 if not a hex char. */
+static int hextoint(int c)
+{
+ if (apr_isdigit(c))
+ return c - '0';
+ if ((c >= 'a') && (c <= 'f'))
+ return c + 10 - 'a';
+ if ((c >= 'A') && (c <= 'F'))
+ return c + 10 - 'A';
+ return -1;
+}
+
+
+/*
+ * return DONE to indicate it's been handled
+ * return OK to indicate it's a regular file still needing handling
+ * other returns indicate a failure of some sort
+ */
+static int fsmagic(request_rec *r, const char *fn)
+{
+ switch (r->finfo.filetype) {
+ case APR_DIR:
+ magic_rsl_puts(r, DIR_MAGIC_TYPE);
+ return DONE;
+ case APR_CHR:
+ /*
+ * (void) magic_rsl_printf(r,"character special (%d/%d)",
+ * major(sb->st_rdev), minor(sb->st_rdev));
+ */
+ (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);
+ return DONE;
+ case APR_BLK:
+ /*
+ * (void) magic_rsl_printf(r,"block special (%d/%d)",
+ * major(sb->st_rdev), minor(sb->st_rdev));
+ */
+ (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);
+ return DONE;
+ /* TODO add code to handle V7 MUX and Blit MUX files */
+ case APR_PIPE:
+ /*
+ * magic_rsl_puts(r,"fifo (named pipe)");
+ */
+ (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);
+ return DONE;
+ case APR_LNK:
+ /* We used stat(), the only possible reason for this is that the
+ * symlink is broken.
+ */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": broken symlink (%s)", fn);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ case APR_SOCK:
+ magic_rsl_puts(r, MIME_BINARY_UNKNOWN);
+ return DONE;
+ case APR_REG:
+ break;
+ default:
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": invalid file type %d.", r->finfo.filetype);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ /*
+ * regular file, check next possibility
+ */
+ if (r->finfo.size == 0) {
+ magic_rsl_puts(r, MIME_TEXT_UNKNOWN);
+ return DONE;
+ }
+ return OK;
+}
+
+/*
+ * softmagic - lookup one file in database (already read from /etc/magic by
+ * apprentice.c). Passed the name and FILE * of one file to be typed.
+ */
+ /* ARGSUSED1 *//* nbytes passed for regularity, maybe need later */
+static int softmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)
+{
+ if (match(r, buf, nbytes))
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Go through the whole list, stopping if you find a match. Process all the
+ * continuations of that match before returning.
+ *
+ * We support multi-level continuations:
+ *
+ * At any time when processing a successful top-level match, there is a current
+ * continuation level; it represents the level of the last successfully
+ * matched continuation.
+ *
+ * Continuations above that level are skipped as, if we see one, it means that
+ * the continuation that controls them - i.e, the lower-level continuation
+ * preceding them - failed to match.
+ *
+ * Continuations below that level are processed as, if we see one, it means
+ * we've finished processing or skipping higher-level continuations under the
+ * control of a successful or unsuccessful lower-level continuation, and are
+ * now seeing the next lower-level continuation and should process it. The
+ * current continuation level reverts to the level of the one we're seeing.
+ *
+ * Continuations at the current level are processed as, if we see one, there's
+ * no lower-level continuation that may have failed.
+ *
+ * If a continuation matches, we bump the current continuation level so that
+ * higher-level continuations are processed.
+ */
+static int match(request_rec *r, unsigned char *s, apr_size_t nbytes)
+{
+#if MIME_MAGIC_DEBUG
+ int rule_counter = 0;
+#endif
+ int cont_level = 0;
+ int need_separator = 0;
+ union VALUETYPE p;
+ magic_server_config_rec *conf = (magic_server_config_rec *)
+ ap_get_module_config(r->server->module_config, &mime_magic_module);
+ struct magic *m;
+
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": match conf=%x file=%s m=%s m->next=%s last=%s",
+ conf,
+ conf->magicfile ? conf->magicfile : "NULL",
+ conf->magic ? "set" : "NULL",
+ (conf->magic && conf->magic->next) ? "set" : "NULL",
+ conf->last ? "set" : "NULL");
+#endif
+
+#if MIME_MAGIC_DEBUG
+ for (m = conf->magic; m; m = m->next) {
+ if (apr_isprint((((unsigned long) m) >> 24) & 255) &&
+ apr_isprint((((unsigned long) m) >> 16) & 255) &&
+ apr_isprint((((unsigned long) m) >> 8) & 255) &&
+ apr_isprint(((unsigned long) m) & 255)) {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": match: POINTER CLOBBERED! "
+ "m=\"%c%c%c%c\"",
+ (((unsigned long) m) >> 24) & 255,
+ (((unsigned long) m) >> 16) & 255,
+ (((unsigned long) m) >> 8) & 255,
+ ((unsigned long) m) & 255);
+ break;
+ }
+ }
+#endif
+
+ for (m = conf->magic; m; m = m->next) {
+#if MIME_MAGIC_DEBUG
+ rule_counter++;
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": line=%d desc=%s", m->lineno, m->desc);
+#endif
+
+ /* check if main entry matches */
+ if (!mget(r, &p, s, m, nbytes) ||
+ !mcheck(r, &p, m)) {
+ struct magic *m_cont;
+
+ /*
+ * main entry didn't match, flush its continuations
+ */
+ if (!m->next || (m->next->cont_level == 0)) {
+ continue;
+ }
+
+ m_cont = m->next;
+ while (m_cont && (m_cont->cont_level != 0)) {
+#if MIME_MAGIC_DEBUG
+ rule_counter++;
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": line=%d mc=%x mc->next=%x cont=%d desc=%s",
+ m_cont->lineno, m_cont,
+ m_cont->next, m_cont->cont_level,
+ m_cont->desc);
+#endif
+ /*
+ * this trick allows us to keep *m in sync when the continue
+ * advances the pointer
+ */
+ m = m_cont;
+ m_cont = m_cont->next;
+ }
+ continue;
+ }
+
+ /* if we get here, the main entry rule was a match */
+ /* this will be the last run through the loop */
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": rule matched, line=%d type=%d %s",
+ m->lineno, m->type,
+ (m->type == STRING) ? m->value.s : "");
+#endif
+
+ /* print the match */
+ mprint(r, &p, m);
+
+ /*
+ * If we printed something, we'll need to print a blank before we
+ * print something else.
+ */
+ if (m->desc[0])
+ need_separator = 1;
+ /* and any continuations that match */
+ cont_level++;
+ /*
+ * while (m && m->next && m->next->cont_level != 0 && ( m = m->next
+ * ))
+ */
+ m = m->next;
+ while (m && (m->cont_level != 0)) {
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": match line=%d cont=%d type=%d %s",
+ m->lineno, m->cont_level, m->type,
+ (m->type == STRING) ? m->value.s : "");
+#endif
+ if (cont_level >= m->cont_level) {
+ if (cont_level > m->cont_level) {
+ /*
+ * We're at the end of the level "cont_level"
+ * continuations.
+ */
+ cont_level = m->cont_level;
+ }
+ if (mget(r, &p, s, m, nbytes) &&
+ mcheck(r, &p, m)) {
+ /*
+ * This continuation matched. Print its message, with a
+ * blank before it if the previous item printed and this
+ * item isn't empty.
+ */
+ /* space if previous printed */
+ if (need_separator
+ && (m->nospflag == 0)
+ && (m->desc[0] != '\0')
+ ) {
+ (void) magic_rsl_putchar(r, ' ');
+ need_separator = 0;
+ }
+ mprint(r, &p, m);
+ if (m->desc[0])
+ need_separator = 1;
+
+ /*
+ * If we see any continuations at a higher level, process
+ * them.
+ */
+ cont_level++;
+ }
+ }
+
+ /* move to next continuation record */
+ m = m->next;
+ }
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": matched after %d rules", rule_counter);
+#endif
+ return 1; /* all through */
+ }
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": failed after %d rules", rule_counter);
+#endif
+ return 0; /* no match at all */
+}
+
+static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)
+{
+ char *pp;
+ unsigned long v;
+ char time_str[APR_CTIME_LEN];
+
+ switch (m->type) {
+ case BYTE:
+ v = p->b;
+ break;
+
+ case SHORT:
+ case BESHORT:
+ case LESHORT:
+ v = p->h;
+ break;
+
+ case LONG:
+ case BELONG:
+ case LELONG:
+ v = p->l;
+ break;
+
+ case STRING:
+ if (m->reln == '=') {
+ (void) magic_rsl_printf(r, m->desc, m->value.s);
+ }
+ else {
+ (void) magic_rsl_printf(r, m->desc, p->s);
+ }
+ return;
+
+ case DATE:
+ case BEDATE:
+ case LEDATE:
+ apr_ctime(time_str, apr_time_from_sec(*(time_t *)&p->l));
+ pp = time_str;
+ (void) magic_rsl_printf(r, m->desc, pp);
+ return;
+ default:
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": invalid m->type (%d) in mprint().",
+ m->type);
+ return;
+ }
+
+ v = signextend(r->server, m, v) & m->mask;
+ (void) magic_rsl_printf(r, m->desc, (unsigned long) v);
+}
+
+/*
+ * Convert the byte order of the data we are looking at
+ */
+static int mconvert(request_rec *r, union VALUETYPE *p, struct magic *m)
+{
+ char *rt;
+
+ switch (m->type) {
+ case BYTE:
+ case SHORT:
+ case LONG:
+ case DATE:
+ return 1;
+ case STRING:
+ /* Null terminate and eat the return */
+ p->s[sizeof(p->s) - 1] = '\0';
+ if ((rt = strchr(p->s, '\n')) != NULL)
+ *rt = '\0';
+ return 1;
+ case BESHORT:
+ p->h = (short) ((p->hs[0] << 8) | (p->hs[1]));
+ return 1;
+ case BELONG:
+ case BEDATE:
+ p->l = (long)
+ ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3]));
+ return 1;
+ case LESHORT:
+ p->h = (short) ((p->hs[1] << 8) | (p->hs[0]));
+ return 1;
+ case LELONG:
+ case LEDATE:
+ p->l = (long)
+ ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0]));
+ return 1;
+ default:
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": invalid type %d in mconvert().", m->type);
+ return 0;
+ }
+}
+
+
+static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,
+ struct magic *m, apr_size_t nbytes)
+{
+ long offset = m->offset;
+
+ if (offset + sizeof(union VALUETYPE) > nbytes)
+ return 0;
+
+ memcpy(p, s + offset, sizeof(union VALUETYPE));
+
+ if (!mconvert(r, p, m))
+ return 0;
+
+ if (m->flag & INDIR) {
+
+ switch (m->in.type) {
+ case BYTE:
+ offset = p->b + m->in.offset;
+ break;
+ case SHORT:
+ offset = p->h + m->in.offset;
+ break;
+ case LONG:
+ offset = p->l + m->in.offset;
+ break;
+ }
+
+ if (offset + sizeof(union VALUETYPE) > nbytes)
+ return 0;
+
+ memcpy(p, s + offset, sizeof(union VALUETYPE));
+
+ if (!mconvert(r, p, m))
+ return 0;
+ }
+ return 1;
+}
+
+static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)
+{
+ register unsigned long l = m->value.l;
+ register unsigned long v;
+ int matched;
+
+ if ((m->value.s[0] == 'x') && (m->value.s[1] == '\0')) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": BOINK");
+ return 1;
+ }
+
+ switch (m->type) {
+ case BYTE:
+ v = p->b;
+ break;
+
+ case SHORT:
+ case BESHORT:
+ case LESHORT:
+ v = p->h;
+ break;
+
+ case LONG:
+ case BELONG:
+ case LELONG:
+ case DATE:
+ case BEDATE:
+ case LEDATE:
+ v = p->l;
+ break;
+
+ case STRING:
+ l = 0;
+ /*
+ * What we want here is: v = strncmp(m->value.s, p->s, m->vallen);
+ * but ignoring any nulls. bcmp doesn't give -/+/0 and isn't
+ * universally available anyway.
+ */
+ v = 0;
+ {
+ register unsigned char *a = (unsigned char *) m->value.s;
+ register unsigned char *b = (unsigned char *) p->s;
+ register int len = m->vallen;
+
+ while (--len >= 0)
+ if ((v = *b++ - *a++) != 0)
+ break;
+ }
+ break;
+ default:
+ /* bogosity, pretend that it just wasn't a match */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": invalid type %d in mcheck().", m->type);
+ return 0;
+ }
+
+ v = signextend(r->server, m, v) & m->mask;
+
+ switch (m->reln) {
+ case 'x':
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%lu == *any* = 1", v);
+#endif
+ matched = 1;
+ break;
+
+ case '!':
+ matched = v != l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%lu != %lu = %d", v, l, matched);
+#endif
+ break;
+
+ case '=':
+ matched = v == l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%lu == %lu = %d", v, l, matched);
+#endif
+ break;
+
+ case '>':
+ if (m->flag & UNSIGNED) {
+ matched = v > l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%lu > %lu = %d", v, l, matched);
+#endif
+ }
+ else {
+ matched = (long) v > (long) l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%ld > %ld = %d", v, l, matched);
+#endif
+ }
+ break;
+
+ case '<':
+ if (m->flag & UNSIGNED) {
+ matched = v < l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%lu < %lu = %d", v, l, matched);
+#endif
+ }
+ else {
+ matched = (long) v < (long) l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "%ld < %ld = %d", v, l, matched);
+#endif
+ }
+ break;
+
+ case '&':
+ matched = (v & l) == l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "((%lx & %lx) == %lx) = %d", v, l, l, matched);
+#endif
+ break;
+
+ case '^':
+ matched = (v & l) != l;
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "((%lx & %lx) != %lx) = %d", v, l, l, matched);
+#endif
+ break;
+
+ default:
+ /* bogosity, pretend it didn't match */
+ matched = 0;
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ MODNAME ": mcheck: can't happen: invalid relation %d.",
+ m->reln);
+ break;
+ }
+
+ return matched;
+}
+
+/* an optimization over plain strcmp() */
+#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
+
+static int ascmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)
+{
+ int has_escapes = 0;
+ unsigned char *s;
+ char nbuf[HOWMANY + 1]; /* one extra for terminating '\0' */
+ char *token;
+ register struct names *p;
+ int small_nbytes;
+ char *strtok_state;
+
+ /* these are easy, do them first */
+
+ /*
+ * for troff, look for . + letter + letter or .\"; this must be done to
+ * disambiguate tar archives' ./file and other trash from real troff
+ * input.
+ */
+ if (*buf == '.') {
+ unsigned char *tp = buf + 1;
+
+ while (apr_isspace(*tp))
+ ++tp; /* skip leading whitespace */
+ if ((apr_isalnum(*tp) || *tp == '\\') &&
+ (apr_isalnum(*(tp + 1)) || *tp == '"')) {
+ magic_rsl_puts(r, "application/x-troff");
+ return 1;
+ }
+ }
+ if ((*buf == 'c' || *buf == 'C') && apr_isspace(*(buf + 1))) {
+ /* Fortran */
+ magic_rsl_puts(r, "text/plain");
+ return 1;
+ }
+
+ /* look for tokens from names.h - this is expensive!, so we'll limit
+ * ourselves to only SMALL_HOWMANY bytes */
+ small_nbytes = (nbytes > SMALL_HOWMANY) ? SMALL_HOWMANY : nbytes;
+ /* make a copy of the buffer here because apr_strtok() will destroy it */
+ s = (unsigned char *) memcpy(nbuf, buf, small_nbytes);
+ s[small_nbytes] = '\0';
+ has_escapes = (memchr(s, '\033', small_nbytes) != NULL);
+ while ((token = apr_strtok((char *) s, " \t\n\r\f", &strtok_state)) != NULL) {
+ s = NULL; /* make apr_strtok() keep on tokin' */
+ for (p = names; p < names + NNAMES; p++) {
+ if (STREQ(p->name, token)) {
+ magic_rsl_puts(r, types[p->type]);
+ if (has_escapes)
+ magic_rsl_puts(r, " (with escape sequences)");
+ return 1;
+ }
+ }
+ }
+
+ switch (is_tar(buf, nbytes)) {
+ case 1:
+ /* V7 tar archive */
+ magic_rsl_puts(r, "application/x-tar");
+ return 1;
+ case 2:
+ /* POSIX tar archive */
+ magic_rsl_puts(r, "application/x-tar");
+ return 1;
+ }
+
+ /* all else fails, but it is ascii... */
+ return 0;
+}
+
+
+/*
+ * compress routines: zmagic() - returns 0 if not recognized, uncompresses
+ * and prints information if recognized uncompress(s, method, old, n, newch)
+ * - uncompress old into new, using method, return sizeof new
+ */
+
+static struct {
+ char *magic;
+ apr_size_t maglen;
+ char *argv[3];
+ int silent;
+ char *encoding; /* MUST be lowercase */
+} compr[] = {
+
+ /* we use gzip here rather than uncompress because we have to pass
+ * it a full filename -- and uncompress only considers filenames
+ * ending with .Z
+ */
+ {
+ "\037\235", 2, {
+ "gzip", "-dcq", NULL
+ }, 0, "x-compress"
+ },
+ {
+ "\037\213", 2, {
+ "gzip", "-dcq", NULL
+ }, 1, "x-gzip"
+ },
+ /*
+ * XXX pcat does not work, cause I don't know how to make it read stdin,
+ * so we use gzip
+ */
+ {
+ "\037\036", 2, {
+ "gzip", "-dcq", NULL
+ }, 0, "x-gzip"
+ },
+};
+
+static int ncompr = sizeof(compr) / sizeof(compr[0]);
+
+static int zmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)
+{
+ unsigned char *newbuf;
+ int newsize;
+ int i;
+
+ for (i = 0; i < ncompr; i++) {
+ if (nbytes < compr[i].maglen)
+ continue;
+ if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0)
+ break;
+ }
+
+ if (i == ncompr)
+ return 0;
+
+ if ((newsize = uncompress(r, i, &newbuf, nbytes)) > 0) {
+ if (tryit(r, newbuf, newsize, 0) != OK) {
+ return 0;
+ }
+
+ /* set encoding type in the request record */
+ r->content_encoding = compr[i].encoding;
+ }
+ return 1;
+}
+
+
+struct uncompress_parms {
+ request_rec *r;
+ int method;
+};
+
+static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,
+ apr_file_t **pipe_in)
+{
+ int rc = 1;
+ const char *new_argv[4];
+ const char *const *env;
+ request_rec *r = parm->r;
+ apr_pool_t *child_context = cntxt;
+ apr_procattr_t *procattr;
+ apr_proc_t *procnew;
+
+ /* XXX missing 1.3 logic:
+ *
+ * what happens when !compr[parm->method].silent?
+ * Should we create the err pipe, read it, and copy to the log?
+ */
+
+ env = (const char *const *)ap_create_environment(child_context, r->subprocess_env);
+
+ if ((apr_procattr_create(&procattr, child_context) != APR_SUCCESS) ||
+ (apr_procattr_io_set(procattr, APR_FULL_BLOCK,
+ APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) ||
+ (apr_procattr_dir_set(procattr, r->filename) != APR_SUCCESS) ||
+ (apr_procattr_cmdtype_set(procattr, APR_PROGRAM) != APR_SUCCESS)) {
+ /* Something bad happened, tell the world. */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r,
+ "couldn't setup child process: %s", r->filename);
+ }
+ else {
+ new_argv[0] = compr[parm->method].argv[0];
+ new_argv[1] = compr[parm->method].argv[1];
+ new_argv[2] = r->filename;
+ new_argv[3] = NULL;
+
+ procnew = apr_pcalloc(child_context, sizeof(*procnew));
+ rc = apr_proc_create(procnew, compr[parm->method].argv[0],
+ new_argv, env, procattr, child_context);
+
+ if (rc != APR_SUCCESS) {
+ /* Bad things happened. Everyone should have cleaned up. */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r,
+ MODNAME ": could not execute `%s'.",
+ compr[parm->method].argv[0]);
+ }
+ else {
+ apr_pool_note_subprocess(child_context, procnew, APR_KILL_AFTER_TIMEOUT);
+ *pipe_in = procnew->out;
+ }
+ }
+
+ return (rc);
+}
+
+static int uncompress(request_rec *r, int method,
+ unsigned char **newch, apr_size_t n)
+{
+ struct uncompress_parms parm;
+ apr_file_t *pipe_out = NULL;
+ apr_pool_t *sub_context;
+ apr_status_t rv;
+
+ parm.r = r;
+ parm.method = method;
+
+ /* We make a sub_pool so that we can collect our child early, otherwise
+ * there are cases (i.e. generating directory indicies with mod_autoindex)
+ * where we would end up with LOTS of zombies.
+ */
+ if (apr_pool_create(&sub_context, r->pool) != APR_SUCCESS)
+ return -1;
+
+ if ((rv = create_uncompress_child(&parm, sub_context, &pipe_out)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ MODNAME ": couldn't spawn uncompress process: %s", r->uri);
+ return -1;
+ }
+
+ *newch = (unsigned char *) apr_palloc(r->pool, n);
+ rv = apr_file_read(pipe_out, *newch, &n);
+ if (n == 0) {
+ apr_pool_destroy(sub_context);
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ MODNAME ": read failed %s", r->filename);
+ return -1;
+ }
+ apr_pool_destroy(sub_context);
+ return n;
+}
+
+/*
+ * is_tar() -- figure out whether file is a tar archive.
+ *
+ * Stolen (by author of file utility) from the public domain tar program: Public
+ * Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
+ *
+ * @(#)list.c 1.18 9/23/86 Public Domain - gnu $Id: mod_mime_magic.c,v 1.7
+ * 1997/06/24 00:41:02 ikluft Exp ikluft $
+ *
+ * Comments changed and some code/comments reformatted for file command by Ian
+ * Darwin.
+ */
+
+#define isodigit(c) (((unsigned char)(c) >= '0') && ((unsigned char)(c) <= '7'))
+
+/*
+ * Return 0 if the checksum is bad (i.e., probably not a tar archive), 1 for
+ * old UNIX tar file, 2 for Unix Std (POSIX) tar file.
+ */
+
+static int is_tar(unsigned char *buf, apr_size_t nbytes)
+{
+ register union record *header = (union record *) buf;
+ register int i;
+ register long sum, recsum;
+ register char *p;
+
+ if (nbytes < sizeof(union record))
+ return 0;
+
+ recsum = from_oct(8, header->header.chksum);
+
+ sum = 0;
+ p = header->charptr;
+ for (i = sizeof(union record); --i >= 0;) {
+ /*
+ * We can't use unsigned char here because of old compilers, e.g. V7.
+ */
+ sum += 0xFF & *p++;
+ }
+
+ /* Adjust checksum to count the "chksum" field as blanks. */
+ for (i = sizeof(header->header.chksum); --i >= 0;)
+ sum -= 0xFF & header->header.chksum[i];
+ sum += ' ' * sizeof header->header.chksum;
+
+ if (sum != recsum)
+ return 0; /* Not a tar archive */
+
+ if (0 == strcmp(header->header.magic, TMAGIC))
+ return 2; /* Unix Standard tar archive */
+
+ return 1; /* Old fashioned tar archive */
+}
+
+
+/*
+ * Quick and dirty octal conversion.
+ *
+ * Result is -1 if the field is invalid (all blank, or nonoctal).
+ */
+static long from_oct(int digs, char *where)
+{
+ register long value;
+
+ while (apr_isspace(*where)) { /* Skip spaces */
+ where++;
+ if (--digs <= 0)
+ return -1; /* All blank field */
+ }
+ value = 0;
+ while (digs > 0 && isodigit(*where)) { /* Scan til nonoctal */
+ value = (value << 3) | (*where++ - '0');
+ --digs;
+ }
+
+ if (digs > 0 && *where && !apr_isspace(*where))
+ return -1; /* Ended on non-space/nul */
+
+ return value;
+}
+
+/*
+ * Check for file-revision suffix
+ *
+ * This is for an obscure document control system used on an intranet.
+ * The web representation of each file's revision has an @1, @2, etc
+ * appended with the revision number. This needs to be stripped off to
+ * find the file suffix, which can be recognized by sending the name back
+ * through a sub-request. The base file name (without the @num suffix)
+ * must exist because its type will be used as the result.
+ */
+static int revision_suffix(request_rec *r)
+{
+ int suffix_pos, result;
+ char *sub_filename;
+ request_rec *sub;
+
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": revision_suffix checking %s", r->filename);
+#endif /* MIME_MAGIC_DEBUG */
+
+ /* check for recognized revision suffix */
+ suffix_pos = strlen(r->filename) - 1;
+ if (!apr_isdigit(r->filename[suffix_pos])) {
+ return 0;
+ }
+ while (suffix_pos >= 0 && apr_isdigit(r->filename[suffix_pos]))
+ suffix_pos--;
+ if (suffix_pos < 0 || r->filename[suffix_pos] != '@') {
+ return 0;
+ }
+
+ /* perform sub-request for the file name without the suffix */
+ result = 0;
+ sub_filename = apr_pstrndup(r->pool, r->filename, suffix_pos);
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": subrequest lookup for %s", sub_filename);
+#endif /* MIME_MAGIC_DEBUG */
+ sub = ap_sub_req_lookup_file(sub_filename, r, NULL);
+
+ /* extract content type/encoding/language from sub-request */
+ if (sub->content_type) {
+ ap_set_content_type(r, apr_pstrdup(r->pool, sub->content_type));
+#if MIME_MAGIC_DEBUG
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ MODNAME ": subrequest %s got %s",
+ sub_filename, r->content_type);
+#endif /* MIME_MAGIC_DEBUG */
+ if (sub->content_encoding)
+ r->content_encoding =
+ apr_pstrdup(r->pool, sub->content_encoding);
+ if (sub->content_languages) {
+ int n;
+ r->content_languages = apr_array_copy(r->pool,
+ sub->content_languages);
+ for (n = 0; n < r->content_languages->nelts; ++n) {
+ char **lang = ((char **)r->content_languages->elts) + n;
+ *lang = apr_pstrdup(r->pool, *lang);
+ }
+ }
+ result = 1;
+ }
+
+ /* clean up */
+ ap_destroy_sub_req(sub);
+
+ return result;
+}
+
+/*
+ * initialize the module
+ */
+static int magic_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server)
+{
+ int result;
+ magic_server_config_rec *conf;
+ magic_server_config_rec *main_conf;
+ server_rec *s;
+#if MIME_MAGIC_DEBUG
+ struct magic *m, *prevm;
+#endif /* MIME_MAGIC_DEBUG */
+
+ main_conf = ap_get_module_config(main_server->module_config, &mime_magic_module);
+ for (s = main_server; s; s = s->next) {
+ conf = ap_get_module_config(s->module_config, &mime_magic_module);
+ if (conf->magicfile == NULL && s != main_server) {
+ /* inherits from the parent */
+ *conf = *main_conf;
+ }
+ else if (conf->magicfile) {
+ result = apprentice(s, p);
+ if (result == -1)
+ return OK;
+#if MIME_MAGIC_DEBUG
+ prevm = 0;
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": magic_init 1 test");
+ for (m = conf->magic; m; m = m->next) {
+ if (apr_isprint((((unsigned long) m) >> 24) & 255) &&
+ apr_isprint((((unsigned long) m) >> 16) & 255) &&
+ apr_isprint((((unsigned long) m) >> 8) & 255) &&
+ apr_isprint(((unsigned long) m) & 255)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ MODNAME ": magic_init 1: POINTER CLOBBERED! "
+ "m=\"%c%c%c%c\" line=%d",
+ (((unsigned long) m) >> 24) & 255,
+ (((unsigned long) m) >> 16) & 255,
+ (((unsigned long) m) >> 8) & 255,
+ ((unsigned long) m) & 255,
+ prevm ? prevm->lineno : -1);
+ break;
+ }
+ prevm = m;
+ }
+#endif
+ }
+ }
+ return OK;
+}
+
+/*
+ * Find the Content-Type from any resource this module has available
+ */
+
+static int magic_find_ct(request_rec *r)
+{
+ int result;
+ magic_server_config_rec *conf;
+
+ /* the file has to exist */
+ if (r->finfo.filetype == 0 || !r->filename) {
+ return DECLINED;
+ }
+
+ /* was someone else already here? */
+ if (r->content_type) {
+ return DECLINED;
+ }
+
+ conf = ap_get_module_config(r->server->module_config, &mime_magic_module);
+ if (!conf || !conf->magic) {
+ return DECLINED;
+ }
+
+ /* initialize per-request info */
+ if (!magic_set_config(r)) {
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ /* try excluding file-revision suffixes */
+ if (revision_suffix(r) != 1) {
+ /* process it based on the file contents */
+ if ((result = magic_process(r)) != OK) {
+ return result;
+ }
+ }
+
+ /* if we have any results, put them in the request structure */
+ return magic_rsl_to_request(r);
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ static const char * const aszPre[]={ "mod_mime.c", NULL };
+
+ /* mod_mime_magic should be run after mod_mime, if at all. */
+
+ ap_hook_type_checker(magic_find_ct, aszPre, NULL, APR_HOOK_MIDDLE);
+ ap_hook_post_config(magic_init, NULL, NULL, APR_HOOK_FIRST);
+}
+
+/*
+ * Apache API module interface
+ */
+
+module AP_MODULE_DECLARE_DATA mime_magic_module =
+{
+ STANDARD20_MODULE_STUFF,
+ NULL, /* dir config creator */
+ NULL, /* dir merger --- default is to override */
+ create_magic_server_config, /* server config */
+ merge_magic_server_config, /* merge server config */
+ mime_magic_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
+
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.dsp
new file mode 100644
index 00000000..bbffdfcd
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_mime_magic" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_mime_magic - Win32 Release
+!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 "mod_mime_magic.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 "mod_mime_magic.mak" CFG="mod_mime_magic - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_mime_magic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_mime_magic - 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)" == "mod_mime_magic - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_mime_magic_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 ws2_32.lib /nologo /subsystem:windows /dll /out:"Release/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic.so
+# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_mime_magic - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_mime_magic_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic.so
+# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_mime_magic - Win32 Release"
+# Name "mod_mime_magic - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_mime_magic.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_mime_magic.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_mime_magic - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_mime_magic.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_mime_magic.so "mime_magic_module for Apache" ../../include/ap_release.h > .\mod_mime_magic.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_mime_magic - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_mime_magic.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_mime_magic.so "mime_magic_module for Apache" ../../include/ap_release.h > .\mod_mime_magic.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.exp
new file mode 100644
index 00000000..42068a43
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_mime_magic.exp
@@ -0,0 +1 @@
+mime_magic_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.c
new file mode 100644
index 00000000..a85806d3
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.c
@@ -0,0 +1,586 @@
+/* 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.
+ */
+
+/*
+ * mod_setenvif.c
+ * Set environment variables based on matching request headers or
+ * attributes against regex strings
+ *
+ * Paul Sutton <paul@ukweb.com> 27 Oct 1996
+ * Based on mod_browser by Alexei Kosut <akosut@organic.com>
+ */
+
+/*
+ * Used to set environment variables based on the incoming request headers,
+ * or some selected other attributes of the request (e.g., the remote host
+ * name).
+ *
+ * Usage:
+ *
+ * SetEnvIf name regex var ...
+ *
+ * where name is either a HTTP request header name, or one of the
+ * special values (see below). 'name' may be a regex when it is used
+ * to specify an HTTP request header name. The 'value' of the header
+ & (or the value of the special value from below) are compared against
+ * the regex argument. If this is a simple string, a simple sub-string
+ * match is performed. Otherwise, a request expression match is
+ * done. If the value matches the string or regular expression, the
+ * environment variables listed as var ... are set. Each var can
+ * be in one of three formats: var, which sets the named variable
+ * (the value value "1"); var=value, which sets the variable to
+ * the given value; or !var, which unsets the variable is it has
+ * been previously set.
+ *
+ * Normally the strings are compared with regard to case. To ignore
+ * case, use the directive SetEnvIfNoCase instead.
+ *
+ * Special values for 'name' are:
+ *
+ * server_addr IP address of interface on which request arrived
+ * (analogous to SERVER_ADDR set in ap_add_common_vars())
+ * remote_host Remote host name (if available)
+ * remote_addr Remote IP address
+ * request_method Request method (GET, POST, etc)
+ * request_uri Requested URI
+ *
+ * Examples:
+ *
+ * To set the enviroment variable LOCALHOST if the client is the local
+ * machine:
+ *
+ * SetEnvIf remote_addr 127.0.0.1 LOCALHOST
+ *
+ * To set LOCAL if the client is the local host, or within our company's
+ * domain (192.168.10):
+ *
+ * SetEnvIf remote_addr 192.168.10. LOCAL
+ * SetEnvIf remote_addr 127.0.0.1 LOCALHOST
+ *
+ * This could be written as:
+ *
+ * SetEnvIf remote_addr (127.0.0.1|192.168.10.) LOCAL
+ *
+ * To set HAVE_TS if the client request contains any header beginning
+ * with "TS" with a value beginning with a lower case alphabet:
+ *
+ * SetEnvIf ^TS* ^[a-z].* HAVE_TS
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_strmatch.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_config.h"
+#include "http_core.h"
+#include "http_log.h"
+#include "http_protocol.h"
+
+
+enum special {
+ SPECIAL_NOT,
+ SPECIAL_REMOTE_ADDR,
+ SPECIAL_REMOTE_HOST,
+ SPECIAL_REQUEST_URI,
+ SPECIAL_REQUEST_METHOD,
+ SPECIAL_REQUEST_PROTOCOL,
+ SPECIAL_SERVER_ADDR
+};
+typedef struct {
+ char *name; /* header name */
+ regex_t *pnamereg; /* compiled header name regex */
+ char *regex; /* regex to match against */
+ regex_t *preg; /* compiled regex */
+ const apr_strmatch_pattern *pattern; /* non-regex pattern to match */
+ apr_table_t *features; /* env vars to set (or unset) */
+ enum special special_type; /* is it a "special" header ? */
+ int icase; /* ignoring case? */
+} sei_entry;
+
+typedef struct {
+ apr_array_header_t *conditionals;
+} sei_cfg_rec;
+
+module AP_MODULE_DECLARE_DATA setenvif_module;
+
+/*
+ * These routines, the create- and merge-config functions, are called
+ * for both the server-wide and the per-directory contexts. This is
+ * because the different definitions are used at different times; the
+ * server-wide ones are used in the post-read-request phase, and the
+ * per-directory ones are used during the header-parse phase (after
+ * the URI has been mapped to a file and we have anything from the
+ * .htaccess file and <Directory> and <Files> containers).
+ */
+static void *create_setenvif_config(apr_pool_t *p)
+{
+ sei_cfg_rec *new = (sei_cfg_rec *) apr_palloc(p, sizeof(sei_cfg_rec));
+
+ new->conditionals = apr_array_make(p, 20, sizeof(sei_entry));
+ return (void *) new;
+}
+
+static void *create_setenvif_config_svr(apr_pool_t *p, server_rec *dummy)
+{
+ return create_setenvif_config(p);
+}
+
+static void *create_setenvif_config_dir(apr_pool_t *p, char *dummy)
+{
+ return create_setenvif_config(p);
+}
+
+static void *merge_setenvif_config(apr_pool_t *p, void *basev, void *overridesv)
+{
+ sei_cfg_rec *a = apr_pcalloc(p, sizeof(sei_cfg_rec));
+ sei_cfg_rec *base = basev, *overrides = overridesv;
+
+ a->conditionals = apr_array_append(p, base->conditionals,
+ overrides->conditionals);
+ return a;
+}
+
+/*
+ * any non-NULL magic constant will do... used to indicate if REG_ICASE should
+ * be used
+ */
+#define ICASE_MAGIC ((void *)(&setenvif_module))
+#define SEI_MAGIC_HEIRLOOM "setenvif-phase-flag"
+
+static int is_header_regex(apr_pool_t *p, const char* name)
+{
+ /* If a Header name contains characters other than:
+ * -,_,[A-Z\, [a-z] and [0-9].
+ * assume the header name is a regular expression.
+ */
+ regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
+ (REG_EXTENDED | REG_NOSUB ));
+ ap_assert(preg != NULL);
+
+ if (ap_regexec(preg, name, 0, NULL, 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+/* If the input string does not take advantage of regular
+ * expression metacharacters, return a pointer to an equivalent
+ * string that can be searched using apr_strmatch(). (The
+ * returned string will often be the input string. But if
+ * the input string contains escaped characters, the returned
+ * string will be a copy with the escapes removed.)
+ */
+static const char *non_regex_pattern(apr_pool_t *p, const char *s)
+{
+ const char *src = s;
+ int escapes_found = 0;
+ int in_escape = 0;
+
+ while (*src) {
+ switch (*src) {
+ case '^':
+ case '.':
+ case '$':
+ case '|':
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ case '}':
+ if (!in_escape) {
+ return NULL;
+ }
+ in_escape = 0;
+ break;
+ case '\\':
+ if (!in_escape) {
+ in_escape = 1;
+ escapes_found = 1;
+ }
+ else {
+ in_escape = 0;
+ }
+ break;
+ default:
+ if (in_escape) {
+ return NULL;
+ }
+ break;
+ }
+ src++;
+ }
+ if (!escapes_found) {
+ return s;
+ }
+ else {
+ char *unescaped = (char *)apr_palloc(p, src - s + 1);
+ char *dst = unescaped;
+ src = s;
+ do {
+ if (*src == '\\') {
+ src++;
+ }
+ } while ((*dst++ = *src++));
+ return unescaped;
+ }
+}
+
+static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
+ char *fname, const char *args)
+{
+ char *regex;
+ const char *simple_pattern;
+ const char *feature;
+ sei_cfg_rec *sconf;
+ sei_entry *new;
+ sei_entry *entries;
+ char *var;
+ int i;
+ int beenhere = 0;
+ int icase;
+
+ /*
+ * Determine from our context into which record to put the entry.
+ * cmd->path == NULL means we're in server-wide context; otherwise,
+ * we're dealing with a per-directory setting.
+ */
+ sconf = (cmd->path != NULL)
+ ? (sei_cfg_rec *) mconfig
+ : (sei_cfg_rec *) ap_get_module_config(cmd->server->module_config,
+ &setenvif_module);
+ entries = (sei_entry *) sconf->conditionals->elts;
+ /* get regex */
+ regex = ap_getword_conf(cmd->pool, &args);
+ if (!*regex) {
+ return apr_pstrcat(cmd->pool, "Missing regular expression for ",
+ cmd->cmd->name, NULL);
+ }
+
+ /*
+ * If we've already got a sei_entry with the same name we want to
+ * just copy the name pointer... so that later on we can compare
+ * two header names just by comparing the pointers.
+ */
+ for (i = 0; i < sconf->conditionals->nelts; ++i) {
+ new = &entries[i];
+ if (!strcasecmp(new->name, fname)) {
+ fname = new->name;
+ break;
+ }
+ }
+
+ /* if the last entry has an identical headername and regex then
+ * merge with it
+ */
+ i = sconf->conditionals->nelts - 1;
+ icase = cmd->info == ICASE_MAGIC;
+ if (i < 0
+ || entries[i].name != fname
+ || entries[i].icase != icase
+ || strcmp(entries[i].regex, regex)) {
+
+ /* no match, create a new entry */
+ new = apr_array_push(sconf->conditionals);
+ new->name = fname;
+ new->regex = regex;
+ new->icase = icase;
+ if ((simple_pattern = non_regex_pattern(cmd->pool, regex))) {
+ new->pattern = apr_strmatch_precompile(cmd->pool,
+ simple_pattern, !icase);
+ if (new->pattern == NULL) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " pattern could not be compiled.", NULL);
+ }
+ new->preg = NULL;
+ }
+ else {
+ new->preg = ap_pregcomp(cmd->pool, regex,
+ (REG_EXTENDED | (icase ? REG_ICASE : 0)));
+ if (new->preg == NULL) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " regex could not be compiled.", NULL);
+ }
+ new->pattern = NULL;
+ }
+ new->features = apr_table_make(cmd->pool, 2);
+
+ if (!strcasecmp(fname, "remote_addr")) {
+ new->special_type = SPECIAL_REMOTE_ADDR;
+ }
+ else if (!strcasecmp(fname, "remote_host")) {
+ new->special_type = SPECIAL_REMOTE_HOST;
+ }
+ else if (!strcasecmp(fname, "request_uri")) {
+ new->special_type = SPECIAL_REQUEST_URI;
+ }
+ else if (!strcasecmp(fname, "request_method")) {
+ new->special_type = SPECIAL_REQUEST_METHOD;
+ }
+ else if (!strcasecmp(fname, "request_protocol")) {
+ new->special_type = SPECIAL_REQUEST_PROTOCOL;
+ }
+ else if (!strcasecmp(fname, "server_addr")) {
+ new->special_type = SPECIAL_SERVER_ADDR;
+ }
+ else {
+ new->special_type = SPECIAL_NOT;
+ /* Handle fname as a regular expression.
+ * If fname a simple header string, identify as such
+ * (new->pnamereg = NULL) to avoid the overhead of searching
+ * through headers_in for a regex match.
+ */
+ if (is_header_regex(cmd->pool, fname)) {
+ new->pnamereg = ap_pregcomp(cmd->pool, fname,
+ (REG_EXTENDED | REG_NOSUB
+ | (icase ? REG_ICASE : 0)));
+ if (new->pnamereg == NULL)
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ "Header name regex could not be "
+ "compiled.", NULL);
+ }
+ else {
+ new->pnamereg = NULL;
+ }
+ }
+ }
+ else {
+ new = &entries[i];
+ }
+
+ for ( ; ; ) {
+ feature = ap_getword_conf(cmd->pool, &args);
+ if (!*feature) {
+ break;
+ }
+ beenhere++;
+
+ var = ap_getword(cmd->pool, &feature, '=');
+ if (*feature) {
+ apr_table_setn(new->features, var, feature);
+ }
+ else if (*var == '!') {
+ apr_table_setn(new->features, var + 1, "!");
+ }
+ else {
+ apr_table_setn(new->features, var, "1");
+ }
+ }
+
+ if (!beenhere) {
+ return apr_pstrcat(cmd->pool, "Missing envariable expression for ",
+ cmd->cmd->name, NULL);
+ }
+
+ return NULL;
+}
+
+static const char *add_setenvif(cmd_parms *cmd, void *mconfig,
+ const char *args)
+{
+ char *fname;
+
+ /* get header name */
+ fname = ap_getword_conf(cmd->pool, &args);
+ if (!*fname) {
+ return apr_pstrcat(cmd->pool, "Missing header-field name for ",
+ cmd->cmd->name, NULL);
+ }
+ return add_setenvif_core(cmd, mconfig, fname, args);
+}
+
+/*
+ * This routine handles the BrowserMatch* directives. It simply turns around
+ * and feeds them, with the appropriate embellishments, to the general-purpose
+ * command handler.
+ */
+static const char *add_browser(cmd_parms *cmd, void *mconfig, const char *args)
+{
+ return add_setenvif_core(cmd, mconfig, "User-Agent", args);
+}
+
+static const command_rec setenvif_module_cmds[] =
+{
+ AP_INIT_RAW_ARGS("SetEnvIf", add_setenvif, NULL, OR_FILEINFO,
+ "A header-name, regex and a list of variables."),
+ AP_INIT_RAW_ARGS("SetEnvIfNoCase", add_setenvif, ICASE_MAGIC, OR_FILEINFO,
+ "a header-name, regex and a list of variables."),
+ AP_INIT_RAW_ARGS("BrowserMatch", add_browser, NULL, OR_FILEINFO,
+ "A browser regex and a list of variables."),
+ AP_INIT_RAW_ARGS("BrowserMatchNoCase", add_browser, ICASE_MAGIC,
+ OR_FILEINFO,
+ "A browser regex and a list of variables."),
+ { NULL },
+};
+
+/*
+ * This routine gets called at two different points in request processing:
+ * once before the URI has been translated (during the post-read-request
+ * phase) and once after (during the header-parse phase). We use different
+ * config records for the two different calls to reduce overhead (by not
+ * re-doing the server-wide settings during directory processing), and
+ * signal which call it is by having the earlier one pass a flag to the
+ * later one.
+ */
+static int match_headers(request_rec *r)
+{
+ sei_cfg_rec *sconf;
+ sei_entry *entries;
+ const apr_table_entry_t *elts;
+ const char *val;
+ apr_size_t val_len = 0;
+ int i, j;
+ char *last_name;
+ regmatch_t regm[AP_MAX_REG_MATCH];
+
+ if (!ap_get_module_config(r->request_config, &setenvif_module)) {
+ ap_set_module_config(r->request_config, &setenvif_module,
+ SEI_MAGIC_HEIRLOOM);
+ sconf = (sei_cfg_rec *) ap_get_module_config(r->server->module_config,
+ &setenvif_module);
+ }
+ else {
+ sconf = (sei_cfg_rec *) ap_get_module_config(r->per_dir_config,
+ &setenvif_module);
+ }
+ entries = (sei_entry *) sconf->conditionals->elts;
+ last_name = NULL;
+ val = NULL;
+ for (i = 0; i < sconf->conditionals->nelts; ++i) {
+ sei_entry *b = &entries[i];
+
+ /* Optimize the case where a bunch of directives in a row use the
+ * same header. Remember we don't need to strcmp the two header
+ * names because we made sure the pointers were equal during
+ * configuration.
+ */
+ if (b->name != last_name) {
+ last_name = b->name;
+ switch (b->special_type) {
+ case SPECIAL_REMOTE_ADDR:
+ val = r->connection->remote_ip;
+ break;
+ case SPECIAL_SERVER_ADDR:
+ val = r->connection->local_ip;
+ break;
+ case SPECIAL_REMOTE_HOST:
+ val = ap_get_remote_host(r->connection, r->per_dir_config,
+ REMOTE_NAME, NULL);
+ break;
+ case SPECIAL_REQUEST_URI:
+ val = r->uri;
+ break;
+ case SPECIAL_REQUEST_METHOD:
+ val = r->method;
+ break;
+ case SPECIAL_REQUEST_PROTOCOL:
+ val = r->protocol;
+ break;
+ case SPECIAL_NOT:
+ if (b->pnamereg) {
+ /* Matching headers_in against a regex. Iterate through
+ * the headers_in until we find a match or run out of
+ * headers.
+ */
+ const apr_array_header_t
+ *arr = apr_table_elts(r->headers_in);
+
+ elts = (const apr_table_entry_t *) arr->elts;
+ val = NULL;
+ for (j = 0; j < arr->nelts; ++j) {
+ if (!ap_regexec(b->pnamereg, elts[j].key, 0, NULL, 0)) {
+ val = elts[j].val;
+ }
+ }
+ }
+ else {
+ /* Not matching against a regex */
+ val = apr_table_get(r->headers_in, b->name);
+ if (val == NULL) {
+ val = apr_table_get(r->subprocess_env, b->name);
+ }
+ }
+ }
+ val_len = val ? strlen(val) : 0;
+ }
+
+ /*
+ * A NULL value indicates that the header field or special entity
+ * wasn't present or is undefined. Represent that as an empty string
+ * so that REs like "^$" will work and allow envariable setting
+ * based on missing or empty field.
+ */
+ if (val == NULL) {
+ val = "";
+ val_len = 0;
+ }
+
+ if ((b->pattern && apr_strmatch(b->pattern, val, val_len)) ||
+ (!b->pattern && !ap_regexec(b->preg, val, AP_MAX_REG_MATCH, regm,
+ 0))) {
+ const apr_array_header_t *arr = apr_table_elts(b->features);
+ elts = (const apr_table_entry_t *) arr->elts;
+
+ for (j = 0; j < arr->nelts; ++j) {
+ if (*(elts[j].val) == '!') {
+ apr_table_unset(r->subprocess_env, elts[j].key);
+ }
+ else {
+ if (!b->pattern) {
+ char *replaced = ap_pregsub(r->pool, elts[j].val, val,
+ AP_MAX_REG_MATCH, regm);
+ if (replaced) {
+ apr_table_setn(r->subprocess_env, elts[j].key,
+ replaced);
+ }
+ }
+ else {
+ apr_table_setn(r->subprocess_env, elts[j].key,
+ elts[j].val);
+ }
+ }
+ }
+ }
+ }
+
+ return DECLINED;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_header_parser(match_headers, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_post_read_request(match_headers, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA setenvif_module =
+{
+ STANDARD20_MODULE_STUFF,
+ create_setenvif_config_dir, /* dir config creater */
+ merge_setenvif_config, /* dir merger --- default is to override */
+ create_setenvif_config_svr, /* server config */
+ merge_setenvif_config, /* merge server configs */
+ setenvif_module_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.dsp
new file mode 100644
index 00000000..cffd4649
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_setenvif" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_setenvif - Win32 Release
+!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 "mod_setenvif.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 "mod_setenvif.mak" CFG="mod_setenvif - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_setenvif - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_setenvif - 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)" == "mod_setenvif - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_setenvif_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_setenvif - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_setenvif_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_setenvif - Win32 Release"
+# Name "mod_setenvif - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_setenvif.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_setenvif.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_setenvif - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_setenvif.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_setenvif.so "setenvif_module for Apache" ../../include/ap_release.h > .\mod_setenvif.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_setenvif - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_setenvif.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_setenvif.so "setenvif_module for Apache" ../../include/ap_release.h > .\mod_setenvif.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.exp
new file mode 100644
index 00000000..4f3800e3
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.exp
@@ -0,0 +1 @@
+setenvif_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.la b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.la
new file mode 100644
index 00000000..6562d1dc
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.la
@@ -0,0 +1,35 @@
+# mod_setenvif.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname=''
+
+# Names of this library.
+library_names=''
+
+# The name of the static archive.
+old_library='mod_setenvif.a'
+
+# Libraries that this one depends upon.
+dependency_libs=' -L/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib'
+
+# Version information for mod_setenvif.
+current=
+age=
+revision=
+
+# Is this an already installed library?
+installed=no
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir=''
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.lo b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.lo
new file mode 100644
index 00000000..1a7420ba
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.lo
@@ -0,0 +1,12 @@
+# mod_setenvif.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/mod_setenvif.o'
+
+# Name of the non-PIC object.
+non_pic_object='mod_setenvif.o'
+
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.o b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.o
new file mode 100644
index 00000000..0f0fee97
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_setenvif.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.c
new file mode 100644
index 00000000..faf1dbd0
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.c
@@ -0,0 +1,367 @@
+/* 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.
+ */
+
+/*
+ * mod_unique_id.c: generate a unique identifier for each request
+ *
+ * Original author: Dean Gaudet <dgaudet@arctic.org>
+ * UUencoding modified by: Alvaro Martinez Echevarria <alvaro@lander.es>
+ */
+
+#define APR_WANT_BYTEFUNC /* for htons() et al */
+#include "apr_want.h"
+#include "apr_general.h" /* for APR_OFFSETOF */
+#include "apr_network_io.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_log.h"
+#include "http_protocol.h" /* for ap_hook_post_read_request */
+
+#if APR_HAVE_UNISTD_H
+#include <unistd.h> /* for getpid() */
+#endif
+
+typedef struct {
+ unsigned int stamp;
+ unsigned int in_addr;
+ unsigned int pid;
+ unsigned short counter;
+ unsigned int thread_index;
+} unique_id_rec;
+
+/* We are using thread_index (the index into the scoreboard), because we
+ * cannot guarantee the thread_id will be an integer.
+ *
+ * This code looks like it won't give a unique ID with the new thread logic.
+ * It will. The reason is, we don't increment the counter in a thread_safe
+ * manner. Because the thread_index is also in the unique ID now, this does
+ * not matter. In order for the id to not be unique, the same thread would
+ * have to get the same counter twice in the same second.
+ */
+
+/* Comments:
+ *
+ * We want an identifier which is unique across all hits, everywhere.
+ * "everywhere" includes multiple httpd instances on the same machine, or on
+ * multiple machines. Essentially "everywhere" should include all possible
+ * httpds across all servers at a particular "site". We make some assumptions
+ * that if the site has a cluster of machines then their time is relatively
+ * synchronized. We also assume that the first address returned by a
+ * gethostbyname (gethostname()) is unique across all the machines at the
+ * "site".
+ *
+ * We also further assume that pids fit in 32-bits. If something uses more
+ * than 32-bits, the fix is trivial, but it requires the unrolled uuencoding
+ * loop to be extended. * A similar fix is needed to support multithreaded
+ * servers, using a pid/tid combo.
+ *
+ * Together, the in_addr and pid are assumed to absolutely uniquely identify
+ * this one child from all other currently running children on all servers
+ * (including this physical server if it is running multiple httpds) from each
+ * other.
+ *
+ * The stamp and counter are used to distinguish all hits for a particular
+ * (in_addr,pid) pair. The stamp is updated using r->request_time,
+ * saving cpu cycles. The counter is never reset, and is used to permit up to
+ * 64k requests in a single second by a single child.
+ *
+ * The 112-bits of unique_id_rec are encoded using the alphabet
+ * [A-Za-z0-9@-], resulting in 19 bytes of printable characters. That is then
+ * stuffed into the environment variable UNIQUE_ID so that it is available to
+ * other modules. The alphabet choice differs from normal base64 encoding
+ * [A-Za-z0-9+/] because + and / are special characters in URLs and we want to
+ * make it easy to use UNIQUE_ID in URLs.
+ *
+ * Note that UNIQUE_ID should be considered an opaque token by other
+ * applications. No attempt should be made to dissect its internal components.
+ * It is an abstraction that may change in the future as the needs of this
+ * module change.
+ *
+ * It is highly desirable that identifiers exist for "eternity". But future
+ * needs (such as much faster webservers, moving to 64-bit pids, or moving to a
+ * multithreaded server) may dictate a need to change the contents of
+ * unique_id_rec. Such a future implementation should ensure that the first
+ * field is still a time_t stamp. By doing that, it is possible for a site to
+ * have a "flag second" in which they stop all of their old-format servers,
+ * wait one entire second, and then start all of their new-servers. This
+ * procedure will ensure that the new space of identifiers is completely unique
+ * from the old space. (Since the first four unencoded bytes always differ.)
+ */
+/*
+ * Sun Jun 7 05:43:49 CEST 1998 -- Alvaro
+ * More comments:
+ * 1) The UUencoding prodecure is now done in a general way, avoiding the problems
+ * with sizes and paddings that can arise depending on the architecture. Now the
+ * offsets and sizes of the elements of the unique_id_rec structure are calculated
+ * in unique_id_global_init; and then used to duplicate the structure without the
+ * paddings that might exist. The multithreaded server fix should be now very easy:
+ * just add a new "tid" field to the unique_id_rec structure, and increase by one
+ * UNIQUE_ID_REC_MAX.
+ * 2) unique_id_rec.stamp has been changed from "time_t" to "unsigned int", because
+ * its size is 64bits on some platforms (linux/alpha), and this caused problems with
+ * htonl/ntohl. Well, this shouldn't be a problem till year 2106.
+ */
+
+static unsigned global_in_addr;
+
+static unique_id_rec cur_unique_id;
+
+/*
+ * Number of elements in the structure unique_id_rec.
+ */
+#define UNIQUE_ID_REC_MAX 5
+
+static unsigned short unique_id_rec_offset[UNIQUE_ID_REC_MAX],
+ unique_id_rec_size[UNIQUE_ID_REC_MAX],
+ unique_id_rec_total_size,
+ unique_id_rec_size_uu;
+
+static int unique_id_global_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server)
+{
+ char str[APRMAXHOSTLEN + 1];
+ apr_status_t rv;
+ char *ipaddrstr;
+ apr_sockaddr_t *sockaddr;
+
+ /*
+ * Calculate the sizes and offsets in cur_unique_id.
+ */
+ unique_id_rec_offset[0] = APR_OFFSETOF(unique_id_rec, stamp);
+ unique_id_rec_size[0] = sizeof(cur_unique_id.stamp);
+ unique_id_rec_offset[1] = APR_OFFSETOF(unique_id_rec, in_addr);
+ unique_id_rec_size[1] = sizeof(cur_unique_id.in_addr);
+ unique_id_rec_offset[2] = APR_OFFSETOF(unique_id_rec, pid);
+ unique_id_rec_size[2] = sizeof(cur_unique_id.pid);
+ unique_id_rec_offset[3] = APR_OFFSETOF(unique_id_rec, counter);
+ unique_id_rec_size[3] = sizeof(cur_unique_id.counter);
+ unique_id_rec_offset[4] = APR_OFFSETOF(unique_id_rec, thread_index);
+ unique_id_rec_size[4] = sizeof(cur_unique_id.thread_index);
+ unique_id_rec_total_size = unique_id_rec_size[0] + unique_id_rec_size[1] +
+ unique_id_rec_size[2] + unique_id_rec_size[3] +
+ unique_id_rec_size[4];
+
+ /*
+ * Calculate the size of the structure when encoded.
+ */
+ unique_id_rec_size_uu = (unique_id_rec_total_size*8+5)/6;
+
+ /*
+ * Now get the global in_addr. Note that it is not sufficient to use one
+ * of the addresses from the main_server, since those aren't as likely to
+ * be unique as the physical address of the machine
+ */
+ if ((rv = apr_gethostname(str, sizeof(str) - 1, p)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ALERT, rv, main_server,
+ "mod_unique_id: unable to find hostname of the server");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ if ((rv = apr_sockaddr_info_get(&sockaddr, str, AF_INET, 0, 0, p)) == APR_SUCCESS) {
+ global_in_addr = sockaddr->sa.sin.sin_addr.s_addr;
+ }
+ else {
+ ap_log_error(APLOG_MARK, APLOG_ALERT, rv, main_server,
+ "mod_unique_id: unable to find IPv4 address of \"%s\"", str);
+#if APR_HAVE_IPV6
+ if ((rv = apr_sockaddr_info_get(&sockaddr, str, AF_INET6, 0, 0, p)) == APR_SUCCESS) {
+ memcpy(&global_in_addr,
+ (char *)sockaddr->ipaddr_ptr + sockaddr->ipaddr_len - sizeof(global_in_addr),
+ sizeof(global_in_addr));
+ ap_log_error(APLOG_MARK, APLOG_ALERT, rv, main_server,
+ "mod_unique_id: using low-order bits of IPv6 address "
+ "as if they were unique");
+ }
+ else
+#endif
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ apr_sockaddr_ip_get(&ipaddrstr, sockaddr);
+ ap_log_error(APLOG_MARK, APLOG_INFO, 0, main_server,
+ "mod_unique_id: using ip addr %s",
+ ipaddrstr);
+
+ /*
+ * If the server is pummelled with restart requests we could possibly end
+ * up in a situation where we're starting again during the same second
+ * that has been used in previous identifiers. Avoid that situation.
+ *
+ * In truth, for this to actually happen not only would it have to restart
+ * in the same second, but it would have to somehow get the same pids as
+ * one of the other servers that was running in that second. Which would
+ * mean a 64k wraparound on pids ... not very likely at all.
+ *
+ * But protecting against it is relatively cheap. We just sleep into the
+ * next second.
+ */
+ apr_sleep(apr_time_from_sec(1) - apr_time_usec(apr_time_now()));
+ return OK;
+}
+
+static void unique_id_child_init(apr_pool_t *p, server_rec *s)
+{
+ pid_t pid;
+ apr_time_t tv;
+
+ /*
+ * Note that we use the pid because it's possible that on the same
+ * physical machine there are multiple servers (i.e. using Listen). But
+ * it's guaranteed that none of them will share the same pids between
+ * children.
+ *
+ * XXX: for multithread this needs to use a pid/tid combo and probably
+ * needs to be expanded to 32 bits
+ */
+ pid = getpid();
+ cur_unique_id.pid = pid;
+
+ /*
+ * Test our assumption that the pid is 32-bits. It's possible that
+ * 64-bit machines will declare pid_t to be 64 bits but only use 32
+ * of them. It would have been really nice to test this during
+ * global_init ... but oh well.
+ */
+ if ((pid_t)cur_unique_id.pid != pid) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s,
+ "oh no! pids are greater than 32-bits! I'm broken!");
+ }
+
+ cur_unique_id.in_addr = global_in_addr;
+
+ /*
+ * If we use 0 as the initial counter we have a little less protection
+ * against restart problems, and a little less protection against a clock
+ * going backwards in time.
+ */
+ tv = apr_time_now();
+ /* Some systems have very low variance on the low end of their system
+ * counter, defend against that.
+ */
+ cur_unique_id.counter = (unsigned short)(apr_time_usec(tv) / 10);
+
+ /*
+ * We must always use network ordering for these bytes, so that
+ * identifiers are comparable between machines of different byte
+ * orderings. Note in_addr is already in network order.
+ */
+ cur_unique_id.pid = htonl(cur_unique_id.pid);
+ cur_unique_id.counter = htons(cur_unique_id.counter);
+}
+
+/* NOTE: This is *NOT* the same encoding used by base64encode ... the last two
+ * characters should be + and /. But those two characters have very special
+ * meanings in URLs, and we want to make it easy to use identifiers in
+ * URLs. So we replace them with @ and -.
+ */
+static const char uuencoder[64] = {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '@', '-',
+};
+
+static int gen_unique_id(request_rec *r)
+{
+ char *str;
+ /*
+ * Buffer padded with two final bytes, used to copy the unique_id_red
+ * structure without the internal paddings that it could have.
+ */
+ unique_id_rec new_unique_id;
+ struct {
+ unique_id_rec foo;
+ unsigned char pad[2];
+ } paddedbuf;
+ unsigned char *x,*y;
+ unsigned short counter;
+ const char *e;
+ int i,j,k;
+
+ /* copy the unique_id if this is an internal redirect (we're never
+ * actually called for sub requests, so we don't need to test for
+ * them) */
+ if (r->prev && (e = apr_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) {
+ apr_table_setn(r->subprocess_env, "UNIQUE_ID", e);
+ return DECLINED;
+ }
+
+ new_unique_id.in_addr = cur_unique_id.in_addr;
+ new_unique_id.pid = cur_unique_id.pid;
+ new_unique_id.counter = cur_unique_id.counter;
+
+ new_unique_id.stamp = htonl((unsigned int)r->request_time);
+ new_unique_id.thread_index = htonl((unsigned int)r->connection->id);
+
+ /* we'll use a temporal buffer to avoid uuencoding the possible internal
+ * paddings of the original structure */
+ x = (unsigned char *) &paddedbuf;
+ y = (unsigned char *) &new_unique_id;
+ k = 0;
+ for (i = 0; i < UNIQUE_ID_REC_MAX; i++) {
+ y = ((unsigned char *) &new_unique_id) + unique_id_rec_offset[i];
+ for (j = 0; j < unique_id_rec_size[i]; j++, k++) {
+ x[k] = y[j];
+ }
+ }
+ /*
+ * We reset two more bytes just in case padding is needed for the uuencoding.
+ */
+ x[k++] = '\0';
+ x[k++] = '\0';
+
+ /* alloc str and do the uuencoding */
+ str = (char *)apr_palloc(r->pool, unique_id_rec_size_uu + 1);
+ k = 0;
+ for (i = 0; i < unique_id_rec_total_size; i += 3) {
+ y = x + i;
+ str[k++] = uuencoder[y[0] >> 2];
+ str[k++] = uuencoder[((y[0] & 0x03) << 4) | ((y[1] & 0xf0) >> 4)];
+ if (k == unique_id_rec_size_uu) break;
+ str[k++] = uuencoder[((y[1] & 0x0f) << 2) | ((y[2] & 0xc0) >> 6)];
+ if (k == unique_id_rec_size_uu) break;
+ str[k++] = uuencoder[y[2] & 0x3f];
+ }
+ str[k++] = '\0';
+
+ /* set the environment variable */
+ apr_table_setn(r->subprocess_env, "UNIQUE_ID", str);
+
+ /* and increment the identifier for the next call */
+
+ counter = ntohs(new_unique_id.counter) + 1;
+ cur_unique_id.counter = htons(counter);
+
+ return DECLINED;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_post_config(unique_id_global_init, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_child_init(unique_id_child_init, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_post_read_request(gen_unique_id, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA unique_id_module = {
+ STANDARD20_MODULE_STUFF,
+ NULL, /* dir config creater */
+ NULL, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ NULL, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.dsp
new file mode 100644
index 00000000..9c80da49
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_unique_id" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_unique_id - Win32 Release
+!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 "mod_unique_id.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 "mod_unique_id.mak" CFG="mod_unique_id - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_unique_id - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_unique_id - 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)" == "mod_unique_id - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_unique_id_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 ws2_32.lib /nologo /subsystem:windows /dll /out:"Release/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id.so
+# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_unique_id - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_unique_id_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id.so
+# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_unique_id - Win32 Release"
+# Name "mod_unique_id - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_unique_id.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_unique_id.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_unique_id - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_unique_id.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_unique_id.so "unique_id_module for Apache" ../../include/ap_release.h > .\mod_unique_id.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_unique_id - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_unique_id.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_unique_id.so "unique_id_module for Apache" ../../include/ap_release.h > .\mod_unique_id.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.exp
new file mode 100644
index 00000000..93000f1e
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_unique_id.exp
@@ -0,0 +1 @@
+unique_id_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.c
new file mode 100644
index 00000000..94c46a37
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.c
@@ -0,0 +1,454 @@
+/* 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.
+ */
+
+/* User Tracking Module (Was mod_cookies.c)
+ *
+ * *** IMPORTANT NOTE: This module is not designed to generate
+ * *** cryptographically secure cookies. This means you should not
+ * *** use cookies generated by this module for authentication purposes
+ *
+ * This Apache module is designed to track users paths through a site.
+ * It uses the client-side state ("Cookie") protocol developed by Netscape.
+ * It is known to work on most browsers.
+ *
+ * Each time a page is requested we look to see if the browser is sending
+ * us a Cookie: header that we previously generated.
+ *
+ * If we don't find one then the user hasn't been to this site since
+ * starting their browser or their browser doesn't support cookies. So
+ * we generate a unique Cookie for the transaction and send it back to
+ * the browser (via a "Set-Cookie" header)
+ * Future requests from the same browser should keep the same Cookie line.
+ *
+ * By matching up all the requests with the same cookie you can
+ * work out exactly what path a user took through your site. To log
+ * the cookie use the " %{Cookie}n " directive in a custom access log;
+ *
+ * Example 1 : If you currently use the standard Log file format (CLF)
+ * and use the command "TransferLog somefilename", add the line
+ * LogFormat "%h %l %u %t \"%r\" %s %b %{Cookie}n"
+ * to your config file.
+ *
+ * Example 2 : If you used to use the old "CookieLog" directive, you
+ * can emulate it by adding the following command to your config file
+ * CustomLog filename "%{Cookie}n \"%r\" %t"
+ *
+ * Mark Cox, mjc@apache.org, 6 July 95
+ *
+ * This file replaces mod_cookies.c
+ */
+
+#include "apr.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_core.h"
+#include "http_request.h"
+
+
+module AP_MODULE_DECLARE_DATA usertrack_module;
+
+typedef struct {
+ int always;
+ int expires;
+} cookie_log_state;
+
+typedef enum {
+ CT_UNSET,
+ CT_NETSCAPE,
+ CT_COOKIE,
+ CT_COOKIE2
+} cookie_type_e;
+
+typedef struct {
+ int enabled;
+ cookie_type_e style;
+ char *cookie_name;
+ char *cookie_domain;
+ char *regexp_string; /* used to compile regexp; save for debugging */
+ regex_t *regexp; /* used to find usertrack cookie in cookie header */
+} cookie_dir_rec;
+
+/* Make Cookie: Now we have to generate something that is going to be
+ * pretty unique. We can base it on the pid, time, hostip */
+
+#define COOKIE_NAME "Apache"
+
+static void make_cookie(request_rec *r)
+{
+ cookie_log_state *cls = ap_get_module_config(r->server->module_config,
+ &usertrack_module);
+ /* 1024 == hardcoded constant */
+ char cookiebuf[1024];
+ char *new_cookie;
+ const char *rname = ap_get_remote_host(r->connection, r->per_dir_config,
+ REMOTE_NAME, NULL);
+ cookie_dir_rec *dcfg;
+
+ dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
+
+ /* XXX: hmm, this should really tie in with mod_unique_id */
+ apr_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%" APR_TIME_T_FMT, rname,
+ apr_time_now());
+
+ if (cls->expires) {
+
+ /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */
+ new_cookie = apr_psprintf(r->pool, "%s=%s; path=/",
+ dcfg->cookie_name, cookiebuf);
+
+ if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) {
+ apr_time_exp_t tms;
+ apr_time_exp_gmt(&tms, r->request_time
+ + apr_time_from_sec(cls->expires));
+ new_cookie = apr_psprintf(r->pool,
+ "%s; expires=%s, "
+ "%.2d-%s-%.2d %.2d:%.2d:%.2d GMT",
+ new_cookie, apr_day_snames[tms.tm_wday],
+ tms.tm_mday,
+ apr_month_snames[tms.tm_mon],
+ tms.tm_year % 100,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
+ }
+ else {
+ new_cookie = apr_psprintf(r->pool, "%s; max-age=%d",
+ new_cookie, cls->expires);
+ }
+ }
+ else {
+ new_cookie = apr_psprintf(r->pool, "%s=%s; path=/",
+ dcfg->cookie_name, cookiebuf);
+ }
+ if (dcfg->cookie_domain != NULL) {
+ new_cookie = apr_pstrcat(r->pool, new_cookie, "; domain=",
+ dcfg->cookie_domain,
+ (dcfg->style == CT_COOKIE2
+ ? "; version=1"
+ : ""),
+ NULL);
+ }
+
+ apr_table_addn(r->headers_out,
+ (dcfg->style == CT_COOKIE2 ? "Set-Cookie2" : "Set-Cookie"),
+ new_cookie);
+ apr_table_setn(r->notes, "cookie", apr_pstrdup(r->pool, cookiebuf)); /* log first time */
+ return;
+}
+
+/* dcfg->regexp is "^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)",
+ * which has three subexpressions, $0..$2 */
+#define NUM_SUBS 3
+
+static void set_and_comp_regexp(cookie_dir_rec *dcfg,
+ apr_pool_t *p,
+ const char *cookie_name)
+{
+ int danger_chars = 0;
+ const char *sp = cookie_name;
+
+ /* The goal is to end up with this regexp,
+ * ^cookie_name=([^;]+)|;[\t]+cookie_name=([^;]+)
+ * with cookie_name obviously substituted either
+ * with the real cookie name set by the user in httpd.conf, or with the
+ * default COOKIE_NAME.
+ */
+
+ /* Anyway, we need to escape the cookie_name before pasting it
+ * into the regex
+ */
+ while (*sp) {
+ if (!apr_isalnum(*sp)) {
+ ++danger_chars;
+ }
+ ++sp;
+ }
+
+ if (danger_chars) {
+ char *cp;
+ cp = apr_palloc(p, sp - cookie_name + danger_chars + 1); /* 1 == \0 */
+ sp = cookie_name;
+ cookie_name = cp;
+ while (*sp) {
+ if (!apr_isalnum(*sp)) {
+ *cp++ = '\\';
+ }
+ *cp++ = *sp++;
+ }
+ *cp = '\0';
+ }
+
+ dcfg->regexp_string = apr_pstrcat(p, "^",
+ cookie_name,
+ "=([^;]+)|;[ \t]+",
+ cookie_name,
+ "=([^;]+)", NULL);
+
+ dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
+ ap_assert(dcfg->regexp != NULL);
+}
+
+static int spot_cookie(request_rec *r)
+{
+ cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
+ &usertrack_module);
+ const char *cookie_header;
+ regmatch_t regm[NUM_SUBS];
+
+ /* Do not run in subrequests */
+ if (!dcfg->enabled || r->main) {
+ return DECLINED;
+ }
+
+ if ((cookie_header = apr_table_get(r->headers_in, "Cookie"))) {
+ if (!ap_regexec(dcfg->regexp, cookie_header, NUM_SUBS, regm, 0)) {
+ char *cookieval = NULL;
+ /* Our regexp,
+ * ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)
+ * only allows for $1 or $2 to be available. ($0 is always
+ * filled with the entire matched expression, not just
+ * the part in parentheses.) So just check for either one
+ * and assign to cookieval if present. */
+ if (regm[1].rm_so != -1) {
+ cookieval = ap_pregsub(r->pool, "$1", cookie_header,
+ NUM_SUBS, regm);
+ }
+ if (regm[2].rm_so != -1) {
+ cookieval = ap_pregsub(r->pool, "$2", cookie_header,
+ NUM_SUBS, regm);
+ }
+ /* Set the cookie in a note, for logging */
+ apr_table_setn(r->notes, "cookie", cookieval);
+
+ return DECLINED; /* There's already a cookie, no new one */
+ }
+ }
+ make_cookie(r);
+ return OK; /* We set our cookie */
+}
+
+static void *make_cookie_log_state(apr_pool_t *p, server_rec *s)
+{
+ cookie_log_state *cls =
+ (cookie_log_state *) apr_palloc(p, sizeof(cookie_log_state));
+
+ cls->expires = 0;
+
+ return (void *) cls;
+}
+
+static void *make_cookie_dir(apr_pool_t *p, char *d)
+{
+ cookie_dir_rec *dcfg;
+
+ dcfg = (cookie_dir_rec *) apr_pcalloc(p, sizeof(cookie_dir_rec));
+ dcfg->cookie_name = COOKIE_NAME;
+ dcfg->cookie_domain = NULL;
+ dcfg->style = CT_UNSET;
+ dcfg->enabled = 0;
+
+ /* In case the user does not use the CookieName directive,
+ * we need to compile the regexp for the default cookie name. */
+ set_and_comp_regexp(dcfg, p, COOKIE_NAME);
+
+ return dcfg;
+}
+
+static const char *set_cookie_enable(cmd_parms *cmd, void *mconfig, int arg)
+{
+ cookie_dir_rec *dcfg = mconfig;
+
+ dcfg->enabled = arg;
+ return NULL;
+}
+
+static const char *set_cookie_exp(cmd_parms *parms, void *dummy,
+ const char *arg)
+{
+ cookie_log_state *cls;
+ time_t factor, modifier = 0;
+ time_t num = 0;
+ char *word;
+
+ cls = ap_get_module_config(parms->server->module_config,
+ &usertrack_module);
+ /* The simple case first - all numbers (we assume) */
+ if (apr_isdigit(arg[0]) && apr_isdigit(arg[strlen(arg) - 1])) {
+ cls->expires = atol(arg);
+ return NULL;
+ }
+
+ /*
+ * The harder case - stolen from mod_expires
+ *
+ * CookieExpires "[plus] {<num> <type>}*"
+ */
+
+ word = ap_getword_conf(parms->pool, &arg);
+ if (!strncasecmp(word, "plus", 1)) {
+ word = ap_getword_conf(parms->pool, &arg);
+ };
+
+ /* {<num> <type>}* */
+ while (word[0]) {
+ /* <num> */
+ if (apr_isdigit(word[0]))
+ num = atoi(word);
+ else
+ return "bad expires code, numeric value expected.";
+
+ /* <type> */
+ word = ap_getword_conf(parms->pool, &arg);
+ if (!word[0])
+ return "bad expires code, missing <type>";
+
+ factor = 0;
+ if (!strncasecmp(word, "years", 1))
+ factor = 60 * 60 * 24 * 365;
+ else if (!strncasecmp(word, "months", 2))
+ factor = 60 * 60 * 24 * 30;
+ else if (!strncasecmp(word, "weeks", 1))
+ factor = 60 * 60 * 24 * 7;
+ else if (!strncasecmp(word, "days", 1))
+ factor = 60 * 60 * 24;
+ else if (!strncasecmp(word, "hours", 1))
+ factor = 60 * 60;
+ else if (!strncasecmp(word, "minutes", 2))
+ factor = 60;
+ else if (!strncasecmp(word, "seconds", 1))
+ factor = 1;
+ else
+ return "bad expires code, unrecognized type";
+
+ modifier = modifier + factor * num;
+
+ /* next <num> */
+ word = ap_getword_conf(parms->pool, &arg);
+ }
+
+ cls->expires = modifier;
+
+ return NULL;
+}
+
+static const char *set_cookie_name(cmd_parms *cmd, void *mconfig,
+ const char *name)
+{
+ cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig;
+
+ dcfg->cookie_name = apr_pstrdup(cmd->pool, name);
+
+ set_and_comp_regexp(dcfg, cmd->pool, name);
+
+ if (dcfg->regexp == NULL) {
+ return "Regular expression could not be compiled.";
+ }
+ if (dcfg->regexp->re_nsub + 1 != NUM_SUBS) {
+ return apr_pstrcat(cmd->pool, "Invalid cookie name \"",
+ name, "\"", NULL);
+ }
+
+ return NULL;
+}
+
+/*
+ * Set the value for the 'Domain=' attribute.
+ */
+static const char *set_cookie_domain(cmd_parms *cmd, void *mconfig,
+ const char *name)
+{
+ cookie_dir_rec *dcfg;
+
+ dcfg = (cookie_dir_rec *) mconfig;
+
+ /*
+ * Apply the restrictions on cookie domain attributes.
+ */
+ if (strlen(name) == 0) {
+ return "CookieDomain values may not be null";
+ }
+ if (name[0] != '.') {
+ return "CookieDomain values must begin with a dot";
+ }
+ if (ap_strchr_c(&name[1], '.') == NULL) {
+ return "CookieDomain values must contain at least one embedded dot";
+ }
+
+ dcfg->cookie_domain = apr_pstrdup(cmd->pool, name);
+ return NULL;
+}
+
+/*
+ * Make a note of the cookie style we should use.
+ */
+static const char *set_cookie_style(cmd_parms *cmd, void *mconfig,
+ const char *name)
+{
+ cookie_dir_rec *dcfg;
+
+ dcfg = (cookie_dir_rec *) mconfig;
+
+ if (strcasecmp(name, "Netscape") == 0) {
+ dcfg->style = CT_NETSCAPE;
+ }
+ else if ((strcasecmp(name, "Cookie") == 0)
+ || (strcasecmp(name, "RFC2109") == 0)) {
+ dcfg->style = CT_COOKIE;
+ }
+ else if ((strcasecmp(name, "Cookie2") == 0)
+ || (strcasecmp(name, "RFC2965") == 0)) {
+ dcfg->style = CT_COOKIE2;
+ }
+ else {
+ return apr_psprintf(cmd->pool, "Invalid %s keyword: '%s'",
+ cmd->cmd->name, name);
+ }
+
+ return NULL;
+}
+
+static const command_rec cookie_log_cmds[] = {
+ AP_INIT_TAKE1("CookieExpires", set_cookie_exp, NULL, OR_FILEINFO,
+ "an expiry date code"),
+ AP_INIT_TAKE1("CookieDomain", set_cookie_domain, NULL, OR_FILEINFO,
+ "domain to which this cookie applies"),
+ AP_INIT_TAKE1("CookieStyle", set_cookie_style, NULL, OR_FILEINFO,
+ "'Netscape', 'Cookie' (RFC2109), or 'Cookie2' (RFC2965)"),
+ AP_INIT_FLAG("CookieTracking", set_cookie_enable, NULL, OR_FILEINFO,
+ "whether or not to enable cookies"),
+ AP_INIT_TAKE1("CookieName", set_cookie_name, NULL, OR_FILEINFO,
+ "name of the tracking cookie"),
+ {NULL}
+};
+
+static void register_hooks(apr_pool_t *p)
+{
+ ap_hook_fixups(spot_cookie,NULL,NULL,APR_HOOK_MIDDLE);
+}
+
+module AP_MODULE_DECLARE_DATA usertrack_module = {
+ STANDARD20_MODULE_STUFF,
+ make_cookie_dir, /* dir config creater */
+ NULL, /* dir merger --- default is to override */
+ make_cookie_log_state, /* server config */
+ NULL, /* merge server configs */
+ cookie_log_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.dsp
new file mode 100644
index 00000000..63497a9d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_usertrack" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_usertrack - Win32 Release
+!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 "mod_usertrack.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 "mod_usertrack.mak" CFG="mod_usertrack - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_usertrack - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_usertrack - 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)" == "mod_usertrack - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_usertrack_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_usertrack.so" /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_usertrack.so" /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_usertrack - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_usertrack_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_usertrack.so" /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_usertrack.so" /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_usertrack - Win32 Release"
+# Name "mod_usertrack - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_usertrack.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_usertrack.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_usertrack - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_usertrack.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_usertrack.so "usertrack_module for Apache" ../../include/ap_release.h > .\mod_usertrack.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_usertrack - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_usertrack.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_usertrack.so "usertrack_module for Apache" ../../include/ap_release.h > .\mod_usertrack.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.exp
new file mode 100644
index 00000000..234a5f75
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_usertrack.exp
@@ -0,0 +1 @@
+usertrack_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.c b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.c
new file mode 100644
index 00000000..9104929b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.c
@@ -0,0 +1,312 @@
+/* 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.
+ */
+
+/*
+ * mod_version.c
+ * Allow conditional configuration depending on the httpd version
+ *
+ * André Malo (nd/perlig.de), January 2004
+ *
+ * Some stuff coded here is heavily based on the core <IfModule>
+ * containers.
+ *
+ * The module makes the following confgurations possible:
+ *
+ * <IfVersion op major.minor.patch>
+ * # conditional config here ...
+ *</IfVersion>
+ *
+ * where "op" is one of:
+ * = / == equal
+ * > greater than
+ * >= greater or equal
+ * < less than
+ * <= less or equal
+ *
+ * If minor version and patch level are omitted they are assumed to be 0.
+ *
+ * Alternatively you can match the whole version (including some vendor-added
+ * string of the CORE version, see ap_release.h) against a regular expression:
+ *
+ * <IfVersion op regex>
+ * # conditional config here ...
+ *</IfVersion>
+ *
+ * where "op" is one of:
+ * = / == match; regex must be surrounded by slashes
+ * ~ match; regex MAY NOT be surrounded by slashes
+ *
+ * Note that all operators may be preceeded by an exclamation mark
+ * (without spaces) in order to reverse their meaning.
+ *
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_lib.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_log.h"
+
+
+/* module structure */
+module AP_MODULE_DECLARE_DATA version_module;
+
+/* queried httpd version */
+static ap_version_t httpd_version;
+
+
+/*
+ * compare the supplied version with the core one
+ */
+static int compare_version(char *version_string, const char **error)
+{
+ char *p = version_string, *ep;
+ int version[3] = {0, 0, 0};
+ int c = 0;
+
+ *error = "Version appears to be invalid. It must have the format "
+ "major[.minor[.patch]] where major, minor and patch are "
+ "numbers.";
+
+ if (!apr_isdigit(*p)) {
+ return 0;
+ }
+
+ /* parse supplied version */
+ ep = version_string + strlen(version_string);
+ while (p <= ep && c < 3) {
+ if (*p == '.') {
+ *p = '\0';
+ }
+
+ if (!*p) {
+ version[c++] = atoi(version_string);
+ version_string = ++p;
+ continue;
+ }
+
+ if (!apr_isdigit(*p)) {
+ break;
+ }
+
+ ++p;
+ }
+
+ if (p < ep) { /* syntax error */
+ return 0;
+ }
+
+ *error = NULL;
+
+ if (httpd_version.major > version[0]) {
+ return 1;
+ }
+ else if (httpd_version.major < version[0]) {
+ return -1;
+ }
+ else if (httpd_version.minor > version[1]) {
+ return 1;
+ }
+ else if (httpd_version.minor < version[1]) {
+ return -1;
+ }
+ else if (httpd_version.patch > version[2]) {
+ return 1;
+ }
+ else if (httpd_version.patch < version[2]) {
+ return -1;
+ }
+
+ /* seems to be the same */
+ return 0;
+}
+
+/*
+ * match version against a regular expression
+ */
+static int match_version(apr_pool_t *pool, char *version_string,
+ const char **error)
+{
+ regex_t *compiled;
+ const char *to_match;
+ int rc;
+
+ compiled = ap_pregcomp(pool, version_string, REG_EXTENDED);
+ if (!compiled) {
+ *error = "Unable to compile regular expression";
+ return 0;
+ }
+
+ *error = NULL;
+
+ to_match = apr_psprintf(pool, "%d.%d.%d%s",
+ httpd_version.major,
+ httpd_version.minor,
+ httpd_version.patch,
+ httpd_version.add_string);
+
+ rc = !ap_regexec(compiled, to_match, 0, NULL, 0);
+
+ ap_pregfree(pool, compiled);
+ return rc;
+}
+
+/*
+ * Implements the <IfVersion> container
+ */
+static const char *start_ifversion(cmd_parms *cmd, void *mconfig,
+ const char *arg1, const char *arg2,
+ const char *arg3)
+{
+ const char *endp;
+ int reverse = 0, done = 0, match = 0, compare;
+ const char *p, *error;
+ char c;
+
+ /* supplying one argument is possible, we assume an equality check then */
+ if (!arg2) {
+ arg2 = arg1;
+ arg1 = "=";
+ }
+
+ /* surrounding quotes without operator */
+ if (!arg3 && *arg2 == '>' && !arg2[1]) {
+ arg3 = ">";
+ arg2 = arg1;
+ arg1 = "=";
+ }
+
+ /* the third argument makes version surrounding quotes plus operator
+ * possible.
+ */
+ endp = arg2 + strlen(arg2);
+ if ( endp == arg2
+ || (!(arg3 && *arg3 == '>' && !arg3[1]) && *--endp != '>')) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ "> directive missing closing '>'", NULL);
+ }
+
+ p = arg1;
+ if (*p == '!') {
+ reverse = 1;
+ if (p[1]) {
+ ++p;
+ }
+ }
+
+ c = *p++;
+ if (!*p || (*p == '=' && !p[1] && c != '~')) {
+ if (!httpd_version.major) {
+ ap_get_server_revision(&httpd_version);
+ }
+
+ done = 1;
+ switch (c) {
+ case '=':
+ /* normal comparison */
+ if (*arg2 != '/') {
+ compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+ endp-arg2),
+ &error);
+ if (error) {
+ return error;
+ }
+
+ match = !compare;
+ break;
+ }
+
+ /* regexp otherwise */
+ if (endp == ++arg2 || *--endp != '/') {
+ return "Missing delimiting / of regular expression.";
+ }
+
+ case '~':
+ /* regular expression */
+ match = match_version(cmd->pool, apr_pstrmemdup(cmd->pool, arg2,
+ endp-arg2),
+ &error);
+ if (error) {
+ return error;
+ }
+ break;
+
+ case '<':
+ compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+ endp-arg2),
+ &error);
+ if (error) {
+ return error;
+ }
+
+ match = ((-1 == compare) || (*p && !compare));
+ break;
+
+ case '>':
+ compare = compare_version(apr_pstrmemdup(cmd->pool, arg2,
+ endp-arg2),
+ &error);
+ if (error) {
+ return error;
+ }
+
+ match = ((1 == compare) || (*p && !compare));
+ break;
+
+ default:
+ done = 0;
+ break;
+ }
+ }
+
+ if (!done) {
+ return apr_pstrcat(cmd->pool, "unrecognized operator '", arg1, "'",
+ NULL);
+ }
+
+ if ((!reverse && match) || (reverse && !match)) {
+ ap_directive_t *parent = NULL;
+ ap_directive_t *current = NULL;
+ const char *retval;
+
+ retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd,
+ &current, &parent, "<IfVersion");
+ *(ap_directive_t **)mconfig = current;
+ return retval;
+ }
+
+ *(ap_directive_t **)mconfig = NULL;
+ return ap_soak_end_container(cmd, "<IfVersion");
+}
+
+static const command_rec version_cmds[] = {
+ AP_INIT_TAKE123("<IfVersion", start_ifversion, NULL, EXEC_ON_READ | OR_ALL,
+ "a comparison operator, a version (and a delimiter)"),
+ { NULL }
+};
+
+module AP_MODULE_DECLARE_DATA version_module =
+{
+ STANDARD20_MODULE_STUFF,
+ NULL, /* dir config creater */
+ NULL, /* dir merger --- default is to override */
+ NULL, /* server config */
+ NULL, /* merge server configs */
+ version_cmds, /* command apr_table_t */
+ NULL, /* register hooks */
+};
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.dsp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.dsp
new file mode 100644
index 00000000..e30ff21a
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.dsp
@@ -0,0 +1,128 @@
+# Microsoft Developer Studio Project File - Name="mod_version" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_version - Win32 Release
+!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 "mod_version.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 "mod_version.mak" CFG="mod_version - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mod_version - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_version - 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)" == "mod_version - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_version_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /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 /nologo /subsystem:windows /dll /out:"Release/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Release/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so /opt:ref
+
+!ELSEIF "$(CFG)" == "mod_version - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_version_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /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 /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /debug /out:"Debug/mod_version.so" /base:@..\..\os\win32\BaseAddr.ref,mod_version.so
+
+!ENDIF
+
+# Begin Target
+
+# Name "mod_version - Win32 Release"
+# Name "mod_version - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\mod_version.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod_version.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\win32ver.awk
+
+!IF "$(CFG)" == "mod_version - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_version.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_version.so "version_module for Apache" ../../include/ap_release.h > .\mod_version.rc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mod_version - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Creating Version Resource
+InputPath=..\..\build\win32\win32ver.awk
+
+".\mod_version.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ awk -f ../../build/win32/win32ver.awk mod_version.so "version_module for Apache" ../../include/ap_release.h > .\mod_version.rc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.exp b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.exp
new file mode 100644
index 00000000..3dce8456
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/mod_version.exp
@@ -0,0 +1 @@
+version_module
diff --git a/rubbos/app/httpd-2.0.64/modules/metadata/modules.mk b/rubbos/app/httpd-2.0.64/modules/metadata/modules.mk
new file mode 100644
index 00000000..fb8eff50
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/modules/metadata/modules.mk
@@ -0,0 +1,7 @@
+mod_env.la: mod_env.lo
+ $(MOD_LINK) mod_env.lo $(MOD_ENV_LDADD)
+mod_setenvif.la: mod_setenvif.lo
+ $(MOD_LINK) mod_setenvif.lo $(MOD_SETENVIF_LDADD)
+DISTCLEAN_TARGETS = modules.mk
+static = mod_env.la mod_setenvif.la
+shared =