diff -urN ../apache-1.3/Makefile.tmpl ./Makefile.tmpl
--- ../apache-1.3/Makefile.tmpl	Wed Mar 13 16:05:27 2002
+++ ./Makefile.tmpl	Thu Dec 19 00:19:20 2002
@@ -447,6 +447,7 @@
 	@echo "===> [include: Installing Apache C header files]"
 	$(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
 	$(CP) $(TOP)/$(SRC)/lib/expat-lite/*.h $(root)$(includedir)/xml/
+	$(CP) $(TOP)/$(SRC)/lib/apreq/*.h $(root)$(includedir)/
 	@osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
 		echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
 		$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
diff -urN ../apache-1.3/src/Configuration.tmpl ./src/Configuration.tmpl
--- ../apache-1.3/src/Configuration.tmpl	Thu Jan 17 08:20:50 2002
+++ ./src/Configuration.tmpl	Thu Dec 19 00:19:20 2002
@@ -187,6 +187,7 @@
 Rule IRIXN32=yes
 Rule PARANOID=no
 Rule EXPAT=default
+Rule APREQ=yes
 Rule CYGWIN_WINSOCK=no 
 
 # DEV_RANDOM:
diff -urN ../apache-1.3/src/Configure ./src/Configure
--- ../apache-1.3/src/Configure	Thu Oct 10 12:36:21 2002
+++ ./src/Configure	Thu Dec 19 00:19:21 2002
@@ -235,6 +235,7 @@
 RULE_IRIXN32=`./helpers/CutRule IRIXN32 $file`
 RULE_PARANOID=`./helpers/CutRule PARANOID $file`
 RULE_EXPAT=`./helpers/CutRule EXPAT $file`
+RULE_APREQ=`./helpers/CutRule APREQ $file`
 RULE_CYGWIN_WINSOCK=`./helpers/CutRule CYGWIN_WINSOCK $file` 
 RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file`
 RULE_SHARED_CHAIN=`./helpers/CutRule SHARED_CHAIN $file`
@@ -1921,6 +1922,14 @@
     fi
 fi
 
+#APREQ HACK
+if [ "x$RULE_APREQ" = "xyes" ]; then
+    echo " + building with static apreq"
+    APREQLIB="lib/apreq/libapreq.a"
+    APLIBDIRS="apreq $APLIBDIRS"
+    CFLAGS="$CFLAGS -DUSE_APREQ -I\$(SRCDIR)/lib/apreq"
+fi
+
 ####################################################################
 ## Now the SHARED_CHAIN stuff
 ##
@@ -2182,6 +2191,7 @@
 echo "MFLAGS_STATIC=$MFLAGS_STATIC" >>Makefile.config
 echo "REGLIB=$REGLIB" >>Makefile.config
 echo "EXPATLIB=$EXPATLIB" >>Makefile.config
+echo "APREQLIB=$APREQLIB" >>Makefile.config
 echo "RANLIB=$RANLIB" >>Makefile.config
 
 ####################################################################
diff -urN ../apache-1.3/src/Makefile.tmpl ./src/Makefile.tmpl
--- ../apache-1.3/src/Makefile.tmpl	Mon May 13 04:13:06 2002
+++ ./src/Makefile.tmpl	Thu Dec 19 00:19:21 2002
@@ -33,7 +33,7 @@
 target_static: subdirs modules.o
 	$(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c
 	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \
-	      -o $(TARGET) buildmark.o $(OBJS) $(REGLIB) $(EXPATLIB) $(LIBS)
+	      -o $(TARGET) buildmark.o $(OBJS) $(REGLIB) $(EXPATLIB) $(APREQLIB) $(LIBS)
 
 target_compile_only: subdirs modules.o
 	$(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c
@@ -50,7 +50,7 @@
 
 lib$(TARGET).$(SHLIB_SUFFIX_NAME): subdirs modules.o
 	$(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c
-	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o lib$(TARGET).$(SHLIB_SUFFIX_NAME) buildmark.o $(OBJS) $(REGLIB) $(EXPATLIB) $(LD_SHCORE_DEF) $(LD_SHCORE_LIBS)
+	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o lib$(TARGET).$(SHLIB_SUFFIX_NAME) buildmark.o $(OBJS) $(REGLIB) $(EXPATLIB) $(APREQLIB) $(LD_SHCORE_DEF) $(LD_SHCORE_LIBS)
 	@if [ ".$(SHLIB_SUFFIX_LIST)" != . ]; then \
 		rm -f lib$(TARGET).$(SHLIB_SUFFIX_NAME).*; \
 		for suffix in $(SHLIB_SUFFIX_LIST) ""; do \
diff -urN ../apache-1.3/src/lib/apreq/Makefile.tmpl ./src/lib/apreq/Makefile.tmpl
--- ../apache-1.3/src/lib/apreq/Makefile.tmpl	Wed Dec 31 19:00:00 1969
+++ ./src/lib/apreq/Makefile.tmpl	Thu Dec 19 00:19:21 2002
@@ -0,0 +1,26 @@
+#
+# default definition of these two. dunno how to get it prepended when the
+# Makefile is built, so we do it manually
+#
+CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -DAPACHE
+INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
+
+OBJS=apache_request.o apache_multipart_buffer.o apache_cookie.o
+
+all lib: libapreq.a
+
+libapreq.a: $(OBJS)
+	rm -f libapreq.a
+	ar cr libapreq.a $(OBJS)
+	$(RANLIB) libapreq.a
+
+clean:
+	rm -f $(OBJS) libapreq.a
+
+distclean: clean
+	-rm -f Makefile
+
+.SUFFIXES: .o
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $<
diff -urN ../apache-1.3/src/main/http_main.c ./src/main/http_main.c
--- ../apache-1.3/src/main/http_main.c	Fri Oct 25 17:12:23 2002
+++ ./src/main/http_main.c	Thu Dec 19 00:19:21 2002
@@ -7907,3 +7907,15 @@
 }
 #endif /* USE_EXPAT */
 
+
+/* force apreq to be linked into the server executable */
+#if defined(USE_APREQ) && !defined(SHARED_CORE_BOOTSTRAP)
+#include "apache_request.h"
+#include "apache_cookie.h"
+ApacheRequest *suck_in_apreq(request_rec *r);
+ApacheRequest *suck_in_apreq(request_rec *r)
+{
+    return ApacheCookie_new(r), ApacheRequest_new(r);
+}
+#endif /* USE_APREQ */
+
