]> granicus.if.org Git - apache/commitdiff
Apache 1.3.9 baseline for the Apache 2.0 repository.
authorRoy T. Fielding <fielding@apache.org>
Tue, 24 Aug 1999 05:50:50 +0000 (05:50 +0000)
committerRoy T. Fielding <fielding@apache.org>
Tue, 24 Aug 1999 05:50:50 +0000 (05:50 +0000)
Obtained from: Apache 1.3.9 (minus unused files), tag APACHE_1_3_9
Submitted by: Apache Group

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83749 13f79535-47bb-0310-9956-ffa450edef68

22 files changed:
build/MakeEtags [new file with mode: 0755]
build/PrintPath [new file with mode: 0755]
build/install.sh [new file with mode: 0755]
build/mkdir.sh [new file with mode: 0755]
include/.cvsignore [new file with mode: 0644]
include/.indent.pro [new file with mode: 0644]
include/ap_config.h [new file with mode: 0644]
include/ap_mmn.h [new file with mode: 0644]
include/http_conf_globals.h [new file with mode: 0644]
include/http_config.h [new file with mode: 0644]
include/http_core.h [new file with mode: 0644]
include/http_log.h [new file with mode: 0644]
include/http_main.h [new file with mode: 0644]
include/http_protocol.h [new file with mode: 0644]
include/http_request.h [new file with mode: 0644]
include/http_vhost.h [new file with mode: 0644]
include/httpd.h [new file with mode: 0644]
include/rfc1413.h [new file with mode: 0644]
include/util_date.h [new file with mode: 0644]
include/util_md5.h [new file with mode: 0644]
include/util_script.h [new file with mode: 0644]
include/util_uri.h [new file with mode: 0644]

diff --git a/build/MakeEtags b/build/MakeEtags
new file mode 100755 (executable)
index 0000000..25f6bda
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# This file illustrates how to generate a useful TAGS file via etags
+# for emacs.  This should be invoked from the src directory i.e.:
+#   > helpers/MakeEtags
+# and will create a TAGS file in the src directory.
+
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+# Once you have created src/TAGS in emacs you'll need to setup
+# tag-table-alist with an entry to assure it finds the single src/TAGS
+# file from the many source directories.  Something along these lines:
+# (setq tag-table-alist
+#      '(("/home/me/work/apache-1.3/src/" 
+#         . "/home/me/work/apache-1.3/src/")
+#       ))
+
+# This requires a special version of etags, i.e. the
+# one called "Exuberant ctags" available at:
+#    http://fly.hiwaay.net/~darren/ctags/
+# Once that is setup you'll need to point to the
+# executable here:
+
+etags=~/local/bin/etags
+
+# Exuberant etags is necessary since it can ignore some defined symbols
+# that obscure the function signatures.
+
+ignore=API_EXPORT,API_EXPORT_NONSTD,__declspec
+
+# Create an etags file at the root of the source
+# tree, then create symbol links to it from each
+# directory in the source tree.  By passing etags
+# absolute pathnames we get a tag file that is
+# NOT portable when we move the directory tree.
+
+find . -name '*.[ch]' -print | $etags -I "$ignore"  -L -
+
diff --git a/build/PrintPath b/build/PrintPath
new file mode 100755 (executable)
index 0000000..908d274
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/sh
+# Look for program[s] somewhere in $PATH.
+#
+# Options:
+#  -s
+#    Do not print out full pathname. (silent)
+#  -pPATHNAME
+#    Look in PATHNAME instead of $PATH
+#
+# Usage:
+#  PrintPath [-s] [-pPATHNAME] program [program ...]
+#
+# Initially written by Jim Jagielski for the Apache configuration mechanism
+#  (with kudos to Kernighan/Pike)
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+##
+# Some "constants"
+##
+pathname=$PATH
+echo="yes"
+
+##
+# Find out what OS we are running for later on
+##
+os=`(uname) 2>/dev/null`
+
+##
+# Parse command line
+##
+for args in $*
+do
+    case $args in
+       -s  ) echo="no" ;;
+       -p* ) pathname="`echo $args | sed 's/^..//'`" ;;
+       *   ) programs="$programs $args" ;;
+    esac
+done
+
+##
+# Now we make the adjustments required for OS/2 and everyone
+# else :)
+#
+# First of all, all OS/2 programs have the '.exe' extension.
+# Next, we adjust PATH (or what was given to us as PATH) to
+# be whitespace seperated directories.
+# Finally, we try to determine the best flag to use for
+# test/[] to look for an executable file. OS/2 just has '-r'
+# but with other OSs, we do some funny stuff to check to see
+# if test/[] knows about -x, which is the prefered flag.
+##
+
+if [ "x$os" = "xOS/2" ]
+then
+    ext=".exe"
+    pathname=`echo -E $pathname |
+     sed 's/^;/.;/
+         s/;;/;.;/g
+         s/;$/;./
+         s/;/ /g
+         s/\\\\/\\//g' `
+    test_exec_flag="-r"
+else
+    ext=""     # No default extensions
+    pathname=`echo $pathname |
+     sed 's/^:/.:/
+         s/::/:.:/g
+         s/:$/:./
+         s/:/ /g' `
+    # Here is how we test to see if test/[] can handle -x
+    testfile="pp.t.$$"
+
+    cat > $testfile <<ENDTEST
+#!/bin/sh
+if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
+    exit 0
+fi
+exit 1
+ENDTEST
+
+    if `/bin/sh $testfile 2>/dev/null`; then
+       test_exec_flag="-x"
+    else
+       test_exec_flag="-r"
+    fi
+    rm -f $testfile
+fi
+
+for program in $programs
+do
+    for path in $pathname
+    do
+       if [ $test_exec_flag $path/${program}${ext} ] && \
+          [ ! -d $path/${program}${ext} ]; then
+           if [ "x$echo" = "xyes" ]; then
+               echo $path/${program}${ext}
+           fi
+           exit 0
+       fi
+    done
+done
+exit 1
+
diff --git a/build/install.sh b/build/install.sh
new file mode 100755 (executable)
index 0000000..9a8821f
--- /dev/null
@@ -0,0 +1,112 @@
+#!/bin/sh
+##
+##  install.sh -- install a program, script or datafile
+##
+##  Based on `install-sh' from the X Consortium's X11R5 distribution
+##  as of 89/12/18 which is freely available.
+##  Cleaned up for Apache's Autoconf-style Interface (APACI)
+##  by Ralf S. Engelschall <rse@apache.org>
+##
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+
+#
+#   put in absolute paths if you don't have them in your path; 
+#   or use env. vars.
+#
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+#
+#   parse argument line
+#
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+ext=""
+src=""
+dst=""
+while [ "x$1" != "x" ]; do
+    case $1 in
+        -c) instcmd="$cpprog"
+            shift; continue
+            ;;
+        -m) chmodcmd="$chmodprog $2"
+            shift; shift; continue
+            ;;
+        -o) chowncmd="$chownprog $2"
+            shift; shift; continue
+            ;;
+        -g) chgrpcmd="$chgrpprog $2"
+            shift; shift; continue
+            ;;
+        -s) stripcmd="$stripprog"
+            shift; continue
+            ;;
+        -S) stripcmd="$stripprog $2"
+            shift; shift; continue
+            ;;
+        -e) ext="$2"
+            shift; shift; continue
+            ;;
+        *)  if [ "x$src" = "x" ]; then
+                src=$1
+            else
+                dst=$1
+            fi
+            shift; continue
+            ;;
+    esac
+done
+if [ "x$src" = "x" ]; then
+     echo "install.sh: no input file specified"
+     exit 1
+fi
+if [ "x$dst" = "x" ]; then
+     echo "install.sh: no destination specified"
+     exit 1
+fi
+
+#
+#  If destination is a directory, append the input filename; if
+#  your system does not like double slashes in filenames, you may
+#  need to add some logic
+#
+if [ -d $dst ]; then
+    dst="$dst/`basename $src`"
+fi
+
+#  Add a possible extension (such as ".exe") to src and dst
+src="$src$ext"
+dst="$dst$ext"
+
+#  Make a temp file name in the proper directory.
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+#  Move or copy the file name to the temp name
+$instcmd $src $dsttmp
+
+#  And set any options; do chmod last to preserve setuid bits
+if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
+if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
+if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
+if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
+
+#  Now rename the file to the real destination.
+$rmcmd $dst
+$mvcmd $dsttmp $dst
+
+exit 0
+
diff --git a/build/mkdir.sh b/build/mkdir.sh
new file mode 100755 (executable)
index 0000000..4cd33c5
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+## 
+##  mkdir.sh -- make directory hierarchy
+##
+##  Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu>
+##  as of 1994-03-25, which was placed in the Public Domain.
+##  Cleaned up for Apache's Autoconf-style Interface (APACI)
+##  by Ralf S. Engelschall <rse@apache.org>
+##
+#
+# This script falls under the Apache License.
+# See http://www.apache.org/docs/LICENSE
+
+
+umask 022
+errstatus=0
+for file in ${1+"$@"} ; do 
+    set fnord `echo ":$file" |\
+               sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
+    shift
+    pathcomp=
+    for d in ${1+"$@"}; do
+        pathcomp="$pathcomp$d"
+        case "$pathcomp" in
+            -* ) pathcomp=./$pathcomp ;;
+        esac
+        if test ! -d "$pathcomp"; then
+            echo "mkdir $pathcomp" 1>&2
+            mkdir "$pathcomp" || errstatus=$?
+        fi
+        pathcomp="$pathcomp/"
+    done
+done
+exit $errstatus
+
diff --git a/include/.cvsignore b/include/.cvsignore
new file mode 100644 (file)
index 0000000..49eae94
--- /dev/null
@@ -0,0 +1 @@
+ap_config_auto.h
diff --git a/include/.indent.pro b/include/.indent.pro
new file mode 100644 (file)
index 0000000..a9fbe9f
--- /dev/null
@@ -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/include/ap_config.h b/include/ap_config.h
new file mode 100644 (file)
index 0000000..e7219cf
--- /dev/null
@@ -0,0 +1,1394 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef AP_CONFIG_H
+#define AP_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ap_config.h: system-dependant #defines and includes...
+ * See PORTING for a listing of what they mean
+ */
+
+#include "ap_mmn.h"            /* MODULE_MAGIC_NUMBER_ */
+
+/*
+ * Support for platform dependent autogenerated defines
+ */
+#ifndef WIN32
+#include "ap_config_auto.h"
+#else
+/* not available under WIN32, so provide important entries manually */
+#undef HAVE_UNISTD_H
+#endif
+
+/* Have to include sys/stat.h before ../os/win32/os.h so we can override
+stat() properly */
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* So that we can use inline on some critical functions, and use
+ * GNUC attributes (such as to get -Wall warnings for printf-like
+ * functions).  Only do this in gcc 2.7 or later ... it may work
+ * on earlier stuff, but why chance it.
+ *
+ * We've since discovered that the gcc shipped with NeXT systems
+ * as "cc" is completely broken.  It claims to be __GNUC__ and so
+ * on, but it doesn't implement half of the things that __GNUC__
+ * means.  In particular it's missing inline and the __attribute__
+ * stuff.  So we hack around it.  PR#1613. -djg
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || \
+    (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
+    defined(NEXT)
+#define ap_inline
+#define __attribute__(__x)
+#define ENUM_BITFIELD(e,n,w)  signed int n : w
+#else
+#define ap_inline __inline__
+#define USE_GNU_INLINE
+#define ENUM_BITFIELD(e,n,w)  e n : w
+#endif
+
+#ifdef WIN32
+/* include process.h first so we can override spawn[lv]e* properly */
+#include <process.h>
+#include "../os/win32/os.h"
+#else
+#include "os.h"
+#endif
+
+#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF)
+#include <sys/param.h>
+#endif
+
+/* Define one of these according to your system. */
+#if defined(MINT)
+typedef int rlim_t;
+#define JMP_BUF sigjmp_buf
+#define NO_LONG_DOUBLE
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define _BSD_SOURCE
+#define EAGAIN EWOULDBLOCK
+int initgroups (char *, int);     
+char *crypt (const char *pw, const char *salt);
+int gethostname (char *name, int namelen);
+
+#elif defined(MPE)
+#include <sys/times.h>
+#define NO_SETSID
+#define NO_KILLPG
+#define NO_WRITEV
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define SHM_R 0400  /* Read permission */
+#define SHM_W 0200  /* Write permission */
+#define NEED_INITGROUPS
+#define NEED_STRCASECMP
+#define NEED_STRDUP
+#define NEED_STRNCASECMP
+extern void GETPRIVMODE();
+extern void GETUSERMODE();
+extern char *inet_ntoa();
+#define NO_SLACK
+#define NO_GETTIMEOFDAY
+#define S_IEXEC  S_IXUSR
+#define S_IREAD  S_IRUSR
+#define S_IWRITE S_IWUSR
+#define PF_INET  AF_INET
+
+#elif defined(SUNOS4)
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+char *crypt(const char *pw, const char *salt);
+char *mktemp(char *template);
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#include <sys/time.h>
+#define NEED_STRERROR
+typedef int rlim_t;
+#define memmove(a,b,c) bcopy(b,a,c)
+#define NO_LINGCLOSE
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define NEED_DIFFTIME
+#define HAVE_SYSLOG 1
+
+#elif defined(SOLARIS2)
+#undef HAVE_GMTOFF
+#define NO_KILLPG
+#undef NO_SETSID
+#define bzero(a,b) memset(a,0,b)
+#if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
+    !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+#define NEED_UNION_SEMUN
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+int gethostname(char *name, int namelen);
+#define HAVE_SYSLOG 1
+#define SYS_SIGLIST _sys_siglist
+
+#elif defined(IRIX)
+#undef HAVE_GMTOFF
+/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
+ * there's some weird conflict with non-BSD signals */
+#define NO_KILLPG
+#undef NO_SETSID
+#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
+    !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
+    !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define HAVE_MMAP 1
+#define USE_MMAP_FILES
+#define NO_LONG_DOUBLE
+#define NO_LINGCLOSE
+#define HAVE_SYSLOG 1
+
+#elif defined(HIUX)
+#undef HAVE_GMTOFF
+#define NO_KILLPG
+#undef NO_SETSID
+#ifndef _HIUX_SOURCE
+#define _HIUX_SOURCE
+#endif
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define SELECT_NEEDS_CAST
+#define HAVE_SYSLOG 1
+
+#elif defined(HPUX) || defined(HPUX10)
+#undef HAVE_GMTOFF
+#define NO_KILLPG
+#undef NO_SETSID
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#ifndef _HPUX_SOURCE
+#define _HPUX_SOURCE
+#endif
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define HAVE_SYSLOG 1
+#ifndef HPUX10
+#define SELECT_NEEDS_CAST
+typedef int rlim_t;
+#endif
+
+#elif defined(HPUX11)
+#ifndef _HPUX_SOURCE
+#define _HPUX_SOURCE
+#endif
+#define HAVE_SHMGET
+#define USE_SHMGET_SCOREBOARD
+#undef  HAVE_GMTOFF
+#define USE_FCNTL_SERIALIZED_ACCEPT
+/* feeling brave?  want to try using POSIX mutexes? */
+/* #define HAVE_MMAP */
+/* #define USE_MMAP_SCOREBOARD */
+/* #define USE_MMAP_FILES */
+/* #define USE_PTHREAD_SERIALIZED_ACCEPT */
+#define NO_KILLPG
+#undef  NO_SETSID
+#define HAVE_SYSLOG
+
+#elif defined(AIX)
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#ifndef __ps2__
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define HAVE_SYSLOG 1
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP "nobody"
+#endif
+#endif
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "nobody"
+#endif
+#ifdef NEED_RLIM_T
+typedef int rlim_t;
+#endif
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#ifdef USEBCOPY
+#define memmove(a,b,c) bcopy(b,a,c)
+#endif
+#if AIX >= 42
+#define NET_SIZE_T size_t
+#endif
+
+#elif defined(ULTRIX)
+/* we don't want to use sys/resource.h under
+   Ultrix although this header exists. */
+#undef HAVE_SYS_RESOURCE_H
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+#define ULTRIX_BRAIN_DEATH
+#define NEED_STRDUP
+/* If you have Ultrix 4.3, and are using cc, const is broken */
+#ifndef __ultrix__             /* Hack to check for pre-Ultrix 4.4 cc */
+#define const                  /* Not implemented */
+#endif
+
+#elif defined(OSF1)
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define NO_LONG_DOUBLE
+#define HAVE_SYSLOG 1
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+
+#elif defined(PARAGON)
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define NO_LONG_DOUBLE
+#define HAVE_SYSLOG 1
+typedef int rlim_t;
+
+#elif defined(SEQUENT)
+#define DEFAULT_USER "nobody"
+#define DEFAULT_GROUP "nobody"
+#define NO_SHMGET 1
+#define HAVE_MMAP 1
+#define HAVE_SYSLOG 1
+#define USE_MMAP_FILES 1
+#define USE_MMAP_SCOREBOARD 1
+#define USE_FCNTL_SERIALIZED_ACCEPT 1
+#define JMP_BUF sigjmp_buf
+#undef NO_SETSID
+#if SEQUENT < 40
+typedef int rlim_t;
+#define NO_GETTIMEOFDAY
+#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
+#include <sys/times.h>
+#endif
+#if SEQUENT < 42
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#endif
+#if SEQUENT < 44
+#define NO_KILLPG 1
+#define NET_SIZE_T int
+#endif
+#if SEQUENT >= 44
+#undef NO_KILLPG
+#define NET_SIZE_T size_t
+#endif
+
+#elif defined(NEXT)
+typedef unsigned short mode_t;
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#define NO_SETSID
+#define NEED_STRDUP
+#define NO_LINGCLOSE
+#undef _POSIX_SOURCE
+#ifndef FD_CLOEXEC
+#define FD_CLOEXEC 1
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
+#endif
+#ifndef S_ISREG
+#define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
+#endif
+#ifndef S_IXUSR
+#define S_IXUSR 00100
+#endif
+#ifndef S_IRGRP
+#define S_IRGRP 00040
+#endif
+#ifndef S_IXGRP
+#define S_IXGRP 00010
+#endif
+#ifndef S_IROTH
+#define S_IROTH 00004
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 00001
+#endif
+#ifndef S_IRUSR
+#define S_IRUSR S_IREAD
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR S_IWRITE
+#endif
+#ifndef S_IWGRP
+#define S_IWGRP        000020
+#endif
+#ifndef S_IWOTH
+#define S_IWOTH 000002
+#endif
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* PR#2293 fix */
+#define        ap_wait_t       union wait
+#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
+#define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
+#define WTERMSIG(status)       (int)( (status).w_termsig )
+
+typedef int pid_t;
+#define USE_LONGJMP
+#define NO_USE_SIGACTION
+#define HAVE_SYSLOG 1
+
+#if defined(__DYNAMIC__)
+#define HAVE_DYLD
+#define DYLD_CANT_UNLOAD
+#endif
+
+#elif defined(MAC_OS) || defined(MAC_OS_X_SERVER) /* Mac OS (>= 10.0) and Mac OS X Server (<= 5.x) */
+#undef PLATFORM
+#ifdef MAC_OS_X_SERVER
+#define PLATFORM "Mac OS X Server"
+#else
+#define PLATFORM "Mac OS"
+#endif
+#define HAVE_DYLD
+#ifdef MAC_OS_X_SERVER
+#define DYLD_CANT_UNLOAD
+#endif /* MAC_OS_X_SERVER */
+#define HAVE_GMTOFF
+#define HAVE_MMAP
+#define USE_MMAP_FILES
+#define USE_MMAP_SCOREBOARD
+#ifdef MAC_OS_X_SERVER
+#define MAP_TMPFILE
+#endif /* MAC_OS_X_SERVER */
+#define HAVE_RESOURCE
+#define HAVE_SNPRINTF
+#define JMP_BUF jmp_buf
+#define USE_LONGJMP
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+/*
+ * If you are using APACI, (you probably should be on Mac OS) these
+ * values are set at configure time.
+ */
+#ifndef HTTPD_ROOT
+#define HTTPD_ROOT              "/Local/Library/WebServer"
+#endif
+#ifndef DOCUMENT_LOCATION
+#define DOCUMENT_LOCATION       HTTPD_ROOT "/Documents"
+#endif
+#ifndef DEFAULT_XFERLOG
+#define DEFAULT_XFERLOG         "Logs/Access"
+#endif
+#ifndef DEFAULT_ERRORLOG
+#define DEFAULT_ERRORLOG        "Logs/Errors"
+#endif
+#ifndef DEFAULT_PIDLOG
+#define DEFAULT_PIDLOG          "Logs/Process"
+#endif
+#ifndef DEFAULT_SCOREBOARD
+#define DEFAULT_SCOREBOARD      "Logs/Status"
+#endif
+#ifndef DEFAULT_LOCKFILE
+#define DEFAULT_LOCKFILE        "Logs/Lock"
+#endif
+#ifndef SERVER_CONFIG_FILE
+#define SERVER_CONFIG_FILE      "Configuration/Server"
+#endif
+#ifndef RESOURCE_CONFIG_FILE
+#define RESOURCE_CONFIG_FILE    "Configuration/Resources"
+#endif
+#ifndef TYPES_CONFIG_FILE
+#define TYPES_CONFIG_FILE       "Configuration/MIME"
+#endif
+#ifndef ACCESS_CONFIG_FILE
+#define ACCESS_CONFIG_FILE      "Configuration/Access"
+#endif
+#ifndef DEFAULT_USER_DIR
+#define DEFAULT_USER_DIR        "Library/Web Documents"
+#endif
+#ifndef DEFAULT_USER
+#define DEFAULT_USER            "www"
+#endif
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP           "www"
+#endif
+#ifndef DEFAULT_PATH
+#define DEFAULT_PATH            "/bin:/usr/bin:/usr/local/bin"
+#endif
+
+#elif defined(LINUX)
+
+#if LINUX > 1
+#include <features.h>
+
+/* libc4 systems probably still work, it probably doesn't define
+ *  __GNU_LIBRARY__
+ * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
+ * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
+ * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
+ * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
+ * __GLIBC__ < 2
+ * all glibc based systems need crypt.h
+ */
+#if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
+#include <crypt.h>
+#endif
+
+/* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
+ * there's no way to discern between these two libraries.  But using int should
+ * be portable because otherwise these libs would be hopelessly broken with
+ * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
+ * later.
+ *
+ * int works for all the earlier libs, and is picked up by default later.
+ */
+#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
+#define NET_SIZE_T socklen_t
+#endif
+
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define HAVE_MMAP 1
+#define USE_MMAP_FILES
+
+/* flock is faster ... but hasn't been tested on 1.x systems */
+/* PR#3531 indicates flock() may not be stable, probably depends on
+ * kernel version.  Go back to using fcntl, but provide a way for
+ * folks to tweak their Configuration to get flock.
+ */
+#ifndef USE_FLOCK_SERIALIZED_ACCEPT
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+
+#define SYS_SIGLIST    _sys_siglist
+
+#else
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#undef NEED_STRDUP
+#include <sys/time.h>
+#define HAVE_SYSLOG 1
+
+/* glibc 2.1 and later finally define rlim_t */
+#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
+typedef int rlim_t;
+#endif
+
+#elif defined(SCO)
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#define NEED_INITGROUPS
+#define NO_WRITEV
+#include <sys/time.h>
+#define HAVE_SYSLOG 1
+#undef HAVE_SYS_RESOURCE_H
+
+#elif defined(SCO5)
+
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define SecureWare
+#define HAVE_SYSLOG 1
+
+/* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
+   consts. Sigh. */
+extern int strcasecmp(const char *, const char *);
+extern int strncasecmp(const char *, const char *, unsigned);
+
+#elif defined(AUX3)
+/* These are to let -Wall compile more cleanly */
+extern int strcasecmp(const char *, const char *);
+extern int strncasecmp(const char *, const char *, unsigned);
+extern int set42sig(), getopt(), getpeername(), bzero();
+extern int listen(), bind(), socket(), getsockname();
+extern int accept(), gethostname(), connect(), lstat();
+extern int select(), killpg(), shutdown();
+extern int initgroups(), setsockopt();
+extern char *shmat();
+extern int shmctl();
+extern int shmget();
+extern char *sbrk();
+extern char *crypt();
+#include <sys/time.h>
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#define NEED_STRDUP
+/* fcntl() locking is expensive with NFS */
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+/*
+ * NOTE: If when you run Apache under A/UX and you get a warning
+ * that httpd couldn't move break, then the below value for
+ * MOVEBREAK (64megs) is too large for your setup. Try reducing
+ * to 0x2000000 which is still PLENTY of space. I doubt if
+ * even on heavy systems sbrk() would be called at all...
+ */
+#define MOVEBREAK              0x4000000
+#define NO_LINGCLOSE
+#define NO_SLACK
+#define HAVE_SYSLOG 1
+#undef HAVE_SYS_RESOURCE_H     /* exists but does not provide *rlimit funcs */
+
+#elif defined(SVR4)
+#define NO_KILLPG
+#undef  NO_SETSID
+#undef NEED_STRDUP
+#ifndef MPRAS
+#define NEED_STRCASECMP
+#ifndef ENCORE
+#define NEED_STRNCASECMP
+#endif /* ENCORE */
+#endif /* MPRAS */
+#define bzero(a,b) memset(a,0,b)
+/* A lot of SVR4 systems need this */
+#ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+#define HAVE_SYSLOG 1
+#define NET_SIZE_T size_t
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
+#define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
+#define _KMEMUSER          /* Enable SHM_R/SHM_W defines in <shm.h> */
+#undef NEED_STRCASECMP
+#undef NEED_STRNCASECMP
+#undef bzero
+#endif /*_OSD_POSIX*/
+
+#elif defined(UW)
+#if UW < 700
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define NO_LINGCLOSE
+#define NO_KILLPG
+#endif
+#undef  NO_SETSID
+#undef NEED_STRDUP
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#define bzero(a,b) memset(a,0,b)
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define HAVE_SHMGET 1
+#undef USE_SHMGET_SCOREBOARD   /* force use of mmap() scoreboard */
+#include <sys/time.h>
+#if UW >= 200
+#define _POSIX_SOURCE
+#endif
+#define NET_SIZE_T size_t
+#define HAVE_SYSLOG 1
+
+#elif defined(DGUX)
+#define NO_KILLPG
+#undef  NO_SETSID
+#undef NEED_STRDUP
+#ifdef _IX86_DG
+#undef NEED_STRCASECMP
+#undef NEED_STRNCASECMP
+#else
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#endif
+#define bzero(a,b) memset(a,0,b)
+/* A lot of SVR4 systems need this */
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define ap_inet_addr inet_network
+#define HAVE_SYSLOG 1
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+#define HAVE_SYSLOG 1
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "nobody"
+#endif
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP "nogroup"
+#endif
+#define HAVE_SHMGET 1
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+
+#elif defined(UTS21)
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#define NO_SETSID
+#define NEED_WAITPID
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+#define HAVE_SYSLOG 1
+#define USE_LONGJMP
+#define JMP_BUF jmp_buf
+#define NO_USE_SIGACTION
+#define NEED_STRERROR
+#define NEED_STRSTR
+#define NEED_HASHBANG_EMUL
+#define NDELAY_PIPE_RETURNS_ZERO
+#define NO_DATA NO_ADDRESS
+#define        ap_wait_t               union wait
+#define WEXITSTATUS(status)    (int)((status).w_retcode)
+#define WTERMSIG(status)       (int)((status).w_termsig)
+#define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
+#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
+#include <sys/types.h>
+#include <sys/time.h>     
+
+#elif defined(APOLLO)
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#define HAVE_SYSLOG 1
+
+#elif defined(__FreeBSD__) || defined(__bsdi__)
+#if defined(__FreeBSD__)
+#include <osreldate.h>
+#endif
+#define HAVE_GMTOFF 1
+#undef NO_KILLPG
+#undef NO_SETSID
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "nobody"
+#endif
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP "nogroup"
+#endif
+#if defined(__bsdi__) || \
+(defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
+typedef quad_t rlim_t;
+#endif
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+#define HAVE_SYSLOG 1
+#define SYS_SIGLIST sys_siglist
+
+#elif defined(QNX)
+#ifndef crypt
+char *crypt(const char *pw, const char *salt);
+#endif
+#ifndef initgroups
+int initgroups(char *, int);
+#endif
+#ifndef strncasecmp
+#define strncasecmp strnicmp
+#endif
+#undef NO_KILLPG
+#undef NO_SETSID
+#define NEED_INITGROUPS
+#define NEED_SELECT_H
+#define NEED_PROCESS_H
+#include <unix.h>
+#define HAVE_MMAP 1
+#define USE_POSIX_SCOREBOARD
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+#define HAVE_SYSLOG 1
+
+#elif defined(LYNXOS)
+#undef HAVE_GMTOFF
+#undef USE_MMAP_SCOREBOARD
+#undef USE_SHMGET_SCOREBOARD
+#undef USE_FCNTL_SERIALIZED_ACCEPT
+#undef USE_FLOCK_SERIALIZED_ACCEPT
+#define USE_LONGJMP
+#undef NO_KILLPG
+#undef NO_SETSID
+#undef NO_USE_SIGACTION
+#undef NO_LINGCLOSE
+extern char *crypt(char *pw, char *salt);
+typedef int rlim_t;
+#define HAVE_SYSLOG 1
+
+#elif defined(UXPDS)
+#undef NEED_STRCASECMP
+#undef NEED_STRNCASECMP
+#undef NEED_STRDUP
+#undef HAVE_GMTOFF
+#define NO_KILLPG
+#undef NO_SETSID
+#define bzero(a,b) memset(a,0,b)
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define HAVE_SYSLOG 1
+
+#elif defined(OS2)
+/* Defines required for EMX OS/2 port. */
+#define NO_KILLPG
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#define NEED_PROCESS_H
+#define NO_SETSID
+#define NO_TIMES
+#define CASE_BLIND_FILESYSTEM
+/* Add some drive name support */
+#define chdir _chdir2
+#include <sys/time.h>
+#define MAXSOCKETS 2048
+#define USE_OS2_SCOREBOARD
+#define NO_RELIABLE_PIPED_LOGS
+#define USE_OS2SEM_SERIALIZED_ACCEPT
+#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+
+#elif defined(__MACHTEN__)
+typedef int rlim_t;
+#undef NO_KILLPG
+#define NO_SETSID
+#define HAVE_GMTOFF 1
+#ifndef __MACHTEN_PPC__
+#ifndef __MACHTEN_68K__
+#define __MACHTEN_68K__
+#endif
+#define USE_FLOCK_SERIALIZED_ACCEPT
+#define NO_USE_SIGACTION
+#define JMP_BUF sigjmp_buf
+#define USE_LONGJMP
+#undef NEED_STRDUP
+#else
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#endif
+
+/* Convex OS v11 */
+#elif defined(CONVEXOS11)
+#undef HAVE_GMTOFF
+#undef NO_KILLPG
+#undef NO_SETSID
+#undef NEED_STRDUP
+#define HAVE_MMAP 1
+#define USE_MMAP_SCOREBOARD
+#define USE_MMAP_FILES
+#define HAVE_SYSLOG 1
+
+#define NO_TIMEZONE
+#include <stdio.h>
+#include <sys/types.h>
+typedef int rlim_t;
+
+#elif defined(ISC)
+#include <net/errno.h>
+#define NO_KILLPG
+#undef NO_SETSID
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define HAVE_SYSLOG 1
+
+#elif defined(NEWSOS)
+#define HAVE_SHMGET 1
+#define USE_SHMGET_SCOREBOARD
+#define USE_LONGJMP
+#define NO_SETSID
+#define NO_USE_SIGACTION
+#define NEED_WAITPID
+#define NO_OTHER_CHILD
+#define HAVE_SYSLOG 1
+#include <sys/time.h>
+#include <stdlib.h>
+#include <sys/types.h>
+typedef int pid_t;
+typedef int rlim_t;
+typedef int mode_t;
+
+#elif defined(RISCIX)
+#include <sys/time.h>
+typedef int rlim_t;
+#define NO_USE_SIGACTION
+#define USE_LONGJMP
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#define NEED_STRDUP
+
+#elif defined(BEOS)
+#include <stddef.h>
+
+#define NO_WRITEV
+#define NO_KILLPG
+#define NEED_INITGROUPS
+
+#elif defined(_CX_SX)
+#define JMP_BUF sigjmp_buf
+#include <sys/types.h>
+#include <sys/time.h>
+
+#elif defined(WIN32)
+
+/* All windows stuff is now in os/win32/os.h */
+
+#elif defined(TPF) /* IBM Transaction Processing Facility operating system */
+
+#include <tpfeq.h>
+#include <tpfio.h>
+#include <sysapi.h>
+#include <sysgtime.h>
+#define PRIMECRAS 0x010000
+#define JMP_BUF jmp_buf
+#define HAVE_SHMGET
+#undef  HAVE_SYS_RESOURCE_H
+#define NEED_INITGROUPS
+#define NEED_SIGNAL_INTERRUPT
+#include <strings.h>
+#ifndef __strings_h
+#define NEED_STRCASECMP
+#define NEED_STRNCASECMP
+#endif
+#define NEED_STRDUP
+#define NO_DBM_REWRITEMAP
+#define NO_GETTIMEOFDAY
+#define NO_KILLPG
+#define NO_LINGCLOSE
+#define NO_MMAP
+#define NO_OTHER_CHILD
+#define NO_RELIABLE_PIPED_LOGS
+#define NO_SETSID
+#define NO_SLACK
+#define NO_TIMES
+#define NO_USE_SIGACTION
+#define NO_WRITEV
+#define USE_LONGJMP
+/*#define USE_SHMGET_SCOREBOARD*/
+#define USE_TPF_ACCEPT
+#define USE_TPF_CORE_SERIALIZED_ACCEPT
+/*#define USE_TPF_DAEMON*/
+#define USE_TPF_SCOREBOARD
+#define USE_TPF_SELECT
+#undef  offsetof
+#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
+
+#elif defined(__TANDEM)
+#define NO_WRITEV
+#define NO_KILLPG
+#define NEED_INITGROUPS
+#define NO_SLACK
+
+#else
+/* Unknown system - Edit these to match */
+#ifdef BSD
+#define HAVE_GMTOFF 1
+#else
+#undef HAVE_GMTOFF
+#endif
+/* NO_KILLPG is set on systems that don't have killpg */
+#undef NO_KILLPG
+/* NO_SETSID is set on systems that don't have setsid */
+#undef NO_SETSID
+/* NEED_STRDUP is set on stupid systems that don't have strdup. */
+#undef NEED_STRDUP
+#endif
+
+/* stuff marked API_EXPORT is part of the API, and intended for use
+ * by modules
+ */
+#ifndef API_EXPORT
+#define API_EXPORT(type)    type
+#endif
+
+/* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
+ * use by modules.  The difference between API_EXPORT and
+ * API_EXPORT_NONSTD is that the latter is required for any functions
+ * which use varargs or are used via indirect function call.  This
+ * is to accomodate the two calling conventions in windows dlls.
+ */
+#ifndef API_EXPORT_NONSTD
+#define API_EXPORT_NONSTD(type)    type
+#endif
+
+#ifndef MODULE_VAR_EXPORT
+#define MODULE_VAR_EXPORT
+#endif
+#ifndef API_VAR_EXPORT
+#define API_VAR_EXPORT
+#endif
+
+/* modules should not used functions marked CORE_EXPORT
+ * or CORE_EXPORT_NONSTD */
+#ifndef CORE_EXPORT
+#define CORE_EXPORT    API_EXPORT
+#endif
+#ifndef CORE_EXPORT_NONSTD
+#define CORE_EXPORT_NONSTD     API_EXPORT_NONSTD
+#endif
+
+/* On Mac OS X Server, symbols that conflict with loaded dylibs
+ * (eg. System framework) need to be declared as private symbols with
+ * __private_extern__.
+ * For other systems, make that a no-op.
+ */
+#if (defined(MAC_OS) || defined(MAC_OS_X_SERVER)) && defined(__DYNAMIC__)
+#define ap_private_extern __private_extern__
+#else
+#define ap_private_extern
+#endif
+
+/*
+ * The particular directory style your system supports. If you have dirent.h
+ * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
+ * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
+ * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
+ * file. If you have neither, I'm confused.
+ */
+
+#include <sys/types.h>
+#include <stdarg.h>
+
+#if !defined(NEXT) && !defined(WIN32)
+#include <dirent.h>
+#define DIR_TYPE dirent
+#elif !defined(WIN32)
+#include <sys/dir.h>
+#define DIR_TYPE direct
+#else
+#define DIR_TYPE dirent
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef __TANDEM
+#include <strings.h>
+#endif
+#include "ap_ctype.h"
+#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM)
+#include <sys/file.h>
+#endif
+#ifndef WIN32
+#include <sys/socket.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif /* HAVE_SYS_SELECT_H */
+#ifndef TPF
+#include <netinet/in.h>
+#endif /* TPF */
+#include <netdb.h>
+#include <sys/ioctl.h>
+#if !defined(MPE) && !defined(BEOS) && !defined(TPF)
+#include <arpa/inet.h>         /* for inet_ntoa */
+#endif
+#include <sys/wait.h>
+#include <pwd.h>
+#include <grp.h>
+#include <fcntl.h>
+#define closesocket(s) close(s)
+#ifndef O_BINARY
+#define O_BINARY (0)
+#endif
+
+#else /* WIN32 */
+#include <winsock2.h>
+#include <malloc.h>
+#include <io.h>
+#include <fcntl.h>
+#endif /* ndef WIN32 */
+#include <limits.h>
+#include <time.h>              /* for ctime */
+#ifdef WIN32
+#define strftime(s,max,format,tm)  os_strftime(s,max,format,tm)
+#endif
+#include <signal.h>
+#if defined(TPF) && defined(NSIG)
+#undef NSIG
+#endif
+#include <errno.h>
+#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF)
+#include <memory.h>
+#endif
+
+#ifdef NEED_PROCESS_H
+#include <process.h>
+#endif
+
+#ifdef WIN32
+#include "../include/hsregex.h"
+#elif defined(USE_HSREGEX)
+#include "hsregex.h"
+#else
+#include <regex.h>
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#ifdef SUNOS4
+int getrlimit(int, struct rlimit *);
+int setrlimit(int, struct rlimit *);
+#endif
+#endif
+#ifdef USE_MMAP_SCOREBOARD
+#if !defined(OS2) && !defined(WIN32)
+/* This file is not needed for OS/2 */
+#include <sys/mman.h>
+#endif
+#endif
+#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+
+#if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
+#undef USE_MMAP_FILES
+#endif
+
+#if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
+#undef USE_MMAP_SCOREBOARD
+#endif
+
+#if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
+#undef USE_SHMGET_SCOREBOARD
+#endif
+
+#ifndef LOGNAME_MAX
+#define LOGNAME_MAX 25
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef ultrix
+#define ULTRIX_BRAIN_DEATH
+#endif
+
+#ifndef S_ISLNK
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif
+
+#ifndef INADDR_NONE
+#define INADDR_NONE ((unsigned long) -1)
+#endif
+
+/*
+ * Replace signal function with sigaction equivalent
+ */
+#ifndef NO_USE_SIGACTION
+typedef void Sigfunc(int);
+
+#if defined(SIG_IGN) && !defined(SIG_ERR)
+#define SIG_ERR ((Sigfunc *)-1)
+#endif
+
+/*
+ * For some strange reason, QNX defines signal to signal. Eliminate it.
+ */
+#ifdef signal
+#undef signal
+#endif
+#define signal(s,f)    ap_signal(s,f)
+Sigfunc *signal(int signo, Sigfunc * func);
+#endif
+
+#include <setjmp.h>
+
+#if defined(USE_LONGJMP)
+#define ap_longjmp(x, y)        longjmp((x), (y))
+#define ap_setjmp(x)            setjmp(x)
+#ifndef JMP_BUF
+#define JMP_BUF jmp_buf
+#endif
+#else
+#define ap_longjmp(x, y)        siglongjmp((x), (y))
+#define ap_setjmp(x)            sigsetjmp((x), 1)
+#ifndef JMP_BUF
+#define JMP_BUF sigjmp_buf
+#endif
+#endif
+
+/* Majority of os's want to verify FD_SETSIZE */
+#if !defined(WIN32) && !defined(TPF)
+#define CHECK_FD_SETSIZE
+#endif
+
+#ifdef USE_TPF_SELECT
+#define ap_select(_a, _b, _c, _d, _e)  \
+       tpf_select(_a, _b, _c, _d, _e)
+#elif defined(SELECT_NEEDS_CAST)
+#define ap_select(_a, _b, _c, _d, _e)   \
+    select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
+#else
+#define ap_select(_a, _b, _c, _d, _e)   \
+       select(_a, _b, _c, _d, _e)
+#endif
+
+#ifdef USE_TPF_ACCEPT
+#define ap_accept(_fd, _sa, _ln)       tpf_accept(_fd, _sa, _ln)
+#else
+#define ap_accept(_fd, _sa, _ln)       accept(_fd, _sa, _ln)
+#endif
+
+#ifdef NEED_SIGNAL_INTERRUPT
+#define ap_check_signals()     tpf_process_signals()
+#else
+#define ap_check_signals()
+#endif
+
+#ifdef ULTRIX_BRAIN_DEATH
+#define ap_fdopen(d,m) fdopen((d), (char *)(m))
+#else
+#define ap_fdopen(d,m) fdopen((d), (m))
+#endif
+
+#ifndef ap_inet_addr
+#define ap_inet_addr inet_addr
+#endif
+
+#ifdef NO_OTHER_CHILD
+#define NO_RELIABLE_PIPED_LOGS
+#endif
+
+/* When the underlying OS doesn't support exec() of scripts which start
+ * with a HASHBANG (#!) followed by interpreter name and args, define this.
+ */
+#ifdef NEED_HASHBANG_EMUL
+extern int ap_execle(const char *filename, const char *arg,...);
+extern int ap_execve(const char *filename, const char *argv[],
+                     const char *envp[]);
+/* ap_execle() is a wrapper function around ap_execve(). */
+#define execle  ap_execle
+#define execve(path,argv,envp)  ap_execve(path,argv,envp)
+#endif
+
+/* Finding offsets of elements within structures.
+ * Taken from the X code... they've sweated portability of this stuff
+ * so we don't have to.  Sigh...
+ */
+
+#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
+#ifdef __STDC__
+#define XtOffset(p_type,field) _Offsetof(p_type,field)
+#else
+#ifdef CRAY2
+#define XtOffset(p_type,field) \
+       (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
+
+#else /* !CRAY2 */
+
+#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
+
+#endif /* !CRAY2 */
+#endif /* __STDC__ */
+#else /* ! (CRAY || __arm) */
+
+#define XtOffset(p_type,field) \
+       ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+
+#endif /* !CRAY */
+
+#ifdef offsetof
+#define XtOffsetOf(s_type,field) offsetof(s_type,field)
+#else
+#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
+#endif
+
+/*
+ * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
+ * systems used "int *" as the parameter to accept(), getsockname(),
+ * getpeername() et al.  Consequently many unixes took an int * for that
+ * parameter.  The POSIX committee decided that "int" was just too generic and
+ * had to be replaced with size_t almost everywhere.  There's no problem with
+ * that when you're passing by value.  But when you're passing by reference
+ * this creates a gross source incompatibility with existing programs.  On
+ * 32-bit architectures it creates only a warning.  On 64-bit architectures it
+ * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
+ * "size_t *" is frequently a pointer to a 32-bit quantity.
+ *
+ * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
+ * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
+ * finally woke up and decided that it was wrong and created a new type
+ * socklen_t.  The only useful value for socklen_t is int, and that's how
+ * everyone who has a clue implements it.  It is almost always the case that
+ * NET_SIZE_T should be defined to be an int, unless the system being compiled
+ * for was created in the window of POSIX madness.
+ */
+#ifndef NET_SIZE_T
+#define NET_SIZE_T int
+#endif
+
+/* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
+ * is in use... we'd prefer to just use WCOREDUMP everywhere.
+ */
+#if defined(__WCOREDUMP) && !defined(WCOREDUMP)
+#define WCOREDUMP __WCOREDUMP
+#endif
+
+#ifdef SUNOS_LIB_PROTOTYPES
+/* Prototypes needed to get a clean compile with gcc -Wall.
+ * Believe it or not, these do have to be declared, at least on SunOS,
+ * because they aren't mentioned in the relevant system headers.
+ * Sun Quality Software.  Gotta love it.  This section is not 
+ * currently (13Nov97) used.
+ */
+
+int getopt(int, char **, char *);
+
+int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, int);
+int toupper(int);
+int tolower(int);
+
+int printf(char *,...);
+int fprintf(FILE *, char *,...);
+int fputs(char *, FILE *);
+int fread(char *, int, int, FILE *);
+int fwrite(char *, int, int, FILE *);
+int fgetc(FILE *);
+char *fgets(char *s, int, FILE*);
+int fflush(FILE *);
+int fclose(FILE *);
+int ungetc(int, FILE *);
+int _filbuf(FILE *);   /* !!! */
+int _flsbuf(unsigned char, FILE *);    /* !!! */
+int sscanf(char *, char *,...);
+void setbuf(FILE *, char *);
+void perror(char *);
+
+time_t time(time_t *);
+int strftime(char *, int, const char *, struct tm *);
+
+int initgroups(char *, int);
+int wait3(int *, int, void *); /* Close enough for us... */
+int lstat(const char *, struct stat *);
+int stat(const char *, struct stat *);
+int flock(int, int);
+#ifndef NO_KILLPG
+int killpg(int, int);
+#endif
+int socket(int, int, int);
+int setsockopt(int, int, int, const char *, int);
+int listen(int, int);
+int bind(int, struct sockaddr *, int);
+int connect(int, struct sockaddr *, int);
+int accept(int, struct sockaddr *, int *);
+int shutdown(int, int);
+
+int getsockname(int s, struct sockaddr *name, int *namelen);
+int getpeername(int s, struct sockaddr *name, int *namelen);
+int gethostname(char *name, int namelen);
+void syslog(int, char *,...);
+char *mktemp(char *);
+
+long vfprintf(FILE *, const char *, va_list);
+
+#endif /* SUNOS_LIB_PROTOTYPES */
+
+/* The assumption is that when the functions are missing,
+ * then there's no matching prototype available either.
+ * Declare what is needed exactly as the replacement routines implement it.
+ */
+#ifdef NEED_STRDUP
+extern char *strdup (const char *str);
+#endif
+#ifdef NEED_STRCASECMP
+extern int strcasecmp (const char *a, const char *b);
+#endif
+#ifdef NEED_STRNCASECMP
+extern int strncasecmp (const char *a, const char *b, int n);
+#endif
+#ifdef NEED_INITGROUPS
+extern int initgroups(const char *name, gid_t basegid);
+#endif
+#ifdef NEED_WAITPID
+extern int waitpid(pid_t pid, int *statusp, int options);
+#endif
+#ifdef NEED_STRERROR
+extern char *strerror (int err);
+#endif
+#ifdef NEED_DIFFTIME
+extern double difftime(time_t time1, time_t time0);
+#endif
+
+#ifndef ap_wait_t
+#define ap_wait_t int
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !AP_CONFIG_H */
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
new file mode 100644 (file)
index 0000000..6f31383
--- /dev/null
@@ -0,0 +1,256 @@
+/* ====================================================================
+ * Copyright (c) 1998-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_AP_MMN_H
+#define APACHE_AP_MMN_H
+
+/*
+ * MODULE_MAGIC_NUMBER_MAJOR
+ * Major API changes that could cause compatibility problems for older modules
+ * such as structure size changes.  No binary compatibility is possible across
+ * a change in the major version.
+ *
+ * MODULE_MAGIC_NUMBER_MINOR
+ * Minor API changes that do not cause binary compatibility problems.
+ * Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
+ *
+ * See the MODULE_MAGIC_AT_LEAST macro below for an example.
+ */
+
+/*
+ * 19950525            - original value
+ * 19960512 (1.1b2)    - updated, 1.1, version.
+ * 19960526 (1.1b3)    - get_token(), table_unset(), pstrndup()
+ *                       functions added
+ * 19960725 (1.2-dev)  - HTTP/1.1 compliance
+ *                       (new version of read_client_block)
+ * 19960806 (1.2-dev)  - scan_script_header_err() added
+ * 19961007 (1.2-dev)  - replace read_client_block() with get_client_block()
+ * 19961125 (1.2b1)    - change setup_client_block() to Roy's version
+ * 19961211 (1.2b3)    - rwrite() added
+ * 19970103 (1.2b5-dev)        - header parse API
+ * 19970427 (1.2b9-dev)        - port references made unsigned
+ * 19970526 (1.2)      - correct vhost walk for multiple requests on a single
+ *                       connect
+ * 19970623 (1.3-dev)  - NT changes
+ * 19970628 (1.3-dev)  - ap_slack (fd fixes) added
+ * 19970717 (1.3-dev)  - child_init API hook added
+ * 19970719 (1.3-dev)  - discard_request_body() added (to clear the decks
+ *                       as needed)
+ * 19970728 (1.3a2-dev)        - child_exit API hook added
+ * 19970818 (1.3a2-dev)        - post read-request phase added
+ * 19970825 (1.3a2-dev)        - r->mtime cell added
+ * 19970831 (1.3a2-dev)        - error logging changed to use aplog_error()
+ * 19970902 (1.3a2-dev)        - MD5 routines and structures renamed to ap_*
+ * 19970912 (1.3b1-dev)        - set_last_modified split into set_last_modified,
+ *                       set_etag and meets_conditions
+ *                       register_other_child API
+ *                       piped_log API
+ *                       short_score split into parent and child pieces
+ *                       os_is_absolute_path
+ * 19971026 (1.3b3-dev)        - custom config hooks in place
+ * 19980126 (1.3b4-dev)        - ap_cpystrn(), table_addn(), table_setn(),
+ *                       table_mergen()
+ * 19980201 (1.3b4-dev)        - construct_url()
+ *                       prototype server_rec * -> request_rec *
+ *                       add get_server_name() and get_server_port()
+ * 19980207 (1.3b4-dev)        - add dynamic_load_handle to module structure as part
+ *                       of the STANDARD_MODULE_STUFF header
+ * 19980304 (1.3b6-dev)        - abstraction of SERVER_BUILT and SERVER_VERSION
+ * 19980305 (1.3b6-dev)        - ap_config.h added for use by external modules
+ * 19980312 (1.3b6-dev)        - parse_uri_components() and its ilk
+ *                       remove r->hostlen, add r->unparsed_uri
+ *                       set_string_slot_lower()
+ *                       clarification: non-RAW_ARGS cmd handlers do not
+ *                       need to pstrdup() their arguments
+ *                       clarification: request_rec members content_type,
+ *                       handler, content_encoding, content_language,
+ *                       content_languages MUST all be lowercase strings,
+ *                       and MAY NOT be modified in place -- modifications
+ *                       require pstrdup().
+ * 19980317 (1.3b6-dev)        - CORE_EXPORTs for win32 and <Perl>
+ *                       API export basic_http_header, send_header_field,
+ *                       set_keepalive, srm_command_loop, check_cmd_context,
+ *                       tm2sec
+ *                       spacetoplus(), plustospace(), client_to_stdout()
+ *                       removed
+ * 19980324 (1.3b6-dev)        - API_EXPORT(index_of_response)
+ * 19980413 (1.3b6-dev)        - The BIG SYMBOL RENAMING: general ap_ prefix
+ *                       (see src/include/compat.h for more details)
+ *                       ap_vformatter() API, see src/include/ap.h
+ * 19980507 (1.3b7-dev)        - addition of ap_add_version_component() and
+ *                       discontinuation of -DSERVER_SUBVERSION support
+ * 19980519 (1.3b7-dev)        - add child_info * to spawn function (as passed to
+ *                       ap_spawn_child_err_buff) and to ap_call_exec to make
+ *                       children work correctly on Win32.
+ * 19980527 (1.3b8-dev)        - renamed some more functions to ap_ prefix which were
+ *                       missed at the big renaming (they are defines):
+ *                       is_default_port, default_port and http_method.
+ *                       A new communication method for modules was added:
+ *                       they can create customized error messages under the
+ *                       "error-notes" key in the request_rec->notes table.
+ *                       This string will be printed in place of the canned
+ *                       error responses, and will be propagated to
+ *                       ErrorDocuments or cgi scripts in the
+ *                       (REDIRECT_)ERROR_NOTES variable.
+ * 19980627 (1.3.1-dev)        - More renaming that we forgot/bypassed. In particular:
+ *                       table_elts --> ap_table_elts
+ *                       is_table_empty --> ap_is_table_empty
+ * 19980708 (1.3.1-dev)        - ap_isalnum(), ap_isalpha(), ... "8-bit safe" ctype
+ *                       macros and apctype.h added
+ * 19980713 (1.3.1-dev)        - renaming of C header files:
+ *                       1. conf.h      -> ap_config.h
+ *                       2. conf_auto.h -> ap_config_auto.h - now merged
+ *                       3. ap_config.h -> ap_config_auto.h - now merged
+ *                       4. compat.h    -> ap_compat.h
+ *                       5. apctype.h   -> ap_ctype.h
+ * 19980806 (1.3.2-dev) - add ap_log_rerror()
+ *                      - add ap_scan_script_header_err_core()
+ *                      - add ap_uuencode()
+ *                      - add ap_custom_response()
+ * 19980811 (1.3.2-dev)        - added limit_req_line, limit_req_fieldsize, and
+ *                       limit_req_fields to server_rec.
+ *                       added limit_req_body to core_dir_config and
+ *                       ap_get_limit_req_body() to get its value.
+ * 19980812 (1.3.2-dev)        - split off MODULE_MAGIC_NUMBER
+ * 19980812.2           - add ap_overlap_tables()
+ * 19980816 (1.3.2-dev)        - change proxy to use tables for headers, change
+ *                        struct cache_req to typedef cache_req.
+ *                        Delete ap_proxy_get_header(), ap_proxy_add_header(),
+ *                        ap_proxy_del_header(). Change interface of 
+ *                        ap_proxy_send_fb() and ap_proxy_cache_error(). 
+ *                        Add ap_proxy_send_hdr_line() and ap_proxy_bputs2().
+ * 19980825 (1.3.2-dev) - renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx()
+ * 19980825.1           - mod_proxy only (minor change): modified interface of
+ *                        ap_proxy_read_headers() and rdcache() to use a
+ *                        request_rec* instead of pool*
+ *                        (for implementing better error reporting).
+ * 19980906 (1.3.2-dev) - added ap_md5_binary()
+ * 19980917 (1.3.2-dev) - bs2000: changed os_set_authfile() to os_set_account()
+ * 19981108 (1.3.4-dev) - added ap_method_number_of()
+ *                      - changed value of M_INVALID and added WebDAV methods
+ * 19981108.1           - ap_exists_config_define() is now public (minor bump)
+ * 19981204             - scoreboard changes -- added generation, changed
+ *                        exit_generation to running_generation.  Somewhere
+ *                        earlier vhostrec was added, but it's only safe to use
+ *                        as of this rev.  See scoreboard.h for documentation.
+ * 19981211             - DSO changes -- added ap_single_module_configure()
+ *                                    -- added ap_single_module_init()
+ * 19981229             - mod_negotiation overhaul -- added ap_make_etag()
+ *                        and added vlist_validator to request_rec.
+ * 19990101             - renamed macro escape_uri() to ap_escape_uri()
+ *                      - added MODULE_MAGIC_COOKIE to identify module structs
+ * 19990103 (1.3.4-dev) - added ap_array_pstrcat()
+ * 19990105 (1.3.4-dev) - added ap_os_is_filename_valid()
+ * 19990106 (1.3.4-dev) - Move MODULE_MAGIC_COOKIE to the end of the
+ *                        STANDARD_MODULE_STUFF macro so the version
+ *                        numbers and file name remain at invariant offsets
+ * 19990108 (1.3.4-dev) - status_drops_connection -> ap_status_drops_connection
+ *                        scan_script_header -> ap_scan_script_header_err
+ *                      - reordered entries in request_rec that were waiting
+ *                        for a non-binary-compatible release.
+ *          (1.3.5-dev)
+ * 19990108.1           - add ap_MD5Encode() for MD5 password handling.
+ * 19990108.2           - add ap_validate_password() and change ap_MD5Encode()
+ *                        to use a stronger algorithm.
+ * 19990108.4           - add ap_size_list_item(), ap_get_list_item(), and
+ *                        ap_find_list_item()
+ * 19990108.5           - added ap_sub_req_method_uri() and added const to the
+ *                        definition of method in request_rec.
+ * 19990108.6           - SIGPIPE is now ignored by the core server.
+ * 19990108.7           - ap_isxdigit added
+ * 19990320             - METHODS and M_INVALID symbol values modified
+ * 19990320.1           - add ap_vrprintf()
+ * 19990320.2           - add cmd_parms.context, ap_set_config_vectors, 
+ *                        export ap_add_file_conf
+ * 19990320.3           - add ap_regexec() and ap_regerror()
+ * 19990320.4           - add ap_field_noparam()
+ * 19990320.5           - add local_ip/host to conn_rec for mass-vhost
+ * 19990320.6           - add ap_SHA1Final(), ap_SHA1Init(),
+ *                        ap_SHA1Update_binary(), ap_SHA1Update(),
+ *                        ap_base64encode(), ap_base64encode_binary(),
+ *                        ap_base64encode_len(), ap_base64decode(),
+ *                        ap_base64decode_binary(), ap_base64decode_len(),
+ *                        ap_pbase64decode(), ap_pbase64encode()
+ */
+
+#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
+
+#ifndef MODULE_MAGIC_NUMBER_MAJOR
+#define MODULE_MAGIC_NUMBER_MAJOR 19990320
+#endif
+#define MODULE_MAGIC_NUMBER_MINOR 6                     /* 0...n */
+#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR  /* backward compat */
+
+/* Useful for testing for features. */
+#define MODULE_MAGIC_AT_LEAST(major,minor)             \
+    ((major) > MODULE_MAGIC_NUMBER_MAJOR               \
+       || ((major) == MODULE_MAGIC_NUMBER_MAJOR        \
+           && (minor) >= MODULE_MAGIC_NUMBER_MINOR))
+
+/* For example, suppose you wish to use the ap_overlap_tables
+   function.  You can do this:
+
+#if MODULE_MAGIC_AT_LEAST(19980812,2)
+    ... use ap_overlap_tables()
+#else
+    ... alternative code which doesn't use ap_overlap_tables()
+#endif
+
+*/
+
+#endif /* !APACHE_AP_MMN_H */
diff --git a/include/http_conf_globals.h b/include/http_conf_globals.h
new file mode 100644 (file)
index 0000000..3717330
--- /dev/null
@@ -0,0 +1,122 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_CONF_GLOBALS_H
+#define APACHE_HTTP_CONF_GLOBALS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 
+ * Process config --- what the process ITSELF is doing
+ */
+
+extern int ap_standalone;
+extern int ap_configtestonly;
+extern int ap_docrootcheck;
+extern uid_t ap_user_id;
+extern char *ap_user_name;
+extern gid_t ap_group_id;
+#ifdef MULTIPLE_GROUPS
+extern gid_t group_id_list[NGROUPS_MAX];
+#endif
+extern int ap_max_requests_per_child;
+extern int ap_threads_per_child;
+extern int ap_excess_requests_per_child;
+extern struct in_addr ap_bind_address;
+extern listen_rec *ap_listeners;
+extern int ap_daemons_to_start;
+extern int ap_daemons_min_free;
+extern int ap_daemons_max_free;
+extern int ap_daemons_limit;
+extern MODULE_VAR_EXPORT int ap_suexec_enabled;
+extern int ap_listenbacklog;
+extern int ap_dump_settings;
+extern API_VAR_EXPORT int ap_extended_status;
+
+extern char *ap_pid_fname;
+extern char *ap_scoreboard_fname;
+extern char *ap_lock_fname;
+extern MODULE_VAR_EXPORT char *ap_server_argv0;
+
+extern enum server_token_type ap_server_tokens;
+
+/* Trying to allocate these in the config pool gets us into some *nasty*
+ * chicken-and-egg problems in http_main.c --- where do you stick them
+ * when pconf gets cleared?  Better to just allocate a little space
+ * statically...
+ */
+
+extern API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN];
+extern char ap_server_confname[MAX_STRING_LEN];
+
+/* for -C, -c and -D switches */
+extern array_header *ap_server_pre_read_config;
+extern array_header *ap_server_post_read_config;
+extern array_header *ap_server_config_defines;
+
+/* We want this to have the least chance of being corrupted if there
+ * is some memory corruption, so we allocate it statically.
+ */
+extern char ap_coredump_dir[MAX_STRING_LEN];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_CONF_GLOBALS_H */
diff --git a/include/http_config.h b/include/http_config.h
new file mode 100644 (file)
index 0000000..e0c2930
--- /dev/null
@@ -0,0 +1,414 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_CONFIG_H
+#define APACHE_HTTP_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The central data structures around here...
+ */
+
+/* Command dispatch structures... */
+
+/* Note that for all of these except RAW_ARGS, the config routine is
+ * passed a freshly allocated string which can be modified or stored
+ * or whatever... it's only necessary to do pstrdup() stuff with
+ * RAW_ARGS.
+ */
+enum cmd_how {
+    RAW_ARGS,                  /* cmd_func parses command line itself */
+    TAKE1,                     /* one argument only */
+    TAKE2,                     /* two arguments only */
+    ITERATE,                   /* one argument, occuring multiple times
+                                * (e.g., IndexIgnore)
+                                */
+    ITERATE2,                  /* two arguments, 2nd occurs multiple times
+                                * (e.g., AddIcon)
+                                */
+    FLAG,                      /* One of 'On' or 'Off' */
+    NO_ARGS,                   /* No args at all, e.g. </Directory> */
+    TAKE12,                    /* one or two arguments */
+    TAKE3,                     /* three arguments only */
+    TAKE23,                    /* two or three arguments */
+    TAKE123,                   /* one, two or three arguments */
+    TAKE13                     /* one or three arguments */
+};
+
+typedef struct command_struct {
+    const char *name;          /* Name of this command */
+    const char *(*func) ();    /* Function invoked */
+    void *cmd_data;            /* Extra data, for functions which
+                                * implement multiple commands...
+                                */
+    int req_override;          /* What overrides need to be allowed to
+                                * enable this command.
+                                */
+    enum cmd_how args_how;     /* What the command expects as arguments */
+
+    const char *errmsg;                /* 'usage' message, in case of syntax errors */
+} command_rec;
+
+/* The allowed locations for a configuration directive are the union of
+ * those indicated by each set bit in the req_override mask.
+ *
+ * (req_override & RSRC_CONF)   => *.conf outside <Directory> or <Location>
+ * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
+ * (req_override & OR_AUTHCFG)  => *.conf inside <Directory> or <Location>
+ *                                 and .htaccess when AllowOverride AuthConfig
+ * (req_override & OR_LIMIT)    => *.conf inside <Directory> or <Location>
+ *                                 and .htaccess when AllowOverride Limit
+ * (req_override & OR_OPTIONS)  => *.conf anywhere
+ *                                 and .htaccess when AllowOverride Options
+ * (req_override & OR_FILEINFO) => *.conf anywhere
+ *                                 and .htaccess when AllowOverride FileInfo
+ * (req_override & OR_INDEXES)  => *.conf anywhere
+ *                                 and .htaccess when AllowOverride Indexes
+ */
+#define OR_NONE 0
+#define OR_LIMIT 1
+#define OR_OPTIONS 2
+#define OR_FILEINFO 4
+#define OR_AUTHCFG 8
+#define OR_INDEXES 16
+#define OR_UNSET 32
+#define ACCESS_CONF 64
+#define RSRC_CONF 128
+#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
+
+/* This can be returned by a function if they don't wish to handle
+ * a command. Make it something not likely someone will actually use
+ * as an error code.
+ */
+
+#define DECLINE_CMD "\a\b"
+
+/*
+ * This structure is passed to a command which is being invoked,
+ * to carry a large variety of miscellaneous data which is all of
+ * use to *somebody*...
+ */
+
+typedef struct {
+    void *info;                        /* Argument to command from cmd_table */
+    int override;              /* Which allow-override bits are set */
+    int limited;               /* Which methods are <Limit>ed */
+
+    configfile_t *config_file; /* Config file structure from pcfg_openfile() */
+
+    ap_pool *pool;                     /* Pool to allocate new storage in */
+    struct pool *temp_pool;            /* Pool for scratch memory; persists during
+                                * configuration, but wiped before the first
+                                * request is served...
+                                */
+    server_rec *server;                /* Server_rec being configured for */
+    char *path;                        /* If configuring for a directory,
+                                * pathname of that directory.
+                                * NOPE!  That's what it meant previous to the
+                                * existance of <Files>, <Location> and regex
+                                * matching.  Now the only usefulness that can
+                                * be derived from this field is whether a command
+                                * is being called in a server context (path == NULL)
+                                * or being called in a dir context (path != NULL).
+                                */
+    const command_rec *cmd;    /* configuration command */
+    const char *end_token;     /* end token required to end a nested section */
+    void *context;             /* per_dir_config vector passed 
+                                * to handle_command */
+} cmd_parms;
+
+/* This structure records the existence of handlers in a module... */
+
+typedef struct {
+    const char *content_type;  /* MUST be all lower case */
+    int (*handler) (request_rec *);
+} handler_rec;
+
+/*
+ * Module structures.  Just about everything is dispatched through
+ * these, directly or indirectly (through the command and handler
+ * tables).
+ */
+
+typedef struct module_struct {
+    int version;               /* API version, *not* module version;
+                                * check that module is compatible with this
+                                * version of the server.
+                                */
+    int minor_version;          /* API minor version. Provides API feature
+                                 * milestones. Not checked during module init
+                                */
+    int module_index;          /* Index to this modules structures in
+                                * config vectors.
+                                */
+
+    const char *name;
+    void *dynamic_load_handle;
+
+    struct module_struct *next;
+
+    unsigned long magic;        /* Magic Cookie to identify a module structure;
+                                 * It's mainly important for the DSO facility
+                                 * (see also mod_so).
+                                 */
+
+    /* init() occurs after config parsing, but before any children are
+     * forked.
+     * Modules should not rely on the order in which create_server_config
+     * and create_dir_config are called.
+     */
+#ifdef ULTRIX_BRAIN_DEATH
+    void (*init) ();
+    void *(*create_dir_config) ();
+    void *(*merge_dir_config) ();
+    void *(*create_server_config) ();
+    void *(*merge_server_config) ();
+#else
+    void (*init) (server_rec *, pool *);
+    void *(*create_dir_config) (pool *p, char *dir);
+    void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf);
+    void *(*create_server_config) (pool *p, server_rec *s);
+    void *(*merge_server_config) (pool *p, void *base_conf, void *new_conf);
+#endif
+
+    const command_rec *cmds;
+    const handler_rec *handlers;
+
+    /* Hooks for getting into the middle of server ops...
+
+     * translate_handler --- translate URI to filename
+     * access_checker --- check access by host address, etc.   All of these
+     *                    run; if all decline, that's still OK.
+     * check_user_id --- get and validate user id from the HTTP request
+     * auth_checker --- see if the user (from check_user_id) is OK *here*.
+     *                  If all of *these* decline, the request is rejected
+     *                  (as a SERVER_ERROR, since the module which was
+     *                  supposed to handle this was configured wrong).
+     * type_checker --- Determine MIME type of the requested entity;
+     *                  sets content_type, _encoding and _language fields.
+     * logger --- log a transaction.
+     * post_read_request --- run right after read_request or internal_redirect,
+     *                  and not run during any subrequests.
+     */
+
+    int (*translate_handler) (request_rec *);
+    int (*ap_check_user_id) (request_rec *);
+    int (*auth_checker) (request_rec *);
+    int (*access_checker) (request_rec *);
+    int (*type_checker) (request_rec *);
+    int (*fixer_upper) (request_rec *);
+    int (*logger) (request_rec *);
+    int (*header_parser) (request_rec *);
+
+    /* Regardless of the model the server uses for managing "units of
+     * execution", i.e. multi-process, multi-threaded, hybrids of those,
+     * there is the concept of a "heavy weight process".  That is, a
+     * process with its own memory space, file spaces, etc.  This method,
+     * child_init, is called once for each heavy-weight process before
+     * any requests are served.  Note that no provision is made yet for
+     * initialization per light-weight process (i.e. thread).  The
+     * parameters passed here are the same as those passed to the global
+     * init method above.
+     */
+#ifdef ULTRIX_BRAIN_DEATH
+    void (*child_init) ();
+    void (*child_exit) ();
+#else
+    void (*child_init) (server_rec *, pool *);
+    void (*child_exit) (server_rec *, pool *);
+#endif
+    int (*post_read_request) (request_rec *);
+} module;
+
+/* Initializer for the first few module slots, which are only
+ * really set up once we start running.  Note that the first two slots
+ * provide a version check; this should allow us to deal with changes to
+ * the API. The major number should reflect changes to the API handler table
+ * itself or removal of functionality. The minor number should reflect
+ * additions of functionality to the existing API. (the server can detect
+ * an old-format module, and either handle it back-compatibly, or at least
+ * signal an error). See src/include/ap_mmn.h for MMN version history.
+ */
+
+#define STANDARD_MODULE_STUFF  MODULE_MAGIC_NUMBER_MAJOR, \
+                               MODULE_MAGIC_NUMBER_MINOR, \
+                               -1, \
+                               __FILE__, \
+                               NULL, \
+                               NULL, \
+                               MODULE_MAGIC_COOKIE
+
+/* Generic accessors for other modules to get at their own module-specific
+ * data
+ */
+
+API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m);
+API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val);
+
+#define ap_get_module_config(v,m)      \
+    (((void **)(v))[(m)->module_index])
+#define ap_set_module_config(v,m,val)  \
+    ((((void **)(v))[(m)->module_index]) = (val))
+
+/* Generic command handling function... */
+
+API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *);
+API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *);
+API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int);
+API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);
+
+/* For modules which need to read config files, open logs, etc. ...
+ * this returns the fname argument if it begins with '/'; otherwise
+ * it relativizes it wrt server_root.
+ */
+
+API_EXPORT(char *) ap_server_root_relative(pool *p, char *fname);
+
+/* Finally, the hook for dynamically loading modules in... */
+
+API_EXPORT(void) ap_add_module(module *m);
+API_EXPORT(void) ap_remove_module(module *m);
+API_EXPORT(void) ap_add_loaded_module(module *mod);
+API_EXPORT(void) ap_remove_loaded_module(module *mod);
+API_EXPORT(int) ap_add_named_module(const char *name);
+API_EXPORT(void) ap_clear_module_list(void);
+API_EXPORT(const char *) ap_find_module_name(module *m);
+API_EXPORT(module *) ap_find_linked_module(const char *name);
+
+/* for implementing subconfigs and customized config files */
+API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config);
+
+#ifdef CORE_PRIVATE
+
+extern API_VAR_EXPORT module *top_module;
+
+extern module *ap_prelinked_modules[];
+extern module *ap_preloaded_modules[];
+extern API_VAR_EXPORT module **ap_loaded_modules;
+
+/* For mod_so.c... */
+
+void ap_single_module_configure(pool *p, server_rec *s, module *m);
+
+/* For http_main.c... */
+
+server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
+void ap_init_modules(pool *p, server_rec *s);
+void ap_child_init_modules(pool *p, server_rec *s);
+void ap_child_exit_modules(pool *p, server_rec *s);
+void ap_setup_prelinked_modules(void);
+void ap_show_directives(void);
+void ap_show_modules(void);
+
+/* For http_request.c... */
+
+void *ap_create_request_config(pool *p);
+CORE_EXPORT(void *) ap_create_per_dir_config(pool *p);
+void *ap_merge_per_dir_configs(pool *p, void *base, void *new);
+
+/* For http_core.c... (<Directory> command and virtual hosts) */
+
+int ap_parse_htaccess(void **result, request_rec *r, int override,
+               const char *path, const char *access_name);
+
+CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname,
+                               server_rec *main_server, server_rec **);
+void ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp);
+
+/* ap_check_cmd_context() definitions: */
+API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
+
+/* ap_check_cmd_context():              Forbidden in: */
+#define  NOT_IN_VIRTUALHOST     0x01 /* <Virtualhost> */
+#define  NOT_IN_LIMIT           0x02 /* <Limit> */
+#define  NOT_IN_DIRECTORY       0x04 /* <Directory> */
+#define  NOT_IN_LOCATION        0x08 /* <Location> */
+#define  NOT_IN_FILES           0x10 /* <Files> */
+#define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
+#define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
+
+
+/* Module-method dispatchers, also for http_request.c */
+
+int ap_translate_name(request_rec *);
+int ap_check_access(request_rec *);    /* check access on non-auth basis */
+int ap_check_user_id(request_rec *);   /* obtain valid username from client auth */
+int ap_check_auth(request_rec *);      /* check (validated) user is authorized here */
+int ap_find_types(request_rec *);      /* identify MIME type */
+int ap_run_fixups(request_rec *);      /* poke around for other metainfo, etc.... */
+int ap_invoke_handler(request_rec *);
+int ap_log_transaction(request_rec *r);
+int ap_header_parse(request_rec *);
+int ap_run_post_read_request(request_rec *);
+
+/* for mod_perl */
+
+CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
+CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
+CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
+CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_CONFIG_H */
diff --git a/include/http_core.h b/include/http_core.h
new file mode 100644 (file)
index 0000000..459fd24
--- /dev/null
@@ -0,0 +1,310 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_CORE_H
+#define APACHE_HTTP_CORE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************
+ *
+ * The most basic server code is encapsulated in a single module
+ * known as the core, which is just *barely* functional enough to
+ * serve documents, though not terribly well.
+ *
+ * Largely for NCSA back-compatibility reasons, the core needs to
+ * make pieces of its config structures available to other modules.
+ * The accessors are declared here, along with the interpretation
+ * of one of them (allow_options).
+ */
+
+#define OPT_NONE 0
+#define OPT_INDEXES 1
+#define OPT_INCLUDES 2
+#define OPT_SYM_LINKS 4
+#define OPT_EXECCGI 8
+#define OPT_UNSET 16
+#define OPT_INCNOEXEC 32
+#define OPT_SYM_OWNER 64
+#define OPT_MULTI 128
+#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
+
+/* options for get_remote_host() */
+/* REMOTE_HOST returns the hostname, or NULL if the hostname
+ * lookup fails.  It will force a DNS lookup according to the
+ * HostnameLookups setting.
+ */
+#define REMOTE_HOST (0)
+
+/* REMOTE_NAME returns the hostname, or the dotted quad if the
+ * hostname lookup fails.  It will force a DNS lookup according
+ * to the HostnameLookups setting.
+ */
+#define REMOTE_NAME (1)
+
+/* REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
+ * never forced.
+ */
+#define REMOTE_NOLOOKUP (2)
+
+/* REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
+ * a double reverse lookup, regardless of the HostnameLookups
+ * setting.  The result is the (double reverse checked) hostname,
+ * or NULL if any of the lookups fail.
+ */
+#define REMOTE_DOUBLE_REV (3)
+
+#define SATISFY_ALL 0
+#define SATISFY_ANY 1
+#define SATISFY_NOSPEC 2
+
+API_EXPORT(int) ap_allow_options (request_rec *);
+API_EXPORT(int) ap_allow_overrides (request_rec *);
+API_EXPORT(const char *) ap_default_type (request_rec *);     
+API_EXPORT(const char *) ap_document_root (request_rec *); /* Don't use this!  If your request went
+                                     * through a Userdir, or something like
+                                     * that, it'll screw you.  But it's
+                                     * back-compatible...
+                                     */
+API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type);
+API_EXPORT(const char *) ap_get_remote_logname(request_rec *r);
+
+/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
+ * and SERVER_NAME.
+ */
+API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r);
+API_EXPORT(const char *) ap_get_server_name(request_rec *r);
+API_EXPORT(unsigned) ap_get_server_port(const request_rec *r);
+API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r);
+API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string);
+API_EXPORT(int) ap_exists_config_define(char *name);
+
+/* Authentication stuff.  This is one of the places where compatibility
+ * with the old config files *really* hurts; they don't discriminate at
+ * all between different authentication schemes, meaning that we need
+ * to maintain common state for all of them in the core, and make it
+ * available to the other modules through interfaces.
+ */
+    
+typedef struct {
+    int method_mask;
+    char *requirement;
+} require_line;
+     
+API_EXPORT(const char *) ap_auth_type (request_rec *);
+API_EXPORT(const char *) ap_auth_name (request_rec *);     
+API_EXPORT(int) ap_satisfies (request_rec *r);
+API_EXPORT(const array_header *) ap_requires (request_rec *);    
+
+#ifdef WIN32
+/* 
+ * CGI Script stuff for Win32...
+ */
+typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, 
+               eFileTypeSCRIPT } file_type_e;
+typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, 
+               INTERPRETER_SOURCE_SHEBANG } interpreter_source_e;
+API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **);
+#endif
+
+#ifdef CORE_PRIVATE
+
+/*
+ * Core is also unlike other modules in being implemented in more than
+ * one file... so, data structures are declared here, even though most of
+ * the code that cares really is in http_core.c.  Also, another accessor.
+ */
+
+char *ap_response_code_string (request_rec *r, int error_index);
+
+extern API_VAR_EXPORT module core_module;
+
+/* Per-directory configuration */
+
+typedef unsigned char allow_options_t;
+typedef unsigned char overrides_t;
+
+typedef struct {
+    /* path of the directory/regex/etc.  see also d_is_fnmatch below */
+    char *d;
+    /* the number of slashes in d */
+    unsigned d_components;
+
+    /* If (opts & OPT_UNSET) then no absolute assignment to options has
+     * been made.
+     * invariant: (opts_add & opts_remove) == 0
+     * Which said another way means that the last relative (options + or -)
+     * assignment made to each bit is recorded in exactly one of opts_add
+     * or opts_remove.
+     */
+    allow_options_t opts;
+    allow_options_t opts_add;
+    allow_options_t opts_remove;
+    overrides_t override;
+    
+    /* MIME typing --- the core doesn't do anything at all with this,
+     * but it does know what to slap on a request for a document which
+     * goes untyped by other mechanisms before it slips out the door...
+     */
+    
+    char *ap_default_type;
+  
+    /* Authentication stuff.  Groan... */
+    
+    int satisfy;
+    char *ap_auth_type;
+    char *ap_auth_name;
+    array_header *ap_requires;
+
+    /* Custom response config. These can contain text or a URL to redirect to.
+     * if response_code_strings is NULL then there are none in the config,
+     * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
+     * This lets us do quick merges in merge_core_dir_configs().
+     */
+  
+    char **response_code_strings;
+
+    /* Hostname resolution etc */
+#define HOSTNAME_LOOKUP_OFF    0
+#define HOSTNAME_LOOKUP_ON     1
+#define HOSTNAME_LOOKUP_DOUBLE 2
+#define HOSTNAME_LOOKUP_UNSET  3
+    unsigned int hostname_lookups : 4;
+
+    signed int do_rfc1413 : 2;   /* See if client is advertising a username? */
+
+    signed int content_md5 : 2;  /* calculate Content-MD5? */
+
+#define USE_CANONICAL_NAME_OFF   (0)
+#define USE_CANONICAL_NAME_ON    (1)
+#define USE_CANONICAL_NAME_DNS   (2)
+#define USE_CANONICAL_NAME_UNSET (3)
+    unsigned use_canonical_name : 2;
+
+    /* since is_fnmatch(conf->d) was being called so frequently in
+     * directory_walk() and its relatives, this field was created and
+     * is set to the result of that call.
+     */
+    unsigned d_is_fnmatch : 1;
+
+    /* System Resource Control */
+#ifdef RLIMIT_CPU
+    struct rlimit *limit_cpu;
+#endif
+#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
+    struct rlimit *limit_mem;
+#endif
+#ifdef RLIMIT_NPROC
+    struct rlimit *limit_nproc;
+#endif
+    unsigned long limit_req_body;  /* limit on bytes in request msg body */
+
+    /* logging options */
+    enum { srv_sig_unset, srv_sig_off, srv_sig_on,
+           srv_sig_withmail } server_signature;
+    int loglevel;
+    
+    /* Access control */
+    array_header *sec;
+    regex_t *r;
+
+#ifdef WIN32
+    /* Where to find interpreter to run scripts */
+    interpreter_source_e script_interpreter_source;
+#endif    
+    
+} core_dir_config;
+
+/* Per-server core configuration */
+
+typedef struct {
+  
+#ifdef GPROF
+    char *gprof_dir;
+#endif
+
+    /* Name translations --- we want the core to be able to do *something*
+     * so it's at least a minimally functional web server on its own (and
+     * can be tested that way).  But let's keep it to the bare minimum:
+     */
+    char *ap_document_root;
+  
+    /* Access control */
+
+    char *access_name;
+    array_header *sec;
+    array_header *sec_url;
+} core_server_config;
+
+/* for http_config.c */
+void ap_core_reorder_directories(pool *, server_rec *);
+
+/* for mod_perl */
+CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config);
+CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config);
+CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
+CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_CORE_H */
diff --git a/include/http_log.h b/include/http_log.h
new file mode 100644 (file)
index 0000000..d9162bd
--- /dev/null
@@ -0,0 +1,162 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_LOG_H
+#define APACHE_HTTP_LOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_SYSLOG
+#include <syslog.h>
+
+#define APLOG_EMERG     LOG_EMERG     /* system is unusable */
+#define APLOG_ALERT     LOG_ALERT     /* action must be taken immediately */
+#define APLOG_CRIT      LOG_CRIT      /* critical conditions */
+#define APLOG_ERR       LOG_ERR       /* error conditions */
+#define APLOG_WARNING   LOG_WARNING   /* warning conditions */
+#define APLOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
+#define APLOG_INFO      LOG_INFO      /* informational */
+#define APLOG_DEBUG     LOG_DEBUG     /* debug-level messages */
+
+#define APLOG_LEVELMASK LOG_PRIMASK   /* mask off the level value */
+
+#else
+
+#define        APLOG_EMERG     0       /* system is unusable */
+#define        APLOG_ALERT     1       /* action must be taken immediately */
+#define        APLOG_CRIT      2       /* critical conditions */
+#define        APLOG_ERR       3       /* error conditions */
+#define        APLOG_WARNING   4       /* warning conditions */
+#define        APLOG_NOTICE    5       /* normal but significant condition */
+#define        APLOG_INFO      6       /* informational */
+#define        APLOG_DEBUG     7       /* debug-level messages */
+
+#define        APLOG_LEVELMASK 7       /* mask off the level value */
+
+#endif
+
+#define APLOG_NOERRNO          (APLOG_LEVELMASK + 1)
+#ifdef WIN32
+/* Set to indicate that error msg should come from Win32's GetLastError(),
+ * not errno. */
+#define APLOG_WIN32ERROR       ((APLOG_LEVELMASK+1) * 2)
+#endif
+
+#ifndef DEFAULT_LOGLEVEL
+#define DEFAULT_LOGLEVEL       APLOG_WARNING
+#endif
+
+#define APLOG_MARK     __FILE__,__LINE__
+
+void ap_open_logs (server_rec *, pool *p);
+
+/* The two primary logging functions, ap_log_error and ap_log_rerror,
+ * use a printf style format string to build the log message.  It is
+ * VERY IMPORTANT that you not include any raw data from the network,
+ * such as the request-URI or request header fields, within the format
+ * string.  Doing so makes the server vulnerable to a denial-of-service
+ * attack and other messy behavior.  Instead, use a simple format string
+ * like "%s", followed by the string containing the untrusted data.
+ */
+API_EXPORT(void) ap_log_error(const char *file, int line, int level,
+                            const server_rec *s, const char *fmt, ...)
+                           __attribute__((format(printf,5,6)));
+API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
+                            const request_rec *s, const char *fmt, ...)
+                           __attribute__((format(printf,5,6)));
+API_EXPORT(void) ap_error_log2stderr (server_rec *);     
+
+void ap_log_pid (pool *p, char *fname);
+/* These are for legacy code, new code should use ap_log_error,
+ * or ap_log_rerror.
+ */
+API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
+API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
+                            const char *msg, server_rec *s);
+API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
+                           __attribute__((format(printf,2,3)));
+API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
+                           request_rec *r);
+
+typedef struct piped_log {
+    pool *p;
+#ifndef NO_RELIABLE_PIPED_LOGS
+    char *program;
+    int pid;
+    int fds[2];
+#else
+    FILE *write_f;
+#endif
+} piped_log;
+
+API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program);
+API_EXPORT(void) ap_close_piped_log (piped_log *);
+#ifndef NO_RELIABLE_PIPED_LOGS
+#define ap_piped_log_read_fd(pl)       ((pl)->fds[0])
+#define ap_piped_log_write_fd(pl)      ((pl)->fds[1])
+#else
+#define ap_piped_log_read_fd(pl)       (-1)
+#define ap_piped_log_write_fd(pl)      (fileno((pl)->write_f))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_LOG_H */
diff --git a/include/http_main.h b/include/http_main.h
new file mode 100644 (file)
index 0000000..a0d014d
--- /dev/null
@@ -0,0 +1,174 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_MAIN_H
+#define APACHE_HTTP_MAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Routines in http_main.c which other code --- in particular modules ---
+ * may want to call.  Right now, that's limited to timeout handling.
+ * There are two functions which modules can call to trigger a timeout
+ * (with the per-virtual-server timeout duration); these are hard_timeout
+ * and soft_timeout.
+ *
+ * The difference between the two is what happens when the timeout
+ * expires (or earlier than that, if the client connection aborts) ---
+ * a soft_timeout just puts the connection to the client in an
+ * "aborted" state, which will cause http_protocol.c to stop trying to
+ * talk to the client, but otherwise allows the code to continue normally.
+ * hard_timeout(), by contrast, logs the request, and then aborts it
+ * completely --- longjmp()ing out to the accept() loop in http_main.
+ * Any resources tied into the request's resource pool will be cleaned up;
+ * everything that isn't will leak.
+ *
+ * soft_timeout() is recommended as a general rule, because it gives your
+ * code a chance to clean up.  However, hard_timeout() may be the most
+ * convenient way of dealing with timeouts waiting for some external
+ * resource other than the client, if you can live with the restrictions.
+ *
+ * (When a hard timeout is in scope, critical sections can be guarded
+ * with block_alarms() and unblock_alarms() --- these are declared in
+ * alloc.c because they are most often used in conjunction with
+ * routines to allocate something or other, to make sure that the
+ * cleanup does get registered before any alarm is allowed to happen
+ * which might require it to be cleaned up; they * are, however,
+ * implemented in http_main.c).
+ *
+ * NOTE!  It's not "fair" for a hard_timeout to be in scope through calls
+ * across modules.  Your module code really has no idea what other modules may
+ * be present in the server, and they may not take too kindly to having a
+ * longjmp() happen -- it could result in corrupted state.  Heck they may not
+ * even take to kindly to a soft_timeout()... because it can cause EINTR to
+ * happen on pretty much any syscall, and unless all the libraries and modules
+ * in use are known to deal well with EINTR it could cause corruption as well.
+ * But things are likely to do much better with a soft_timeout in scope than a
+ * hard_timeout.
+ * 
+ * A module MAY NOT use a hard_timeout() across * sub_req_lookup_xxx()
+ * functions, or across run_sub_request() functions.  A module SHOULD NOT use a
+ * soft_timeout() in either of these cases, but sometimes there's just no
+ * choice.
+ *
+ * kill_timeout() will disarm either variety of timeout.
+ *
+ * reset_timeout() resets the timeout in progress.
+ */
+
+void ap_start_shutdown(void);
+void ap_start_restart(int);
+API_EXPORT(void) ap_hard_timeout(char *, request_rec *);
+void ap_keepalive_timeout(char *, request_rec *);
+API_EXPORT(void) ap_soft_timeout(char *, request_rec *);
+API_EXPORT(void) ap_kill_timeout(request_rec *);
+API_EXPORT(void) ap_reset_timeout(request_rec *);
+
+API_EXPORT(void) ap_child_terminate(request_rec *r);
+API_EXPORT(void) ap_sync_scoreboard_image(void);
+int ap_update_child_status(int child_num, int status, request_rec *r);
+void ap_time_process_request(int child_num, int status);
+unsigned int ap_set_callback_and_alarm(void (*fn) (int), int x);
+API_EXPORT(int) ap_check_alarm(void);
+
+#ifndef NO_OTHER_CHILD
+/*
+ * register an other_child -- a child which the main loop keeps track of
+ * and knows it is different than the rest of the scoreboard.
+ *
+ * pid is the pid of the child.
+ *
+ * maintenance is a function that is invoked with a reason, the data
+ * pointer passed here, and when appropriate a status result from waitpid().
+ *
+ * write_fd is an fd that is probed for writing by select() if it is ever
+ * unwritable, then maintenance is invoked with reason OC_REASON_UNWRITABLE.
+ * This is useful for log pipe children, to know when they've blocked.  To
+ * disable this feature, use -1 for write_fd.
+ */
+API_EXPORT(void) ap_register_other_child(int pid,
+       void (*maintenance) (int reason, void *data, ap_wait_t status), void *data,
+                                     int write_fd);
+#define OC_REASON_DEATH                0       /* child has died, caller must call
+                                        * unregister still */
+#define OC_REASON_UNWRITABLE   1       /* write_fd is unwritable */
+#define OC_REASON_RESTART      2       /* a restart is occuring, perform
+                                        * any necessary cleanup (including
+                                        * sending a special signal to child)
+                                        */
+#define OC_REASON_UNREGISTER   3       /* unregister has been called, do
+                                        * whatever is necessary (including
+                                        * kill the child) */
+#define OC_REASON_LOST         4       /* somehow the child exited without
+                                        * us knowing ... buggy os? */
+
+/*
+ * unregister an other_child.  Note that the data pointer is used here, and
+ * is assumed to be unique per other_child.  This is because the pid and
+ * write_fd are possibly killed off separately.
+ */
+API_EXPORT(void) ap_unregister_other_child(void *data);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_MAIN_H */
diff --git a/include/http_protocol.h b/include/http_protocol.h
new file mode 100644 (file)
index 0000000..3824c1a
--- /dev/null
@@ -0,0 +1,223 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_PROTOCOL_H
+#define APACHE_HTTP_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Prototypes for routines which either talk directly back to the user,
+ * or control the ones that eventually do.
+ */
+
+/* Read a request and fill in the fields. */
+
+request_rec *ap_read_request(conn_rec *c);
+
+/* Send a single HTTP header field */
+
+API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, const char *fieldname,
+                      const char *fieldval);
+
+/* Send the minimal part of an HTTP response header... but modules should be
+ * very careful about using this, and should prefer ap_send_http_header().
+ * Much of the HTTP/1.1 implementation correctness depends on code in
+ * ap_send_http_header().
+ */
+API_EXPORT(void) ap_basic_http_header(request_rec *r);
+
+/* Send the Status-Line and header fields for HTTP response */
+
+API_EXPORT(void) ap_send_http_header(request_rec *l);
+
+/* Send the response to special method requests */
+
+API_EXPORT(int) ap_send_http_trace(request_rec *r);
+int ap_send_http_options(request_rec *r);
+
+/* Finish up stuff after a request */
+
+API_EXPORT(void) ap_finalize_request_protocol(request_rec *r);
+
+/* Send error back to client... last arg indicates error status in case
+ * we get an error in the process of trying to deal with an ErrorDocument
+ * to handle some other error.  In that case, we print the default report
+ * for the first thing that went wrong, and more briefly report on the
+ * problem with the ErrorDocument.
+ */
+
+void ap_send_error_response(request_rec *r, int recursive_error);
+
+/* Set last modified header line from the lastmod date of the associated file.
+ * Also, set content length.
+ *
+ * May return an error status, typically USE_LOCAL_COPY (that when the
+ * permit_cache argument is set to one).
+ */
+
+API_EXPORT(int) ap_set_content_length(request_rec *r, long length);
+API_EXPORT(int) ap_set_keepalive(request_rec *r);
+API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime);
+API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak);
+API_EXPORT(void) ap_set_etag(request_rec *r);
+API_EXPORT(void) ap_set_last_modified(request_rec *r);
+API_EXPORT(int) ap_meets_conditions(request_rec *r);
+
+/* Other ways to send stuff at the client.  All of these keep track
+ * of bytes_sent automatically.  This indirection is intended to make
+ * it a little more painless to slide things like HTTP-NG packetization
+ * underneath the main body of the code later.  In the meantime, it lets
+ * us centralize a bit of accounting (bytes_sent).
+ *
+ * These also return the number of bytes written by the call.
+ * They should only be called with a timeout registered, for obvious reaasons.
+ * (Ditto the send_header stuff).
+ */
+
+API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r);
+API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length);
+
+API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r);
+API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length);
+
+API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset,
+                             size_t length);
+
+/* Hmmm... could macrofy these for now, and maybe forever, though the
+ * definitions of the macros would get a whole lot hairier.
+ */
+
+API_EXPORT(int) ap_rputc(int c, request_rec *r);
+API_EXPORT(int) ap_rputs(const char *str, request_rec *r);
+API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
+API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...);
+API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
+API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
+                               __attribute__((format(printf,2,3)));
+API_EXPORT(int) ap_rflush(request_rec *r);
+
+/*
+ * Index used in custom_responses array for a specific error code
+ * (only use outside protocol.c is in getting them configured).
+ */
+
+API_EXPORT(int) ap_index_of_response(int status);
+
+/* Reading a block of data from the client connection (e.g., POST arg) */
+
+API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy);
+API_EXPORT(int) ap_should_client_block(request_rec *r);
+API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
+API_EXPORT(int) ap_discard_request_body(request_rec *r);
+
+/* Sending a byterange */
+
+API_EXPORT(int) ap_set_byterange(request_rec *r);
+API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length);
+
+/* Support for the Basic authentication protocol.  Note that there's
+ * nothing that prevents these from being in mod_auth.c, except that other
+ * modules which wanted to provide their own variants on finding users and
+ * passwords for Basic auth (a fairly common request) would then require
+ * mod_auth to be loaded or they wouldn't work.
+ *
+ * get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured
+ * a correct value in r->connection->user); otherwise it returns an error
+ * code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED
+ * if no authentication at all seemed to be in use, or DECLINED if there
+ * was authentication but it wasn't Basic (in which case, the caller should
+ * presumably decline as well).
+ *
+ * note_basic_auth_failure arranges for the right stuff to be scribbled on
+ * the HTTP return so that the client knows how to authenticate itself the
+ * next time. As does note_digest_auth_failure for Digest auth.
+ *
+ * note_auth_failure does the same thing, but will call the correct one
+ * based on the authentication type in use.
+ *
+ */
+
+API_EXPORT(void) ap_note_auth_failure(request_rec *r);
+API_EXPORT(void) ap_note_basic_auth_failure(request_rec *r);
+API_EXPORT(void) ap_note_digest_auth_failure(request_rec *r);
+API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw);
+
+/*
+ * Setting up the protocol fields for subsidiary requests...
+ * Also, a wrapup function to keep the internal accounting straight.
+ */
+
+void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
+void ap_finalize_sub_req_protocol(request_rec *sub_r);
+
+/* This is also useful for putting sub_reqs and internal_redirects together */
+
+CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri);
+
+/* Get the method number associated with the given string, assumed to
+ * contain an HTTP method.  Returns M_INVALID if not recognized.
+ */
+API_EXPORT(int) ap_method_number_of(const char *method);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_PROTOCOL_H */
diff --git a/include/http_request.h b/include/http_request.h
new file mode 100644 (file)
index 0000000..4d83c54
--- /dev/null
@@ -0,0 +1,117 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_REQUEST_H
+#define APACHE_HTTP_REQUEST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* http_request.c is the code which handles the main line of request
+ * processing, once a request has been read in (finding the right per-
+ * directory configuration, building it if necessary, and calling all
+ * the module dispatch functions in the right order).
+ *
+ * The pieces here which are public to the modules, allow them to learn
+ * how the server would handle some other file or URI, or perhaps even
+ * direct the server to serve that other file instead of the one the
+ * client requested directly.
+ *
+ * There are two ways to do that.  The first is the sub_request mechanism,
+ * which handles looking up files and URIs as adjuncts to some other
+ * request (e.g., directory entries for multiviews and directory listings);
+ * the lookup functions stop short of actually running the request, but
+ * (e.g., for includes), a module may call for the request to be run
+ * by calling run_sub_req.  The space allocated to create sub_reqs can be
+ * reclaimed by calling destroy_sub_req --- be sure to copy anything you care
+ * about which was allocated in its pool elsewhere before doing this.
+ */
+
+API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
+                                             const request_rec *r);
+API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file,
+                                              const request_rec *r);
+API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method,
+                                                const char *new_file,
+                                                const request_rec *r);
+API_EXPORT(int) ap_run_sub_req(request_rec *r);
+API_EXPORT(void) ap_destroy_sub_req(request_rec *r);
+
+/*
+ * Then there's the case that you want some other request to be served
+ * as the top-level request INSTEAD of what the client requested directly.
+ * If so, call this from a handler, and then immediately return OK.
+ */
+
+API_EXPORT(void) ap_internal_redirect(const char *new_uri, request_rec *);
+API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, request_rec *);
+API_EXPORT(int) ap_some_auth_required(request_rec *r);
+API_EXPORT(int) ap_is_initial_req(request_rec *r);
+API_EXPORT(time_t) ap_update_mtime(request_rec *r, time_t dependency_mtime);
+
+#ifdef CORE_PRIVATE
+/* Function called by main.c to handle first-level request */
+void ap_process_request(request_rec *);
+API_EXPORT(void) ap_die(int type, request_rec *r);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_REQUEST_H */
diff --git a/include/http_vhost.h b/include/http_vhost.h
new file mode 100644 (file)
index 0000000..acdb6e2
--- /dev/null
@@ -0,0 +1,95 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTP_VHOST_H
+#define APACHE_HTTP_VHOST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* called before any config is read */
+void ap_init_vhost_config(pool *p);
+
+/* called after the config has been read */
+void ap_fini_vhost_config(pool *p, server_rec *main_server);
+
+/* handle addresses in <VirtualHost> statement */
+const char *ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s);
+
+/* handle NameVirtualHost directive */
+const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg);
+
+/* given an ip address only, give our best guess as to what vhost it is */
+void ap_update_vhost_given_ip(conn_rec *conn);
+
+/* The above is never enough, and this is always called after the headers
+ * have been read.  It may change r->server.
+ */
+void ap_update_vhost_from_headers(request_rec *r);
+
+/* return 1 if the host:port matches any of the aliases of r->server
+ * return 0 otherwise
+ */
+API_EXPORT(int) ap_matches_request_vhost(request_rec *r, const char *host,
+    unsigned port);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTP_VHOST_H */
diff --git a/include/httpd.h b/include/httpd.h
new file mode 100644 (file)
index 0000000..7f19d99
--- /dev/null
@@ -0,0 +1,1167 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_HTTPD_H
+#define APACHE_HTTPD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * httpd.h: header for simple (ha! not anymore) http daemon
+ */
+
+/* Headers in which EVERYONE has an interest... */
+
+#include "ap_config.h"
+#include "alloc.h"
+#include "buff.h"
+#include "ap.h"
+
+/* ----------------------------- config dir ------------------------------ */
+
+/* Define this to be the default server home dir. Most things later in this
+ * file with a relative pathname will have this added.
+ */
+#ifndef HTTPD_ROOT
+#ifdef OS2
+/* Set default for OS/2 file system */
+#define HTTPD_ROOT "/os2httpd"
+#elif defined(WIN32)
+/* Set default for Windows file system */
+#define HTTPD_ROOT "/apache"
+#elif defined(BEOS)
+#define HTTPD_ROOT "/boot/home/apache"
+#else
+#define HTTPD_ROOT "/usr/local/apache"
+#endif
+#endif /* HTTPD_ROOT */
+
+/* Default location of documents.  Can be overridden by the DocumentRoot
+ * directive.
+ */
+#ifndef DOCUMENT_LOCATION
+#ifdef OS2
+/* Set default for OS/2 file system */
+#define DOCUMENT_LOCATION  HTTPD_ROOT "/docs"
+#else
+#define DOCUMENT_LOCATION  HTTPD_ROOT "/htdocs"
+#endif
+#endif /* DOCUMENT_LOCATION */
+
+/* Max. number of dynamically loaded modules */
+#ifndef DYNAMIC_MODULE_LIMIT
+#define DYNAMIC_MODULE_LIMIT 64
+#endif
+
+/* Default administrator's address */
+#define DEFAULT_ADMIN "[no address given]"
+
+/* The target name of the installed Apache */
+#ifndef TARGET
+#define TARGET "httpd"
+#endif
+
+/* 
+ * --------- You shouldn't have to edit anything below this line ----------
+ *
+ * Any modifications to any defaults not defined above should be done in the 
+ * respective config. file. 
+ *
+ */
+
+
+/* -- Internal representation for a HTTP protocol number, e.g., HTTP/1.1 -- */
+
+#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
+#define HTTP_VERSION_MAJOR(number) ((number)/1000)
+#define HTTP_VERSION_MINOR(number) ((number)%1000)
+
+
+/* -------------- Port number for server running standalone --------------- */
+
+#define DEFAULT_HTTP_PORT      80
+#define DEFAULT_HTTPS_PORT     443
+#define ap_is_default_port(port,r)     ((port) == ap_default_port(r))
+#define ap_http_method(r)      "http"
+#define ap_default_port(r)     DEFAULT_HTTP_PORT
+
+/* --------- Default user name and group name running standalone ---------- */
+/* --- These may be specified as numbers by placing a # before a number --- */
+
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "#-1"
+#endif
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP "#-1"
+#endif
+
+/* The name of the log files */
+#ifndef DEFAULT_XFERLOG
+#if defined(OS2) || defined(WIN32)
+#define DEFAULT_XFERLOG "logs/access.log"
+#else
+#define DEFAULT_XFERLOG "logs/access_log"
+#endif
+#endif /* DEFAULT_XFERLOG */
+
+#ifndef DEFAULT_ERRORLOG
+#if defined(OS2) || defined(WIN32)
+#define DEFAULT_ERRORLOG "logs/error.log"
+#else
+#define DEFAULT_ERRORLOG "logs/error_log"
+#endif
+#endif /* DEFAULT_ERRORLOG */
+
+#ifndef DEFAULT_PIDLOG
+#define DEFAULT_PIDLOG "logs/httpd.pid"
+#endif
+#ifndef DEFAULT_SCOREBOARD
+#define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
+#endif
+#ifndef DEFAULT_LOCKFILE
+#define DEFAULT_LOCKFILE "logs/accept.lock"
+#endif
+
+/* Define this to be what your HTML directory content files are called */
+#ifndef DEFAULT_INDEX
+#define DEFAULT_INDEX "index.html"
+#endif
+
+/* Define this to 1 if you want fancy indexing, 0 otherwise */
+#ifndef DEFAULT_INDEXING
+#define DEFAULT_INDEXING 0
+#endif
+
+/* Define this to be what type you'd like returned for files with unknown */
+/* suffixes.  MUST be all lower case. */
+#ifndef DEFAULT_CONTENT_TYPE
+#define DEFAULT_CONTENT_TYPE "text/plain"
+#endif
+
+/* Define this to be what your per-directory security files are called */
+#ifndef DEFAULT_ACCESS_FNAME
+#ifdef OS2
+/* Set default for OS/2 file system */
+#define DEFAULT_ACCESS_FNAME "htaccess"
+#else
+#define DEFAULT_ACCESS_FNAME ".htaccess"
+#endif
+#endif /* DEFAULT_ACCESS_FNAME */
+
+/* The name of the server config file */
+#ifndef SERVER_CONFIG_FILE
+#define SERVER_CONFIG_FILE "conf/httpd.conf"
+#endif
+
+/* The name of the document config file */
+#ifndef RESOURCE_CONFIG_FILE
+#define RESOURCE_CONFIG_FILE "conf/srm.conf"
+#endif
+
+/* The name of the MIME types file */
+#ifndef TYPES_CONFIG_FILE
+#define TYPES_CONFIG_FILE "conf/mime.types"
+#endif
+
+/* The name of the access file */
+#ifndef ACCESS_CONFIG_FILE
+#define ACCESS_CONFIG_FILE "conf/access.conf"
+#endif
+
+/* Whether we should enable rfc1413 identity checking */
+#ifndef DEFAULT_RFC1413
+#define DEFAULT_RFC1413 0
+#endif
+/* The default directory in user's home dir */
+#ifndef DEFAULT_USER_DIR
+#define DEFAULT_USER_DIR "public_html"
+#endif
+
+/* The default path for CGI scripts if none is currently set */
+#ifndef DEFAULT_PATH
+#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
+#endif
+
+/* The path to the shell interpreter, for parsed docs */
+#ifndef SHELL_PATH
+#if defined(OS2) || defined(WIN32)
+/* Set default for OS/2 and Windows file system */
+#define SHELL_PATH "CMD.EXE"
+#else
+#define SHELL_PATH "/bin/sh"
+#endif
+#endif /* SHELL_PATH */
+
+/* The path to the suExec wrapper, can be overridden in Configuration */
+#ifndef SUEXEC_BIN
+#define SUEXEC_BIN  HTTPD_ROOT "/sbin/suexec"
+#endif
+
+/* The default string lengths */
+#define MAX_STRING_LEN HUGE_STRING_LEN
+#define HUGE_STRING_LEN 8192
+
+/* The timeout for waiting for messages */
+#ifndef DEFAULT_TIMEOUT
+#define DEFAULT_TIMEOUT 300
+#endif
+
+/* The timeout for waiting for keepalive timeout until next request */
+#ifndef DEFAULT_KEEPALIVE_TIMEOUT
+#define DEFAULT_KEEPALIVE_TIMEOUT 15
+#endif
+
+/* The number of requests to entertain per connection */
+#ifndef DEFAULT_KEEPALIVE
+#define DEFAULT_KEEPALIVE 100
+#endif
+
+/* The size of the server's internal read-write buffers */
+#define IOBUFSIZE 8192
+
+/* Number of servers to spawn off by default --- also, if fewer than
+ * this free when the caretaker checks, it will spawn more.
+ */
+#ifndef DEFAULT_START_DAEMON
+#define DEFAULT_START_DAEMON 5
+#endif
+
+/* Maximum number of *free* server processes --- more than this, and
+ * they will die off.
+ */
+
+#ifndef DEFAULT_MAX_FREE_DAEMON
+#define DEFAULT_MAX_FREE_DAEMON 10
+#endif
+
+/* Minimum --- fewer than this, and more will be created */
+
+#ifndef DEFAULT_MIN_FREE_DAEMON
+#define DEFAULT_MIN_FREE_DAEMON 5
+#endif
+
+/* Limit on the total --- clients will be locked out if more servers than
+ * this are needed.  It is intended solely to keep the server from crashing
+ * when things get out of hand.
+ *
+ * We keep a hard maximum number of servers, for two reasons --- first off,
+ * in case something goes seriously wrong, we want to stop the fork bomb
+ * short of actually crashing the machine we're running on by filling some
+ * kernel table.  Secondly, it keeps the size of the scoreboard file small
+ * enough that we can read the whole thing without worrying too much about
+ * the overhead.
+ */
+#ifndef HARD_SERVER_LIMIT
+#ifdef WIN32
+#define HARD_SERVER_LIMIT 1024
+#else
+#define HARD_SERVER_LIMIT 256
+#endif
+#endif
+
+/*
+ * Special Apache error codes. These are basically used
+ *  in http_main.c so we can keep track of various errors.
+ *
+ *   APEXIT_OK:
+ *     A normal exit
+ *   APEXIT_INIT:
+ *     A fatal error arising during the server's init sequence
+ *   APEXIT_CHILDINIT:
+ *     The child died during it's init sequence
+ *   APEXIT_CHILDFATAL:
+ *     A fatal error, resulting in the whole server aborting.
+ *     If a child exits with this error, the parent process
+ *     considers this a server-wide fatal error and aborts.
+ *                 
+ */
+#define APEXIT_OK              0x0
+#define APEXIT_INIT            0x2
+#define APEXIT_CHILDINIT       0x3
+#define APEXIT_CHILDFATAL      0xf
+
+/*
+ * (Unix, OS/2 only)
+ * Interval, in microseconds, between scoreboard maintenance.  During
+ * each scoreboard maintenance cycle the parent decides if it needs to
+ * spawn a new child (to meet MinSpareServers requirements), or kill off
+ * a child (to meet MaxSpareServers requirements).  It will only spawn or
+ * kill one child per cycle.  Setting this too low will chew cpu.  The
+ * default is probably sufficient for everyone.  But some people may want
+ * to raise this on servers which aren't dedicated to httpd and where they
+ * don't like the httpd waking up each second to see what's going on.
+ */
+#ifndef SCOREBOARD_MAINTENANCE_INTERVAL
+#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
+#endif
+
+/* Number of requests to try to handle in a single process.  If <= 0,
+ * the children don't die off.  That's the default here, since I'm still
+ * interested in finding and stanching leaks.
+ */
+
+#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
+#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
+#endif
+
+#ifndef DEFAULT_THREADS_PER_CHILD
+#define DEFAULT_THREADS_PER_CHILD 50
+#endif
+#ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD
+#define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0
+#endif
+
+/* The maximum length of the queue of pending connections, as defined
+ * by listen(2).  Under some systems, it should be increased if you
+ * are experiencing a heavy TCP SYN flood attack.
+ *
+ * It defaults to 511 instead of 512 because some systems store it 
+ * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is 
+ * 255 when truncated.
+ */
+
+#ifndef DEFAULT_LISTENBACKLOG
+#define DEFAULT_LISTENBACKLOG 511
+#endif
+
+/* Limits on the size of various request items.  These limits primarily
+ * exist to prevent simple denial-of-service attacks on a server based
+ * on misuse of the protocol.  The recommended values will depend on the
+ * nature of the server resources -- CGI scripts and database backends
+ * might require large values, but most servers could get by with much
+ * smaller limits than we use below.  The request message body size can
+ * be limited by the per-dir config directive LimitRequestBody.
+ *
+ * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
+ * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
+ * These two limits can be lowered (but not raised) by the server config
+ * directives LimitRequestLine and LimitRequestFieldsize, respectively.
+ *
+ * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
+ * the server config directive LimitRequestFields.
+ */
+#ifndef DEFAULT_LIMIT_REQUEST_LINE
+#define DEFAULT_LIMIT_REQUEST_LINE 8190
+#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
+#ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
+#define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
+#endif /* default limit on bytes in any one header field  */
+#ifndef DEFAULT_LIMIT_REQUEST_FIELDS
+#define DEFAULT_LIMIT_REQUEST_FIELDS 100
+#endif /* default limit on number of request header fields */
+
+/*
+ * The below defines the base string of the Server: header. Additional
+ * tokens can be added via the ap_add_version_component() API call.
+ *
+ * The tokens are listed in order of their significance for identifying the
+ * application.
+ *
+ * "Product tokens should be short and to the point -- use of them for 
+ * advertizing or other non-essential information is explicitly forbidden."
+ *
+ * Example: "Apache/1.1.0 MrWidget/0.1-alpha" 
+ */
+
+#define SERVER_BASEVERSION "Apache/1.3.9"      /* SEE COMMENTS ABOVE */
+#define SERVER_VERSION  SERVER_BASEVERSION
+enum server_token_type {
+    SrvTk_MIN,         /* eg: Apache/1.3.0 */
+    SrvTk_OS,          /* eg: Apache/1.3.0 (UNIX) */
+    SrvTk_FULL         /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */
+};
+
+API_EXPORT(const char *) ap_get_server_version(void);
+API_EXPORT(void) ap_add_version_component(const char *component);
+API_EXPORT(const char *) ap_get_server_built(void);
+
+/* Numeric release version identifier: MMNNFFRBB: major minor fix final beta
+ * Always increases along the same track as the source branch.
+ * For example, Apache 1.4.2 would be '10402100', 2.5b7 would be '20500007'.
+ */
+#define APACHE_RELEASE 10309100
+
+#define SERVER_PROTOCOL "HTTP/1.1"
+#ifndef SERVER_SUPPORT
+#define SERVER_SUPPORT "http://www.apache.org/"
+#endif
+
+#define DECLINED -1            /* Module declines to handle */
+#define DONE -2                        /* Module has served the response completely 
+                                *  - it's safe to die() with no more output
+                                */
+#define OK 0                   /* Module has handled this stage. */
+
+
+/* ----------------------- HTTP Status Codes  ------------------------- */
+
+/* The size of the static array in http_protocol.c for storing
+ * all of the potential response status-lines (a sparse table).
+ * A future version should dynamically generate the table at startup.
+ */
+#define RESPONSE_CODES 55
+
+#define HTTP_CONTINUE                      100
+#define HTTP_SWITCHING_PROTOCOLS           101
+#define HTTP_PROCESSING                    102
+#define HTTP_OK                            200
+#define HTTP_CREATED                       201
+#define HTTP_ACCEPTED                      202
+#define HTTP_NON_AUTHORITATIVE             203
+#define HTTP_NO_CONTENT                    204
+#define HTTP_RESET_CONTENT                 205
+#define HTTP_PARTIAL_CONTENT               206
+#define HTTP_MULTI_STATUS                  207
+#define HTTP_MULTIPLE_CHOICES              300
+#define HTTP_MOVED_PERMANENTLY             301
+#define HTTP_MOVED_TEMPORARILY             302
+#define HTTP_SEE_OTHER                     303
+#define HTTP_NOT_MODIFIED                  304
+#define HTTP_USE_PROXY                     305
+#define HTTP_TEMPORARY_REDIRECT            307
+#define HTTP_BAD_REQUEST                   400
+#define HTTP_UNAUTHORIZED                  401
+#define HTTP_PAYMENT_REQUIRED              402
+#define HTTP_FORBIDDEN                     403
+#define HTTP_NOT_FOUND                     404
+#define HTTP_METHOD_NOT_ALLOWED            405
+#define HTTP_NOT_ACCEPTABLE                406
+#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
+#define HTTP_REQUEST_TIME_OUT              408
+#define HTTP_CONFLICT                      409
+#define HTTP_GONE                          410
+#define HTTP_LENGTH_REQUIRED               411
+#define HTTP_PRECONDITION_FAILED           412
+#define HTTP_REQUEST_ENTITY_TOO_LARGE      413
+#define HTTP_REQUEST_URI_TOO_LARGE         414
+#define HTTP_UNSUPPORTED_MEDIA_TYPE        415
+#define HTTP_RANGE_NOT_SATISFIABLE         416
+#define HTTP_EXPECTATION_FAILED            417
+#define HTTP_UNPROCESSABLE_ENTITY          422
+#define HTTP_LOCKED                        423
+#define HTTP_FAILED_DEPENDENCY             424
+#define HTTP_INTERNAL_SERVER_ERROR         500
+#define HTTP_NOT_IMPLEMENTED               501
+#define HTTP_BAD_GATEWAY                   502
+#define HTTP_SERVICE_UNAVAILABLE           503
+#define HTTP_GATEWAY_TIME_OUT              504
+#define HTTP_VERSION_NOT_SUPPORTED         505
+#define HTTP_VARIANT_ALSO_VARIES           506
+#define HTTP_INSUFFICIENT_STORAGE          507
+#define HTTP_NOT_EXTENDED                  510
+
+#define DOCUMENT_FOLLOWS    HTTP_OK
+#define PARTIAL_CONTENT     HTTP_PARTIAL_CONTENT
+#define MULTIPLE_CHOICES    HTTP_MULTIPLE_CHOICES
+#define MOVED               HTTP_MOVED_PERMANENTLY
+#define REDIRECT            HTTP_MOVED_TEMPORARILY
+#define USE_LOCAL_COPY      HTTP_NOT_MODIFIED
+#define BAD_REQUEST         HTTP_BAD_REQUEST
+#define AUTH_REQUIRED       HTTP_UNAUTHORIZED
+#define FORBIDDEN           HTTP_FORBIDDEN
+#define NOT_FOUND           HTTP_NOT_FOUND
+#define METHOD_NOT_ALLOWED  HTTP_METHOD_NOT_ALLOWED
+#define NOT_ACCEPTABLE      HTTP_NOT_ACCEPTABLE
+#define LENGTH_REQUIRED     HTTP_LENGTH_REQUIRED
+#define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED
+#define SERVER_ERROR        HTTP_INTERNAL_SERVER_ERROR
+#define NOT_IMPLEMENTED     HTTP_NOT_IMPLEMENTED
+#define BAD_GATEWAY         HTTP_BAD_GATEWAY
+#define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
+
+#define ap_is_HTTP_INFO(x)         (((x) >= 100)&&((x) < 200))
+#define ap_is_HTTP_SUCCESS(x)      (((x) >= 200)&&((x) < 300))
+#define ap_is_HTTP_REDIRECT(x)     (((x) >= 300)&&((x) < 400))
+#define ap_is_HTTP_ERROR(x)        (((x) >= 400)&&((x) < 600))
+#define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
+#define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
+
+#define ap_status_drops_connection(x) \
+                                   (((x) == HTTP_BAD_REQUEST)           || \
+                                    ((x) == HTTP_REQUEST_TIME_OUT)      || \
+                                    ((x) == HTTP_LENGTH_REQUIRED)       || \
+                                    ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
+                                    ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
+                                    ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
+                                    ((x) == HTTP_SERVICE_UNAVAILABLE) || \
+                                   ((x) == HTTP_NOT_IMPLEMENTED))
+
+/* Methods recognized (but not necessarily handled) by the server.
+ * These constants are used in bit shifting masks of size int, so it is
+ * unsafe to have more methods than bits in an int.  HEAD == M_GET.
+ */
+#define M_GET        0
+#define M_PUT        1
+#define M_POST       2
+#define M_DELETE     3
+#define M_CONNECT    4
+#define M_OPTIONS    5
+#define M_TRACE      6
+#define M_PATCH      7
+#define M_PROPFIND   8
+#define M_PROPPATCH  9
+#define M_MKCOL     10
+#define M_COPY      11
+#define M_MOVE      12
+#define M_LOCK      13
+#define M_UNLOCK    14
+#define M_INVALID   15
+
+#define METHODS     16
+
+#define CGI_MAGIC_TYPE "application/x-httpd-cgi"
+#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
+#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
+#ifdef CHARSET_EBCDIC
+#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
+#endif /*CHARSET_EBCDIC*/
+#define MAP_FILE_MAGIC_TYPE "application/x-type-map"
+#define ASIS_MAGIC_TYPE "httpd/send-as-is"
+#define DIR_MAGIC_TYPE "httpd/unix-directory"
+#define STATUS_MAGIC_TYPE "application/x-httpd-status"
+
+/*
+ * Define the HTML doctype strings centrally.
+ */
+#define DOCTYPE_HTML_2_0  "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
+                          "DTD HTML 2.0//EN\">\n"
+#define DOCTYPE_HTML_3_2  "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
+                          "DTD HTML 3.2 Final//EN\">\n"
+#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
+                          "DTD HTML 4.0//EN\"\n" \
+                          "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
+                          "DTD HTML 4.0 Transitional//EN\"\n" \
+                          "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
+#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
+                          "DTD HTML 4.0 Frameset//EN\"\n" \
+                          "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
+
+/* Just in case your linefeed isn't the one the other end is expecting. */
+#ifndef CHARSET_EBCDIC
+#define LF 10
+#define CR 13
+#else /* CHARSET_EBCDIC */
+#include "ebcdic.h"
+/* OSD_POSIX uses the EBCDIC charset. The transition ASCII->EBCDIC is done in
+ * the buff package (bread/bputs/bwrite), so everywhere else, we use
+ * "native EBCDIC" CR and NL characters. These are therefore defined as
+ * '\r' and '\n'.
+ * NB: this is not the whole truth - sometimes \015 and \012 are contained
+ * in literal (EBCDIC!) strings, so these are not converted but passed.
+ */
+#define CR '\r'
+#define LF '\n'
+#endif /* CHARSET_EBCDIC */
+
+/* Possible values for request_rec.read_body (set by handling module):
+ *    REQUEST_NO_BODY          Send 413 error if message has any body
+ *    REQUEST_CHUNKED_ERROR    Send 411 error if body without Content-Length
+ *    REQUEST_CHUNKED_DECHUNK  If chunked, remove the chunks for me.
+ *    REQUEST_CHUNKED_PASS     Pass the chunks to me without removal.
+ */
+#define REQUEST_NO_BODY          0
+#define REQUEST_CHUNKED_ERROR    1
+#define REQUEST_CHUNKED_DECHUNK  2
+#define REQUEST_CHUNKED_PASS     3
+
+/* Things which may vary per file-lookup WITHIN a request ---
+ * e.g., state of MIME config.  Basically, the name of an object, info
+ * about the object, and any other info we may ahve which may need to
+ * change as we go poking around looking for it (e.g., overridden by
+ * .htaccess files).
+ *
+ * Note how the default state of almost all these things is properly
+ * zero, so that allocating it with pcalloc does the right thing without
+ * a whole lot of hairy initialization... so long as we are willing to
+ * make the (fairly) portable assumption that the bit pattern of a NULL
+ * pointer is, in fact, zero.
+ */
+
+/* This represents the result of calling htaccess; these are cached for
+ * each request.
+ */
+struct htaccess_result {
+    char *dir;                 /* the directory to which this applies */
+    int override;              /* the overrides allowed for the .htaccess file */
+    void *htaccess;            /* the configuration directives */
+/* the next one, or NULL if no more; N.B. never change this */
+    const struct htaccess_result *next;
+};
+
+typedef struct conn_rec conn_rec;
+typedef struct server_rec server_rec;
+typedef struct request_rec request_rec;
+typedef struct listen_rec listen_rec;
+
+#include "util_uri.h"
+
+struct request_rec {
+
+    ap_pool *pool;
+    conn_rec *connection;
+    server_rec *server;
+
+    request_rec *next;         /* If we wind up getting redirected,
+                                * pointer to the request we redirected to.
+                                */
+    request_rec *prev;         /* If this is an internal redirect,
+                                * pointer to where we redirected *from*.
+                                */
+
+    request_rec *main;         /* If this is a sub_request (see request.h) 
+                                * pointer back to the main request.
+                                */
+
+    /* Info about the request itself... we begin with stuff that only
+     * protocol.c should ever touch...
+     */
+
+    char *the_request;         /* First line of request, so we can log it */
+    int assbackwards;          /* HTTP/0.9, "simple" request */
+    int proxyreq;              /* A proxy request (calculated during
+                                * post_read_request or translate_name) */
+    int header_only;           /* HEAD request, as opposed to GET */
+    char *protocol;            /* Protocol, as given to us, or HTTP/0.9 */
+    int proto_num;             /* Number version of protocol; 1.1 = 1001 */
+    const char *hostname;      /* Host, as set by full URI or Host: */
+
+    time_t request_time;       /* When the request started */
+
+    const char *status_line;   /* Status line, if set by script */
+    int status;                        /* In any case */
+
+    /* Request method, two ways; also, protocol, etc..  Outside of protocol.c,
+     * look, but don't touch.
+     */
+
+    const char *method;                /* GET, HEAD, POST, etc. */
+    int method_number;         /* M_GET, M_POST, etc. */
+
+    /*
+       allowed is a bitvector of the allowed methods.
+
+       A handler must ensure that the request method is one that
+       it is capable of handling.  Generally modules should DECLINE
+       any request methods they do not handle.  Prior to aborting the
+       handler like this the handler should set r->allowed to the list
+       of methods that it is willing to handle.  This bitvector is used
+       to construct the "Allow:" header required for OPTIONS requests,
+       and METHOD_NOT_ALLOWED and NOT_IMPLEMENTED status codes.
+
+       Since the default_handler deals with OPTIONS, all modules can
+       usually decline to deal with OPTIONS.  TRACE is always allowed,
+       modules don't need to set it explicitly.
+
+       Since the default_handler will always handle a GET, a
+       module which does *not* implement GET should probably return
+       METHOD_NOT_ALLOWED.  Unfortunately this means that a Script GET
+       handler can't be installed by mod_actions.
+    */
+    int allowed;               /* Allowed methods - for 405, OPTIONS, etc */
+
+    int sent_bodyct;           /* byte count in stream is for body */
+    long bytes_sent;           /* body byte count, for easy access */
+    time_t mtime;              /* Time the resource was last modified */
+
+    /* HTTP/1.1 connection-level features */
+
+    int chunked;               /* sending chunked transfer-coding */
+    int byterange;             /* number of byte ranges */
+    char *boundary;            /* multipart/byteranges boundary */
+    const char *range;         /* The Range: header */
+    long clength;              /* The "real" content length */
+
+    long remaining;            /* bytes left to read */
+    long read_length;          /* bytes that have been read */
+    int read_body;             /* how the request body should be read */
+    int read_chunked;          /* reading chunked transfer-coding */
+    unsigned expecting_100;    /* is client waiting for a 100 response? */
+
+    /* MIME header environments, in and out.  Also, an array containing
+     * environment variables to be passed to subprocesses, so people can
+     * write modules to add to that environment.
+     *
+     * The difference between headers_out and err_headers_out is that the
+     * latter are printed even on error, and persist across internal redirects
+     * (so the headers printed for ErrorDocument handlers will have them).
+     *
+     * The 'notes' table is for notes from one module to another, with no
+     * other set purpose in mind...
+     */
+
+    table *headers_in;
+    table *headers_out;
+    table *err_headers_out;
+    table *subprocess_env;
+    table *notes;
+
+    /* content_type, handler, content_encoding, content_language, and all
+     * content_languages MUST be lowercased strings.  They may be pointers
+     * to static strings; they should not be modified in place.
+     */
+    const char *content_type;  /* Break these out --- we dispatch on 'em */
+    const char *handler;       /* What we *really* dispatch on           */
+
+    const char *content_encoding;
+    const char *content_language;      /* for back-compat. only -- do not use */
+    array_header *content_languages;   /* array of (char*) */
+
+    char *vlist_validator;      /* variant list validator (if negotiated) */
+
+    int no_cache;
+    int no_local_copy;
+
+    /* What object is being requested (either directly, or via include
+     * or content-negotiation mapping).
+     */
+
+    char *unparsed_uri;                /* the uri without any parsing performed */
+    char *uri;                 /* the path portion of the URI */
+    char *filename;
+    char *path_info;
+    char *args;                        /* QUERY_ARGS, if any */
+    struct stat finfo;         /* ST_MODE set to zero if no such file */
+    uri_components parsed_uri; /* components of uri, dismantled */
+
+    /* Various other config info which may change with .htaccess files
+     * These are config vectors, with one void* pointer for each module
+     * (the thing pointed to being the module's business).
+     */
+
+    void *per_dir_config;      /* Options set in config files, etc. */
+    void *request_config;      /* Notes on *this* request */
+
+/*
+ * a linked list of the configuration directives in the .htaccess files
+ * accessed by this request.
+ * N.B. always add to the head of the list, _never_ to the end.
+ * that way, a sub request's list can (temporarily) point to a parent's list
+ */
+    const struct htaccess_result *htaccess;
+
+/* Things placed at the end of the record to avoid breaking binary
+ * compatibility.  It would be nice to remember to reorder the entire
+ * record to improve 64bit alignment the next time we need to break
+ * binary compatibility for some other reason.
+ */
+};
+
+
+/* Things which are per connection
+ */
+
+struct conn_rec {
+
+    ap_pool *pool;
+    server_rec *server;
+    server_rec *base_server;   /* Physical vhost this conn come in on */
+    void *vhost_lookup_data;   /* used by http_vhost.c */
+
+    /* Information about the connection itself */
+
+    int child_num;             /* The number of the child handling conn_rec */
+    BUFF *client;              /* Connection to the guy */
+
+    /* Who is the client? */
+
+    struct sockaddr_in local_addr;     /* local address */
+    struct sockaddr_in remote_addr;    /* remote address */
+    char *remote_ip;           /* Client's IP address */
+    char *remote_host;         /* Client's DNS name, if known.
+                                * NULL if DNS hasn't been checked,
+                                * "" if it has and no address was found.
+                                * N.B. Only access this though
+                                * get_remote_host() */
+    char *remote_logname;      /* Only ever set if doing rfc1413 lookups.
+                                * N.B. Only access this through
+                                * get_remote_logname() */
+    char *user;                        /* If an authentication check was made,
+                                * this gets set to the user name.  We assume
+                                * that there's only one user per connection(!)
+                                */
+    char *ap_auth_type;                /* Ditto. */
+
+    unsigned aborted:1;                /* Are we still talking? */
+    signed int keepalive:2;    /* Are we using HTTP Keep-Alive?
+                                * -1 fatal error, 0 undecided, 1 yes */
+    unsigned keptalive:1;      /* Did we use HTTP Keep-Alive? */
+    signed int double_reverse:2;/* have we done double-reverse DNS?
+                                * -1 yes/failure, 0 not yet, 1 yes/success */
+    int keepalives;            /* How many times have we used it? */
+    char *local_ip;            /* server IP address */
+    char *local_host;          /* used for ap_get_server_name when
+                                * UseCanonicalName is set to DNS
+                                * (ignores setting of HostnameLookups) */
+};
+
+/* Per-vhost config... */
+
+/* The address 255.255.255.255, when used as a virtualhost address,
+ * will become the "default" server when the ip doesn't match other vhosts.
+ */
+#define DEFAULT_VHOST_ADDR 0xfffffffful
+
+typedef struct server_addr_rec server_addr_rec;
+struct server_addr_rec {
+    server_addr_rec *next;
+    struct in_addr host_addr;  /* The bound address, for this server */
+    unsigned short host_port;  /* The bound port, for this server */
+    char *virthost;            /* The name given in <VirtualHost> */
+};
+
+struct server_rec {
+
+    server_rec *next;
+
+    /* description of where the definition came from */
+    const char *defn_name;
+    unsigned defn_line_number;
+
+    /* Full locations of server config info */
+
+    char *srm_confname;
+    char *access_confname;
+
+    /* Contact information */
+
+    char *server_admin;
+    char *server_hostname;
+    unsigned short port;       /* for redirects, etc. */
+
+    /* Log files --- note that transfer log is now in the modules... */
+
+    char *error_fname;
+    FILE *error_log;
+    int loglevel;
+
+    /* Module-specific configuration for server, and defaults... */
+
+    int is_virtual;            /* true if this is the virtual server */
+    void *module_config;       /* Config vector containing pointers to
+                                * modules' per-server config structures.
+                                */
+    void *lookup_defaults;     /* MIME type info, etc., before we start
+                                * checking per-directory info.
+                                */
+    /* Transaction handling */
+
+    server_addr_rec *addrs;
+    int timeout;               /* Timeout, in seconds, before we give up */
+    int keep_alive_timeout;    /* Seconds we'll wait for another request */
+    int keep_alive_max;                /* Maximum requests per connection */
+    int keep_alive;            /* Use persistent connections? */
+    int send_buffer_size;      /* size of TCP send buffer (in bytes) */
+
+    char *path;                        /* Pathname for ServerPath */
+    int pathlen;               /* Length of path */
+
+    array_header *names;       /* Normal names for ServerAlias servers */
+    array_header *wild_names;  /* Wildcarded names for ServerAlias servers */
+
+    uid_t server_uid;        /* effective user id when calling exec wrapper */
+    gid_t server_gid;        /* effective group id when calling exec wrapper */
+
+    int limit_req_line;      /* limit on size of the HTTP request line    */
+    int limit_req_fieldsize; /* limit on size of any request header field */
+    int limit_req_fields;    /* limit on number of request header fields  */
+};
+
+/* These are more like real hosts than virtual hosts */
+struct listen_rec {
+    listen_rec *next;
+    struct sockaddr_in local_addr;     /* local IP address and port */
+    int fd;
+    int used;                  /* Only used during restart */
+/* more stuff here, like which protocol is bound to the port */
+};
+
+/* Prototypes for utilities... util.c.
+ */
+
+extern void ap_util_init(void);
+
+/* Time */
+extern API_VAR_EXPORT const char ap_month_snames[12][4];
+extern API_VAR_EXPORT const char ap_day_snames[7][4];
+
+API_EXPORT(struct tm *) ap_get_gmtoff(int *tz);
+API_EXPORT(char *) ap_get_time(void);
+API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype);
+API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt);
+API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t);
+
+/* String handling. The *_nc variants allow you to use non-const char **s as
+   arguments (unfortunately C won't automatically convert a char ** to a const
+   char **) */
+
+API_EXPORT(char *) ap_getword(pool *p, const char **line, char stop);
+API_EXPORT(char *) ap_getword_nc(pool *p, char **line, char stop);
+API_EXPORT(char *) ap_getword_white(pool *p, const char **line);
+API_EXPORT(char *) ap_getword_white_nc(pool *p, char **line);
+API_EXPORT(char *) ap_getword_nulls(pool *p, const char **line, char stop);
+API_EXPORT(char *) ap_getword_nulls_nc(pool *p, char **line, char stop);
+API_EXPORT(char *) ap_getword_conf(pool *p, const char **line);
+API_EXPORT(char *) ap_getword_conf_nc(pool *p, char **line);
+
+API_EXPORT(const char *) ap_size_list_item(const char **field, int *len);
+API_EXPORT(char *) ap_get_list_item(pool *p, const char **field);
+API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok);
+
+API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white);
+API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok);
+API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok);
+
+API_EXPORT(int) ap_is_url(const char *u);
+API_EXPORT(int) ap_unescape_url(char *url);
+API_EXPORT(void) ap_no2slash(char *name);
+API_EXPORT(void) ap_getparents(char *name);
+API_EXPORT(char *) ap_escape_path_segment(pool *p, const char *s);
+API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial);
+#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
+API_EXPORT(char *) ap_escape_html(pool *p, const char *s);
+API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname,
+                                   unsigned port, const request_rec *r);
+API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *s);
+
+API_EXPORT(int) ap_count_dirs(const char *path);
+API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n);
+API_EXPORT(char *) ap_make_dirstr_parent(pool *p, const char *s);
+/* deprecated.  The previous two routines are preferred. */
+API_EXPORT(char *) ap_make_dirstr(pool *a, const char *s, int n);
+API_EXPORT(char *) ap_make_full_path(pool *a, const char *dir, const char *f);
+
+API_EXPORT(int) ap_is_matchexp(const char *str);
+API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp);
+API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
+API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded);
+API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); 
+API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded);
+API_EXPORT(char *) ap_uuencode(pool *p, char *string); 
+
+#ifdef OS2
+void os2pathname(char *path);
+char *ap_double_quotes(pool *p, char *str);
+#endif
+
+API_EXPORT(int)    ap_regexec(const regex_t *preg, const char *string,
+                              size_t nmatch, regmatch_t pmatch[], int eflags);
+API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, 
+                               char *errbuf, size_t errbuf_size);
+API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source,
+                              size_t nmatch, regmatch_t pmatch[]);
+
+API_EXPORT(void) ap_content_type_tolower(char *);
+API_EXPORT(void) ap_str_tolower(char *);
+API_EXPORT(int) ap_ind(const char *, char);    /* Sigh... */
+API_EXPORT(int) ap_rind(const char *, char);
+
+API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring);
+
+/* Common structure for reading of config files / passwd files etc. */
+typedef struct {
+    int (*getch) (void *param);        /* a getc()-like function */
+    void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */
+    int (*close) (void *param);        /* a close hander function */
+    void *param;               /* the argument passed to getch/getstr/close */
+    const char *name;          /* the filename / description */
+    unsigned line_number;      /* current line number, starting at 1 */
+} configfile_t;
+
+/* Open a configfile_t as FILE, return open configfile_t struct pointer */
+API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name);
+
+/* Allocate a configfile_t handle with user defined functions and params */
+API_EXPORT(configfile_t *) ap_pcfg_open_custom(pool *p, const char *descr,
+    void *param,
+    int(*getc_func)(void*),
+    void *(*gets_func) (void *buf, size_t bufsiz, void *param),
+    int(*close_func)(void *param));
+
+/* Read one line from open configfile_t, strip LF, increase line number */
+API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
+
+/* Read one char from open configfile_t, increase line number upon LF */
+API_EXPORT(int) ap_cfg_getc(configfile_t *cfp);
+
+/* Detach from open configfile_t, calling the close handler */
+API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp);
+
+#ifdef NEED_STRERROR
+char *strerror(int err);
+#endif
+
+/* Misc system hackery */
+
+API_EXPORT(uid_t) ap_uname2id(const char *name);
+API_EXPORT(gid_t) ap_gname2id(const char *name);
+API_EXPORT(int) ap_is_directory(const char *name);
+API_EXPORT(int) ap_can_exec(const struct stat *);
+API_EXPORT(void) ap_chdir_file(const char *file);
+
+#ifndef HAVE_CANONICAL_FILENAME
+/*
+ *  We can't define these in os.h because of dependence on pool pointer.
+ */
+#define ap_os_canonical_filename(p,f)  (f)
+#define ap_os_case_canonical_filename(p,f)  (f)
+#define ap_os_systemcase_filename(p,f)  (f)
+#else
+API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file);
+#ifdef WIN32
+API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile);
+API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
+#else
+#define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f)
+#define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f)
+#endif
+#endif
+
+#ifdef _OSD_POSIX
+extern const char *os_set_account(pool *p, const char *account);
+extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
+#endif /* _OSD_POSIX */
+
+char *ap_get_local_host(pool *);
+unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port);
+
+extern API_VAR_EXPORT time_t ap_restart_time;
+
+/*
+ * Apache tries to keep all of its long term filehandles (such as log files,
+ * and sockets) above this number.  This is to workaround problems in many
+ * third party libraries that are compiled with a small FD_SETSIZE.  There
+ * should be no reason to lower this, because it's only advisory.  If a file
+ * can't be allocated above this number then it will remain in the "slack"
+ * area.
+ *
+ * Only the low slack line is used by default.  If HIGH_SLACK_LINE is defined
+ * then an attempt is also made to keep all non-FILE * files above the high
+ * slack line.  This is to work around a Solaris C library limitation, where it
+ * uses an unsigned char to store the file descriptor.
+ */
+#ifndef LOW_SLACK_LINE
+#define LOW_SLACK_LINE 15
+#endif
+/* #define HIGH_SLACK_LINE      255 */
+
+/*
+ * The ap_slack() function takes a fd, and tries to move it above the indicated
+ * line.  It returns an fd which may or may not have moved above the line, and
+ * never fails.  If the high line was requested and it fails it will also try
+ * the low line.
+ */
+#ifdef NO_SLACK
+#define ap_slack(fd,line)   (fd)
+#else
+int ap_slack(int fd, int line);
+#define AP_SLACK_LOW   1
+#define AP_SLACK_HIGH  2
+#endif
+
+API_EXPORT(char *) ap_escape_quotes(pool *p, const char *instr);
+
+/*
+ * Redefine assert() to something more useful for an Apache...
+ */
+API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
+                           __attribute__((noreturn));
+#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
+
+/* The optimized timeout code only works if we're not MULTITHREAD and we're
+ * also not using a scoreboard file
+ */
+#if !defined (MULTITHREAD) && \
+    (defined (USE_MMAP_SCOREBOARD) || defined (USE_SHMGET_SCOREBOARD))
+#define OPTIMIZE_TIMEOUTS
+#endif
+
+/* A set of flags which indicate places where the server should raise(SIGSTOP).
+ * This is useful for debugging, because you can then attach to that process
+ * with gdb and continue.  This is important in cases where one_process
+ * debugging isn't possible.
+ */
+#define SIGSTOP_DETACH                 1
+#define SIGSTOP_MAKE_CHILD             2
+#define SIGSTOP_SPAWN_CHILD            4
+#define SIGSTOP_PIPED_LOG_SPAWN                8
+#define SIGSTOP_CGI_CHILD              16
+
+#ifdef DEBUG_SIGSTOP
+extern int raise_sigstop_flags;
+#define RAISE_SIGSTOP(x)       do { \
+       if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
+    } while (0)
+#else
+#define RAISE_SIGSTOP(x)
+#endif
+
+API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r);
+
+/* strtoul does not exist on sunos4. */
+#ifdef strtoul
+#undef strtoul
+#endif
+#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_HTTPD_H */
diff --git a/include/rfc1413.h b/include/rfc1413.h
new file mode 100644 (file)
index 0000000..e69c9d2
--- /dev/null
@@ -0,0 +1,71 @@
+/* ====================================================================
+ * Copyright (c) 1996-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_RFC1413_H
+#define APACHE_RFC1413_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern char *ap_rfc1413(conn_rec *conn, server_rec *srv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_RFC1413_H */
diff --git a/include/util_date.h b/include/util_date.h
new file mode 100644 (file)
index 0000000..8e20510
--- /dev/null
@@ -0,0 +1,85 @@
+/* ====================================================================
+ * Copyright (c) 1996-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_UTIL_DATE_H
+#define APACHE_UTIL_DATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * util_date.h: prototypes for date parsing utility routines
+ */
+
+#ifdef NEWSOS
+#include <stdlib.h>
+#include <sys/types.h>
+#endif
+#include <time.h>
+
+#define BAD_DATE (time_t)0
+
+API_EXPORT(int) ap_checkmask(const char *data, const char *mask);
+API_EXPORT(time_t) ap_tm2sec(const struct tm *t);
+API_EXPORT(time_t) ap_parseHTTPdate(const char *date);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_UTIL_DATE_H */
diff --git a/include/util_md5.h b/include/util_md5.h
new file mode 100644 (file)
index 0000000..0a0dc9c
--- /dev/null
@@ -0,0 +1,80 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_UTIL_MD5_H
+#define APACHE_UTIL_MD5_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ap_md5.h"
+
+API_EXPORT(char *) ap_md5(pool *a, const unsigned char *string);
+API_EXPORT(char *) ap_md5_binary(pool *a, const unsigned char *buf, int len);
+API_EXPORT(char *) ap_md5contextTo64(pool *p, AP_MD5_CTX * context);
+#ifdef CHARSET_EBCDIC
+API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile, int convert);
+#else
+API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile);
+#endif /* CHARSET_EBCDIC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_UTIL_MD5_H */
diff --git a/include/util_script.h b/include/util_script.h
new file mode 100644 (file)
index 0000000..416d729
--- /dev/null
@@ -0,0 +1,91 @@
+/* ====================================================================
+ * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef APACHE_UTIL_SCRIPT_H
+#define APACHE_UTIL_SCRIPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef APACHE_ARG_MAX
+#ifdef _POSIX_ARG_MAX
+#define APACHE_ARG_MAX _POSIX_ARG_MAX
+#else
+#define APACHE_ARG_MAX 512
+#endif
+#endif
+
+API_EXPORT(char **) ap_create_environment(pool *p, table *t);
+API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info);
+API_EXPORT(void) ap_add_cgi_vars(request_rec *r);
+API_EXPORT(void) ap_add_common_vars(request_rec *r);
+API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer);
+API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f,
+                                               char *buffer);
+API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
+                                      int (*getsfunc) (char *, int, void *),
+                                      void *getsfunc_data);
+API_EXPORT(void) ap_send_size(size_t size, request_rec *r);
+API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env,
+                          int shellcmd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APACHE_UTIL_SCRIPT_H */
diff --git a/include/util_uri.h b/include/util_uri.h
new file mode 100644 (file)
index 0000000..d5a6759
--- /dev/null
@@ -0,0 +1,128 @@
+/* ====================================================================
+ * Copyright (c) 1998-1999 The Apache Group.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the Apache Group
+ *    for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+/*
+ * util_uri.h: External Interface of util_uri.c
+ */
+
+#ifndef UTIL_URI_H
+#define UTIL_URI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+    const char *name;
+    unsigned short default_port;
+} schemes_t;
+
+#define        DEFAULT_FTP_DATA_PORT   20
+#define        DEFAULT_FTP_PORT        21
+#define        DEFAULT_GOPHER_PORT     70
+#define        DEFAULT_NNTP_PORT       119
+#define        DEFAULT_WAIS_PORT       210
+#define        DEFAULT_SNEWS_PORT      563
+#define        DEFAULT_PROSPERO_PORT   1525    /* WARNING: conflict w/Oracle */
+
+/* Flags passed to unparse_uri_components(): */
+#define UNP_OMITSITEPART       (1U<<0) /* suppress "scheme://user@site:port" */
+#define        UNP_OMITUSER            (1U<<1) /* Just omit user */
+#define        UNP_OMITPASSWORD        (1U<<2) /* Just omit password */
+#define        UNP_OMITUSERINFO        (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */
+#define        UNP_REVEALPASSWORD      (1U<<3) /* Show plain text password (default: show XXXXXXXX) */
+#define UNP_OMITPATHINFO       (1U<<4) /* Show "scheme://user@site:port" only */
+#define UNP_OMITQUERY          (1U<<5) /* Omit the "?queryarg" from the path */
+
+typedef struct {
+    char *scheme;              /* scheme ("http"/"ftp"/...) */
+    char *hostinfo;             /* combined [user[:password]@]host[:port] */
+    char *user;                        /* user name, as in http://user:passwd@host:port/ */
+    char *password;            /* password, as in http://user:passwd@host:port/ */
+    char *hostname;            /* hostname from URI (or from Host: header) */
+    char *port_str;            /* port string (integer representation is in "port") */
+    char *path;                        /* the request path (or "/" if only scheme://host was given) */
+    char *query;               /* Everything after a '?' in the path, if present */
+    char *fragment;            /* Trailing "#fragment" string, if present */
+
+    struct hostent *hostent;
+
+    unsigned short port;       /* The port number, numeric, valid only if port_str != NULL */
+    
+    unsigned is_initialized:1;
+
+    unsigned dns_looked_up:1;
+    unsigned dns_resolved:1;
+
+} uri_components;
+
+/* util_uri.c */
+API_EXPORT(unsigned short) ap_default_port_for_scheme(const char *scheme_str);
+API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec *r);
+API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp);
+API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname);
+API_EXPORT(char *) ap_unparse_uri_components(pool *p, const uri_components *uptr,
+    unsigned flags);
+API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr);
+API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr);
+/* called by the core in main() */
+extern void ap_util_uri_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*UTIL_URI_H*/