summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/httpd/htdocs/manual/misc/rewriteguide.html1919
-rw-r--r--usr.sbin/httpd/htdocs/manual/netware.html290
-rw-r--r--usr.sbin/httpd/src/ApacheNW.mcp.gzbin0 -> 76780 bytes
-rw-r--r--usr.sbin/httpd/src/helpers/GuessCodeset15
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/dllmain.c40
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmlparse.def41
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmlparse.dsp124
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmlparse.mak289
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmltok.def15
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmltok.dsp160
-rw-r--r--usr.sbin/httpd/src/lib/expat-lite/xmltok.mak261
-rw-r--r--usr.sbin/httpd/src/os/mpeix/Makefile.tmpl50
-rw-r--r--usr.sbin/httpd/src/os/mpeix/README5
-rw-r--r--usr.sbin/httpd/src/os/mpeix/dlopen.c216
-rw-r--r--usr.sbin/httpd/src/os/mpeix/gettimeofday.c116
-rw-r--r--usr.sbin/httpd/src/os/mpeix/mpe_dl_stub.c1
-rw-r--r--usr.sbin/httpd/src/os/mpeix/os-inline.c1
-rw-r--r--usr.sbin/httpd/src/os/mpeix/os.c1
-rw-r--r--usr.sbin/httpd/src/os/mpeix/os.h147
-rw-r--r--usr.sbin/httpd/src/os/netware/Apache.def4
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheCore.imp347
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheCoreNW.def4
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleAuthAnon.def2
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleCERNMeta.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleDigest.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleExpires.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleHeaders.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleInfo.def2
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleProxy.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleRewrite.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleSpeling.def2
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleStatus.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/ApacheModuleUserTrack.def1
-rw-r--r--usr.sbin/httpd/src/os/netware/getopt.c161
-rw-r--r--usr.sbin/httpd/src/os/netware/getopt.h10
-rw-r--r--usr.sbin/httpd/src/os/netware/main_nlm.c10
-rw-r--r--usr.sbin/httpd/src/os/netware/mod_nlm.c148
-rw-r--r--usr.sbin/httpd/src/os/netware/modules.c70
-rw-r--r--usr.sbin/httpd/src/os/netware/multithread.c102
-rw-r--r--usr.sbin/httpd/src/os/netware/os.c124
-rw-r--r--usr.sbin/httpd/src/os/netware/os.h143
-rw-r--r--usr.sbin/httpd/src/os/netware/precomp.h11
-rw-r--r--usr.sbin/httpd/src/os/netware/test_char.h21
-rw-r--r--usr.sbin/httpd/src/os/netware/uri_delims.h16
-rw-r--r--usr.sbin/httpd/src/os/os390/Makefile.tmpl72
-rw-r--r--usr.sbin/httpd/src/os/os390/README.os39086
-rw-r--r--usr.sbin/httpd/src/os/os390/ebcdic.h6
-rw-r--r--usr.sbin/httpd/src/os/os390/os-inline.c31
-rw-r--r--usr.sbin/httpd/src/os/os390/os.c103
-rw-r--r--usr.sbin/httpd/src/os/os390/os.h40
-rw-r--r--usr.sbin/httpd/src/os/os390/xebcdic.sh202
51 files changed, 5416 insertions, 0 deletions
diff --git a/usr.sbin/httpd/htdocs/manual/misc/rewriteguide.html b/usr.sbin/httpd/htdocs/manual/misc/rewriteguide.html
new file mode 100644
index 00000000000..12363e9f146
--- /dev/null
+++ b/usr.sbin/httpd/htdocs/manual/misc/rewriteguide.html
@@ -0,0 +1,1919 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML><HEAD>
+<TITLE>Apache 1.3 URL Rewriting Guide</TITLE>
+</HEAD>
+
+<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+<BODY
+ BGCOLOR="#FFFFFF"
+ TEXT="#000000"
+ LINK="#0000FF"
+ VLINK="#000080"
+ ALINK="#FF0000"
+>
+<BLOCKQUOTE>
+<DIV ALIGN="CENTER">
+ <IMG SRC="../images/sub.gif" ALT="[APACHE DOCUMENTATION]">
+ <H3>
+ Apache HTTP Server Version 1.3
+ </H3>
+</DIV>
+
+
+<DIV ALIGN=CENTER>
+
+<H1>
+Apache 1.3<BR>
+URL Rewriting Guide<BR>
+</H1>
+
+<ADDRESS>Originally written by<BR>
+Ralf S. Engelschall &lt;rse@apache.org&gt<BR>
+December 1997</ADDRESS>
+
+</DIV>
+
+<P>
+This document supplements the mod_rewrite <a
+href="../mod/mod_rewrite.html">reference documentation</a>. It describes
+how one can use Apache's mod_rewrite to solve typical URL-based problems
+webmasters are usually confronted with in practice. I give detailed
+descriptions on how to solve each problem by configuring URL rewriting
+rulesets.
+
+<H2><a name="ToC1">Introduction to mod_rewrite</a></H2>
+
+The Apache module mod_rewrite is a killer one, i.e. it is a really
+sophisticated module which provides a powerful way to do URL manipulations.
+With it you can nearly do all types of URL manipulations you ever dreamed
+about. The price you have to pay is to accept complexity, because
+mod_rewrite's major drawback is that it is not easy to understand and use for
+the beginner. And even Apache experts sometimes discover new aspects where
+mod_rewrite can help.
+<P>
+In other words: With mod_rewrite you either shoot yourself in the foot the
+first time and never use it again or love it for the rest of your life because
+of its power. This paper tries to give you a few initial success events to
+avoid the first case by presenting already invented solutions to you.
+
+<H2><a name="ToC2">Practical Solutions</a></H2>
+
+Here come a lot of practical solutions I've either invented myself or
+collected from other peoples solutions in the past. Feel free to learn the
+black magic of URL rewriting from these examples.
+
+<P>
+ATTENTION: Depending on your server-configuration it can be necessary to
+slightly change the examples for your situation, e.g. adding the [PT] flag
+when additionally using mod_alias and mod_userdir, etc. Or rewriting a ruleset
+to fit in <tt>.htaccess</tt> context instead of per-server context. Always try
+to understand what a particular ruleset really does before you use it. It
+avoid problems.
+
+<H1>URL Layout</H1>
+
+<P>
+<H2>Canonical URLs</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+On some webservers there are more than one URL for a resource. Usually there
+are canonical URLs (which should be actually used and distributed) and those
+which are just shortcuts, internal ones, etc. Independed which URL the user
+supplied with the request he should finally see the canonical one only.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We do an external HTTP redirect for all non-canonical URLs to fix them in the
+location view of the Browser and for all subsequent requests. In the example
+ruleset below we replace <tt>/~user</tt> by the canonical <tt>/u/user</tt> and
+fix a missing trailing slash for <tt>/u/user</tt>.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^/<b>~</b>([^/]+)/?(.*) /<b>u</b>/$1/$2 [<b>R</b>]
+RewriteRule ^/([uge])/(<b>[^/]+</b>)$ /$1/$2<b>/</b> [<b>R</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Canonical Hostnames</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+...
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC]
+RewriteCond %{HTTP_HOST} !^$
+RewriteCond %{SERVER_PORT} !^80$
+RewriteRule ^/(.*) http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]
+RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC]
+RewriteCond %{HTTP_HOST} !^$
+RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Moved DocumentRoot</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Usually the DocumentRoot of the webserver directly relates to the URL
+``<tt>/</tt>''. But often this data is not really of top-level priority, it is
+perhaps just one entity of a lot of data pools. For instance at our Intranet
+sites there are <tt>/e/www/</tt> (the homepage for WWW), <tt>/e/sww/</tt> (the
+homepage for the Intranet) etc. Now because the data of the DocumentRoot stays
+at <tt>/e/www/</tt> we had to make sure that all inlined images and other
+stuff inside this data pool work for subsequent requests.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We just redirect the URL <tt>/</tt> to <tt>/e/www/</tt>. While is seems
+trivial it is actually trivial with mod_rewrite, only. Because the typical
+old mechanisms of URL <i>Aliases</i> (as provides by mod_alias and friends)
+only used <i>prefix</i> matching. With this you cannot do such a redirection
+because the DocumentRoot is a prefix of all URLs. With mod_rewrite it is
+really trivial:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteRule <b>^/$</b> /e/www/ [<b>R</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Trailing Slash Problem</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Every webmaster can sing a song about the problem of the trailing slash on
+URLs referencing directories. If they are missing, the server dumps an error,
+because if you say <tt>/~quux/foo</tt> instead of
+<tt>/~quux/foo/</tt> then the server searches for a <i>file</i> named
+<tt>foo</tt>. And because this file is a directory it complains. Actually
+is tries to fix it themself in most of the cases, but sometimes this mechanism
+need to be emulated by you. For instance after you have done a lot of
+complicated URL rewritings to CGI scripts etc.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+The solution to this subtle problem is to let the server add the trailing
+slash automatically. To do this correctly we have to use an external redirect,
+so the browser correctly requests subsequent images etc. If we only did a
+internal rewrite, this would only work for the directory page, but would go
+wrong when any images are included into this page with relative URLs, because
+the browser would request an in-lined object. For instance, a request for
+<tt>image.gif</tt> in <tt>/~quux/foo/index.html</tt> would become
+<tt>/~quux/image.gif</tt> without the external redirect!
+<P>
+So, to do this trick we write:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^foo<b>$</b> foo<b>/</b> [<b>R</b>]
+</PRE></TD></TR></TABLE>
+
+<P>
+The crazy and lazy can even do the following in the top-level
+<tt>.htaccess</tt> file of their homedir. But notice that this creates some
+processing overhead.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteCond %{REQUEST_FILENAME} <b>-d</b>
+RewriteRule ^(.+<b>[^/]</b>)$ $1<b>/</b> [R]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Webcluster through Homogeneous URL Layout</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+We want to create a homogenous and consistent URL layout over all WWW servers
+on a Intranet webcluster, i.e. all URLs (per definition server local and thus
+server dependent!) become actually server <i>independed</i>! What we want is
+to give the WWW namespace a consistent server-independend layout: no URL
+should have to include any physically correct target server. The cluster
+itself should drive us automatically to the physical target host.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+First, the knowledge of the target servers come from (distributed) external
+maps which contain information where our users, groups and entities stay.
+The have the form
+
+<P><PRE>
+user1 server_of_user1
+user2 server_of_user2
+: :
+</PRE><P>
+
+We put them into files <tt>map.xxx-to-host</tt>. Second we need to instruct
+all servers to redirect URLs of the forms
+
+<P><PRE>
+/u/user/anypath
+/g/group/anypath
+/e/entity/anypath
+</PRE><P>
+
+to
+
+<P><PRE>
+http://physical-host/u/user/anypath
+http://physical-host/g/group/anypath
+http://physical-host/e/entity/anypath
+</PRE><P>
+
+when the URL is not locally valid to a server. The following ruleset does
+this for us by the help of the map files (assuming that server0 is a default
+server which will be used if a user has no entry in the map):
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+
+RewriteMap user-to-host txt:/path/to/map.user-to-host
+RewriteMap group-to-host txt:/path/to/map.group-to-host
+RewriteMap entity-to-host txt:/path/to/map.entity-to-host
+
+RewriteRule ^/u/<b>([^/]+)</b>/?(.*) http://<b>${user-to-host:$1|server0}</b>/u/$1/$2
+RewriteRule ^/g/<b>([^/]+)</b>/?(.*) http://<b>${group-to-host:$1|server0}</b>/g/$1/$2
+RewriteRule ^/e/<b>([^/]+)</b>/?(.*) http://<b>${entity-to-host:$1|server0}</b>/e/$1/$2
+
+RewriteRule ^/([uge])/([^/]+)/?$ /$1/$2/.www/
+RewriteRule ^/([uge])/([^/]+)/([^.]+.+) /$1/$2/.www/$3\
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Move Homedirs to Different Webserver</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+A lot of webmaster aksed for a solution to the following situation: They
+wanted to redirect just all homedirs on a webserver to another webserver.
+They usually need such things when establishing a newer webserver which will
+replace the old one over time.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+The solution is trivial with mod_rewrite. On the old webserver we just
+redirect all <tt>/~user/anypath</tt> URLs to
+<tt>http://newserver/~user/anypath</tt>.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteRule ^/~(.+) http://<b>newserver</b>/~$1 [R,L]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Structured Homedirs</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Some sites with thousend of users usually use a structured homedir layout,
+i.e. each homedir is in a subdirectory which begins for instance with the
+first character of the username. So, <tt>/~foo/anypath</tt> is
+<tt>/home/<b>f</b>/foo/.www/anypath</tt> while <tt>/~bar/anypath</tt> is
+<tt>/home/<b>b</b>/bar/.www/anypath</tt>.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We use the following ruleset to expand the tilde URLs into exactly the above
+layout.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteRule ^/~(<b>([a-z])</b>[a-z0-9]+)(.*) /home/<b>$2</b>/$1/.www$3
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Filesystem Reorganisation</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+This really is a hardcore example: a killer application which heavily uses
+per-directory <tt>RewriteRules</tt> to get a smooth look and feel on the Web
+while its data structure is never touched or adjusted.
+
+Background: <b><i>net.sw</i></b> is my archive of freely available Unix
+software packages, which I started to collect in 1992. It is both my hobby and
+job to to this, because while I'm studying computer science I have also worked
+for many years as a system and network administrator in my spare time. Every
+week I need some sort of software so I created a deep hierarchy of
+directories where I stored the packages:
+
+<P><PRE>
+drwxrwxr-x 2 netsw users 512 Aug 3 18:39 Audio/
+drwxrwxr-x 2 netsw users 512 Jul 9 14:37 Benchmark/
+drwxrwxr-x 12 netsw users 512 Jul 9 00:34 Crypto/
+drwxrwxr-x 5 netsw users 512 Jul 9 00:41 Database/
+drwxrwxr-x 4 netsw users 512 Jul 30 19:25 Dicts/
+drwxrwxr-x 10 netsw users 512 Jul 9 01:54 Graphic/
+drwxrwxr-x 5 netsw users 512 Jul 9 01:58 Hackers/
+drwxrwxr-x 8 netsw users 512 Jul 9 03:19 InfoSys/
+drwxrwxr-x 3 netsw users 512 Jul 9 03:21 Math/
+drwxrwxr-x 3 netsw users 512 Jul 9 03:24 Misc/
+drwxrwxr-x 9 netsw users 512 Aug 1 16:33 Network/
+drwxrwxr-x 2 netsw users 512 Jul 9 05:53 Office/
+drwxrwxr-x 7 netsw users 512 Jul 9 09:24 SoftEng/
+drwxrwxr-x 7 netsw users 512 Jul 9 12:17 System/
+drwxrwxr-x 12 netsw users 512 Aug 3 20:15 Typesetting/
+drwxrwxr-x 10 netsw users 512 Jul 9 14:08 X11/
+</PRE><P>
+
+In July 1996 I decided to make this 350 MB archive public to the world via a
+nice Web interface (<a href="http://net.sw.engelschall.com/net.sw/"><tt>
+http://net.sw.engelschall.com/net.sw/</tt></a>). "Nice" means that I wanted to
+offer a interface where you can browse directly through the archive hierarchy.
+And "nice" means that I didn't wanted to change anything inside this hierarchy
+- not even by putting some CGI scripts at the top of it. Why? Because the
+above structure should be later accessible via FTP as well, and I didn't
+want any Web or CGI stuuf to be there.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+The solution has two parts: The first is a set of CGI scripts which create all
+the pages at all directory levels on-the-fly. I put them under
+<tt>/e/netsw/.www/</tt> as follows:
+
+<P><PRE>
+-rw-r--r-- 1 netsw users 1318 Aug 1 18:10 .wwwacl
+drwxr-xr-x 18 netsw users 512 Aug 5 15:51 DATA/
+-rw-rw-rw- 1 netsw users 372982 Aug 5 16:35 LOGFILE
+-rw-r--r-- 1 netsw users 659 Aug 4 09:27 TODO
+-rw-r--r-- 1 netsw users 5697 Aug 1 18:01 netsw-about.html
+-rwxr-xr-x 1 netsw users 579 Aug 2 10:33 netsw-access.pl
+-rwxr-xr-x 1 netsw users 1532 Aug 1 17:35 netsw-changes.cgi
+-rwxr-xr-x 1 netsw users 2866 Aug 5 14:49 netsw-home.cgi
+drwxr-xr-x 2 netsw users 512 Jul 8 23:47 netsw-img/
+-rwxr-xr-x 1 netsw users 24050 Aug 5 15:49 netsw-lsdir.cgi
+-rwxr-xr-x 1 netsw users 1589 Aug 3 18:43 netsw-search.cgi
+-rwxr-xr-x 1 netsw users 1885 Aug 1 17:41 netsw-tree.cgi
+-rw-r--r-- 1 netsw users 234 Jul 30 16:35 netsw-unlimit.lst
+</PRE><P>
+
+The <tt>DATA/</tt> subdirectory holds the above directory structure, i.e. the
+real <b><i>net.sw</i></b> stuff and gets automatically updated via
+<tt>rdist</tt> from time to time.
+
+ The second part of the problem remains: how to link these two structures
+together into one smooth-looking URL tree? We want to hide the <tt>DATA/</tt>
+directory from the user while running the appropriate CGI scripts for the
+various URLs.
+
+Here is the solution: first I put the following into the per-directory
+configuration file in the Document Root of the server to rewrite the announced
+URL <tt>/net.sw/</tt> to the internal path <tt>/e/netsw</tt>:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^net.sw$ net.sw/ [R]
+RewriteRule ^net.sw/(.*)$ e/netsw/$1
+</PRE></TD></TR></TABLE>
+
+<P>
+The first rule is for requests which miss the trailing slash! The second rule
+does the real thing. And then comes the killer configuration which stays in
+the per-directory config file <tt>/e/netsw/.www/.wwwacl</tt>:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+Options ExecCGI FollowSymLinks Includes MultiViews
+
+RewriteEngine on
+
+# we are reached via /net.sw/ prefix
+RewriteBase /net.sw/
+
+# first we rewrite the root dir to
+# the handling cgi script
+RewriteRule ^$ netsw-home.cgi [L]
+RewriteRule ^index\.html$ netsw-home.cgi [L]
+
+# strip out the subdirs when
+# the browser requests us from perdir pages
+RewriteRule ^.+/(netsw-[^/]+/.+)$ $1 [L]
+
+# and now break the rewriting for local files
+RewriteRule ^netsw-home\.cgi.* - [L]
+RewriteRule ^netsw-changes\.cgi.* - [L]
+RewriteRule ^netsw-search\.cgi.* - [L]
+RewriteRule ^netsw-tree\.cgi$ - [L]
+RewriteRule ^netsw-about\.html$ - [L]
+RewriteRule ^netsw-img/.*$ - [L]
+
+# anything else is a subdir which gets handled
+# by another cgi script
+RewriteRule !^netsw-lsdir\.cgi.* - [C]
+RewriteRule (.*) netsw-lsdir.cgi/$1
+</PRE></TD></TR></TABLE>
+
+<P>
+Some hints for interpretation:
+ <ol>
+ <li> Notice the L (last) flag and no substitution field ('-') in the
+ forth part
+ <li> Notice the ! (not) character and the C (chain) flag
+ at the first rule in the last part
+ <li> Notice the catch-all pattern in the last rule
+ </ol>
+
+</DL>
+
+<P>
+<H2>NCSA imagemap to Apache mod_imap</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+When switching from the NCSA webserver to the more modern Apache webserver a
+lot of people want a smooth transition. So they want pages which use their old
+NCSA <tt>imagemap</tt> program to work under Apache with the modern
+<tt>mod_imap</tt>. The problem is that there are a lot of
+hyperlinks around which reference the <tt>imagemap</tt> program via
+<tt>/cgi-bin/imagemap/path/to/page.map</tt>. Under Apache this
+has to read just <tt>/path/to/page.map</tt>.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We use a global rule to remove the prefix on-the-fly for all requests:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteRule ^/cgi-bin/imagemap(.*) $1 [PT]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Search pages in more than one directory</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Sometimes it is neccessary to let the webserver search for pages in more than
+one directory. Here MultiViews or other techniques cannot help.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We program a explicit ruleset which searches for the files in the directories.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+
+# first try to find it in custom/...
+# ...and if found stop and be happy:
+RewriteCond /your/docroot/<b>dir1</b>/%{REQUEST_FILENAME} -f
+RewriteRule ^(.+) /your/docroot/<b>dir1</b>/$1 [L]
+
+# second try to find it in pub/...
+# ...and if found stop and be happy:
+RewriteCond /your/docroot/<b>dir2</b>/%{REQUEST_FILENAME} -f
+RewriteRule ^(.+) /your/docroot/<b>dir2</b>/$1 [L]
+
+# else go on for other Alias or ScriptAlias directives,
+# etc.
+RewriteRule ^(.+) - [PT]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Set Environment Variables According To URL Parts</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Perhaps you want to keep status information between requests and use the URL
+to encode it. But you don't want to use a CGI wrapper for all pages just to
+strip out this information.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We use a rewrite rule to strip out the status information and remember it via
+an environment variable which can be later dereferenced from within XSSI or
+CGI. This way a URL <tt>/foo/S=java/bar/</tt> gets translated to
+<tt>/foo/bar/</tt> and the environment variable named <tt>STATUS</tt> is set
+to the value "java".
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteRule ^(.*)/<b>S=([^/]+)</b>/(.*) $1/$3 [E=<b>STATUS:$2</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Virtual User Hosts</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Assume that you want to provide <tt>www.<b>username</b>.host.domain.com</tt>
+for the homepage of username via just DNS A records to the same machine and
+without any virtualhosts on this machine.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which
+contain a Host: HTTP header we can use the following ruleset to rewrite
+<tt>http://www.username.host.com/anypath</tt> internally to
+<tt>/home/username/anypath</tt>:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond %{<b>HTTP_HOST</b>} ^www\.<b>[^.]+</b>\.host\.com$
+RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
+RewriteRule ^www\.<b>([^.]+)</b>\.host\.com(.*) /home/<b>$1</b>$2
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Redirect Homedirs For Foreigners</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+We want to redirect homedir URLs to another webserver
+<tt>www.somewhere.com</tt> when the requesting user does not stay in the local
+domain <tt>ourdomain.com</tt>. This is sometimes used in virtual host
+contexts.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+Just a rewrite condition:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond %{REMOTE_HOST} <b>!^.+\.ourdomain\.com$</b>
+RewriteRule ^(/~.+) http://www.somewhere.com/$1 [R,L]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Redirect Failing URLs To Other Webserver</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+A typical FAQ about URL rewriting is how to redirect failing requests on
+webserver A to webserver B. Usually this is done via ErrorDocument
+CGI-scripts in Perl, but there is also a mod_rewrite solution. But notice that
+this is less performant than using a ErrorDocument CGI-script!
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+The first solution has the best performance but less flexibility and is less
+error safe:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond /your/docroot/%{REQUEST_FILENAME} <b>!-f</b>
+RewriteRule ^(.+) http://<b>webserverB</b>.dom/$1
+</PRE></TD></TR></TABLE>
+
+<P>
+The problem here is that this will only work for pages inside the
+DocumentRoot. While you can add more Conditions (for instance to also handle
+homedirs, etc.) there is better variant:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond %{REQUEST_URI} <b>!-U</b>
+RewriteRule ^(.+) http://<b>webserverB</b>.dom/$1
+</PRE></TD></TR></TABLE>
+
+<P>
+This uses the URL look-ahead feature of mod_rewrite. The result is that this
+will work for all types of URLs and is a safe way. But it does a performance
+impact on the webserver, because for every request there is one more internal
+subrequest. So, if your webserver runs on a powerful CPU, use this one. If it
+is a slow machine, use the first approach or better a ErrorDocument
+CGI-script.
+
+</DL>
+
+<P>
+<H2>Extended Redirection</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Sometimes we need more control (concerning the character escaping mechanism)
+of URLs on redirects. Usually the Apache kernels URL escape function also
+escapes anchors, i.e. URLs like "url#anchor". You cannot use this directly on
+redirects with mod_rewrite because the uri_escape() function of Apache would
+also escape the hash character. How can we redirect to such a URL?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We have to use a kludge by the use of a NPH-CGI script which does the redirect
+itself. Because here no escaping is done (NPH=non-parseable headers). First
+we introduce a new URL scheme <tt>xredirect:</tt> by the following per-server
+config-line (should be one of the last rewrite rules):
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \
+ [T=application/x-httpd-cgi,L]
+</PRE></TD></TR></TABLE>
+
+<P>
+This forces all URLs prefixed with <tt>xredirect:</tt> to be piped through the
+<tt>nph-xredirect.cgi</tt> program. And this program just looks like:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+<PRE>
+#!/path/to/perl
+##
+## nph-xredirect.cgi -- NPH/CGI script for extended redirects
+## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
+##
+
+$| = 1;
+$url = $ENV{'PATH_INFO'};
+
+print "HTTP/1.0 302 Moved Temporarily\n";
+print "Server: $ENV{'SERVER_SOFTWARE'}\n";
+print "Location: $url\n";
+print "Content-type: text/html\n";
+print "\n";
+print "&lt;html&gt;\n";
+print "&lt;head&gt;\n";
+print "&lt;title&gt;302 Moved Temporarily (EXTENDED)&lt;/title&gt;\n";
+print "&lt;/head&gt;\n";
+print "&lt;body&gt;\n";
+print "&lt;h1&gt;Moved Temporarily (EXTENDED)&lt;/h1&gt;\n";
+print "The document has moved &lt;a href=\"$url\"&gt;here&lt;/a&gt;.&lt;p&gt;\n";
+print "&lt;/body&gt;\n";
+print "&lt;/html&gt;\n";
+
+##EOF##
+</PRE>
+</PRE></TD></TR></TABLE>
+
+<P>
+This provides you with the functionality to do redirects to all URL schemes,
+i.e. including the one which are not directly accepted by mod_rewrite. For
+instance you can now also redirect to <tt>news:newsgroup</tt> via
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^anyurl xredirect:news:newsgroup
+</PRE></TD></TR></TABLE>
+
+<P>
+Notice: You have not to put [R] or [R,L] to the above rule because the
+<tt>xredirect:</tt> need to be expanded later by our special "pipe through"
+rule above.
+
+</DL>
+
+<P>
+<H2>Archive Access Multiplexer</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Do you know the great CPAN (Comprehensive Perl Archive Network) under <a
+href="http://www.perl.com/CPAN">http://www.perl.com/CPAN</a>? This does a
+redirect to one of several FTP servers around the world which carry a CPAN
+mirror and is approximately near the location of the requesting client.
+Actually this can be called an FTP access multiplexing service. While CPAN
+runs via CGI scripts, how can a similar approach implemented via mod_rewrite?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+First we notice that from version 3.0.0 mod_rewrite can also use the "ftp:"
+scheme on redirects. And second, the location approximation can be done by a
+rewritemap over the top-level domain of the client. With a tricky chained
+ruleset we can use this top-level domain as a key to our multiplexing map.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteMap multiplex txt:/path/to/map.cxan
+RewriteRule ^/CxAN/(.*) %{REMOTE_HOST}::$1 [C]
+RewriteRule ^.+\.<b>([a-zA-Z]+)</b>::(.*)$ ${multiplex:<b>$1</b>|ftp.default.dom}$2 [R,L]
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## map.cxan -- Multiplexing Map for CxAN
+##
+
+de ftp://ftp.cxan.de/CxAN/
+uk ftp://ftp.cxan.uk/CxAN/
+com ftp://ftp.cxan.com/CxAN/
+ :
+##EOF##
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Time-Dependend Rewriting</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+When tricks like time-dependend content should happen a lot of webmasters
+still use CGI scripts which do for instance redirects to specialized pages.
+How can it be done via mod_rewrite?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+There are a lot of variables named <tt>TIME_xxx</tt> for rewrite conditions.
+In conjunction with the special lexicographic comparison patterns &lt;STRING,
+&gt;STRING and =STRING we can do time-dependend redirects:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond %{TIME_HOUR}%{TIME_MIN} &gt;0700
+RewriteCond %{TIME_HOUR}%{TIME_MIN} &lt;1900
+RewriteRule ^foo\.html$ foo.day.html
+RewriteRule ^foo\.html$ foo.night.html
+</PRE></TD></TR></TABLE>
+
+<P>
+This provides the content of <tt>foo.day.html</tt> under the URL
+<tt>foo.html</tt> from 07:00-19:00 and at the remaining time the contents of
+<tt>foo.night.html</tt>. Just a nice feature for a homepage...
+
+</DL>
+
+<P>
+<H2>Backward Compatibility for YYYY to XXXX migration</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we make URLs backward compatible (still existing virtually) after
+migrating document.YYYY to document.XXXX, e.g. after translating a bunch of
+.html files to .phtml?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We just rewrite the name to its basename and test for existence of the new
+extension. If it exists, we take that name, else we rewrite the URL to its
+original state.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+# backward compatibility ruleset for
+# rewriting document.html to document.phtml
+# when and only when document.phtml exists
+# but no longer document.html
+RewriteEngine on
+RewriteBase /~quux/
+# parse out basename, but remember the fact
+RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
+# rewrite to document.phtml if exists
+RewriteCond %{REQUEST_FILENAME}.phtml -f
+RewriteRule ^(.*)$ $1.phtml [S=1]
+# else reverse the previous basename cutout
+RewriteCond %{ENV:WasHTML} ^yes$
+RewriteRule ^(.*)$ $1.html
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<H1>Content Handling</H1>
+
+<P>
+<H2>From Old to New (intern)</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Assume we have recently renamed the page <tt>bar.html</tt> to
+<tt>foo.html</tt> and now want to provide the old URL for backward
+compatibility. Actually we want that users of the old URL even not recognize
+that the pages was renamed.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We rewrite the old URL to the new one internally via the following rule:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^<b>foo</b>\.html$ <b>bar</b>.html
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>From Old to New (extern)</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Assume again that we have recently renamed the page <tt>bar.html</tt> to
+<tt>foo.html</tt> and now want to provide the old URL for backward
+compatibility. But this time we want that the users of the old URL get hinted
+to the new one, i.e. their browsers Location field should change, too.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We force a HTTP redirect to the new URL which leads to a change of the
+browsers and thus the users view:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^<b>foo</b>\.html$ <b>bar</b>.html [<b>R</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Browser Dependend Content</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+At least for important top-level pages it is sometimes necesarry to provide
+the optimum of browser dependend content, i.e. one has to provide a maximum
+version for the latest Netscape variants, a minimum version for the Lynx
+browsers and a average feature version for all others.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We cannot use content negotiation because the browsers do not provide their
+type in that form. Instead we have to act on the HTTP header "User-Agent".
+The following condig does the following: If the HTTP header "User-Agent"
+begins with "Mozilla/3", the page <tt>foo.html</tt> is rewritten to
+<tt>foo.NS.html</tt> and and the rewriting stops. If the browser is "Lynx" or
+"Mozilla" of version 1 or 2 the URL becomes <tt>foo.20.html</tt>. All other
+browsers receive page <tt>foo.32.html</tt>. This is done by the following
+ruleset:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{HTTP_USER_AGENT} ^<b>Mozilla/3</b>.*
+RewriteRule ^foo\.html$ foo.<b>NS</b>.html [<b>L</b>]
+
+RewriteCond %{HTTP_USER_AGENT} ^<b>Lynx/</b>.* [OR]
+RewriteCond %{HTTP_USER_AGENT} ^<b>Mozilla/[12]</b>.*
+RewriteRule ^foo\.html$ foo.<b>20</b>.html [<b>L</b>]
+
+RewriteRule ^foo\.html$ foo.<b>32</b>.html [<b>L</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Dynamic Mirror</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Assume there are nice webpages on remote hosts we want to bring into our
+namespace. For FTP servers we would use the <tt>mirror</tt> program which
+actually maintains an explicit up-to-date copy of the remote data on the local
+machine. For a webserver we could use the program <tt>webcopy</tt> which acts
+similar via HTTP. But both techniques have one major drawback: The local copy
+is always just as up-to-date as often we run the program. It would be much
+better if the mirror is not a static one we have to establish explicitly.
+Instead we want a dynamic mirror with data which gets updated automatically
+when there is need (updated data on the remote host).
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+To provide this feature we map the remote webpage or even the complete remote
+webarea to our namespace by the use of the <I>Proxy Throughput</I> feature
+(flag [P]):
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^<b>hotsheet/</b>(.*)$ <b>http://www.tstimpreso.com/hotsheet/</b>$1 [<b>P</b>]
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^<b>usa-news\.html</b>$ <b>http://www.quux-corp.com/news/index.html</b> [<b>P</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Reverse Dynamic Mirror</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+...
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteCond /mirror/of/remotesite/$1 -U
+RewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Retrieve Missing Data from Intranet</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+This is a tricky way of virtually running a corporates (external) Internet
+webserver (<tt>www.quux-corp.dom</tt>), while actually keeping and maintaining
+its data on a (internal) Intranet webserver
+(<tt>www2.quux-corp.dom</tt>) which is protected by a firewall. The
+trick is that on the external webserver we retrieve the requested data
+on-the-fly from the internal one.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+First, we have to make sure that our firewall still protects the internal
+webserver and that only the external webserver is allowed to retrieve data
+from it. For a packet-filtering firewall we could for instance configure a
+firewall ruleset like the following:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+<b>ALLOW</b> Host www.quux-corp.dom Port &gt;1024 --&gt; Host www2.quux-corp.dom Port <b>80</b>
+<b>DENY</b> Host * Port * --&gt; Host www2.quux-corp.dom Port <b>80</b>
+</PRE></TD></TR></TABLE>
+
+<P>
+Just adjust it to your actual configuration syntax. Now we can establish the
+mod_rewrite rules which request the missing data in the background through the
+proxy throughput feature:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2
+RewriteCond %{REQUEST_FILENAME} <b>!-f</b>
+RewriteCond %{REQUEST_FILENAME} <b>!-d</b>
+RewriteRule ^/home/([^/]+)/.www/?(.*) http://<b>www2</b>.quux-corp.dom/~$1/pub/$2 [<b>P</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Load Balancing</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Suppose we want to load balance the traffic to <tt>www.foo.com</tt> over
+<tt>www[0-5].foo.com</tt> (a total of 6 servers). How can this be done?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+There are a lot of possible solutions for this problem. We will discuss first
+a commonly known DNS-based variant and then the special one with mod_rewrite:
+
+<ol>
+<li><b>DNS Round-Robin</b>
+
+<P>
+The simplest method for load-balancing is to use the DNS round-robin feature
+of BIND. Here you just configure <tt>www[0-9].foo.com</tt> as usual in your
+DNS with A(address) records, e.g.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+www0 IN A 1.2.3.1
+www1 IN A 1.2.3.2
+www2 IN A 1.2.3.3
+www3 IN A 1.2.3.4
+www4 IN A 1.2.3.5
+www5 IN A 1.2.3.6
+</PRE></TD></TR></TABLE>
+
+<P>
+Then you additionally add the following entry:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+www IN CNAME www0.foo.com.
+ IN CNAME www1.foo.com.
+ IN CNAME www2.foo.com.
+ IN CNAME www3.foo.com.
+ IN CNAME www4.foo.com.
+ IN CNAME www5.foo.com.
+ IN CNAME www6.foo.com.
+</PRE></TD></TR></TABLE>
+
+<P>
+Notice that this seems wrong, but is actually an intended feature of BIND and
+can be used in this way. However, now when <tt>www.foo.com</tt> gets resolved,
+BIND gives out <tt>www0-www6</tt> - but in a slightly permutated/rotated order
+every time. This way the clients are spread over the various servers.
+
+But notice that this not a perfect load balancing scheme, because DNS resolve
+information gets cached by the other nameservers on the net, so once a client
+has resolved <tt>www.foo.com</tt> to a particular <tt>wwwN.foo.com</tt>, all
+subsequent requests also go to this particular name <tt>wwwN.foo.com</tt>. But
+the final result is ok, because the total sum of the requests are really
+spread over the various webservers.
+
+<P>
+<li><b>DNS Load-Balancing</b>
+
+<P>
+A sophisticated DNS-based method for load-balancing is to use the program
+<tt>lbnamed</tt> which can be found at <a
+href="http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html">http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html</a>.
+It is a Perl 5 program in conjunction with auxilliary tools which provides a
+real load-balancing for DNS.
+
+<P>
+<li><b>Proxy Throughput Round-Robin</b>
+
+<P>
+In this variant we use mod_rewrite and its proxy throughput feature. First we
+dedicate <tt>www0.foo.com</tt> to be actually <tt>www.foo.com</tt> by using a
+single
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+www IN CNAME www0.foo.com.
+</PRE></TD></TR></TABLE>
+
+<P>
+entry in the DNS. Then we convert <tt>www0.foo.com</tt> to a proxy-only
+server, i.e. we configure this machine so all arriving URLs are just pushed
+through the internal proxy to one of the 5 other servers (<tt>www1-www5</tt>).
+To accomplish this we first establish a ruleset which contacts a load
+balancing script <tt>lb.pl</tt> for all URLs.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteMap lb prg:/path/to/lb.pl
+RewriteRule ^/(.+)$ ${lb:$1} [P,L]
+</PRE></TD></TR></TABLE>
+
+<P>
+Then we write <tt>lb.pl</tt>:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+#!/path/to/perl
+##
+## lb.pl -- load balancing script
+##
+
+$| = 1;
+
+$name = "www"; # the hostname base
+$first = 1; # the first server (not 0 here, because 0 is myself)
+$last = 5; # the last server in the round-robin
+$domain = "foo.dom"; # the domainname
+
+$cnt = 0;
+while (&lt;STDIN&gt;) {
+ $cnt = (($cnt+1) % ($last+1-$first));
+ $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
+ print "http://$server/$_";
+}
+
+##EOF##
+</PRE></TD></TR></TABLE>
+
+<P>
+A last notice: Why is this useful? Seems like <tt>www0.foo.com</tt> still is
+overloaded? The answer is yes, it is overloaded, but with plain proxy
+throughput requests, only! All SSI, CGI, ePerl, etc. processing is completely
+done on the other machines. This is the essential point.
+
+<P>
+<li><b>Hardware/TCP Round-Robin</b>
+
+<P>
+There is a hardware solution available, too. Cisco has a beast called
+LocalDirector which does a load balancing at the TCP/IP level. Actually this
+is some sort of a circuit level gateway in front of a webcluster. If you have
+enough money and really need a solution with high performance, use this one.
+
+</ol>
+
+</DL>
+
+<P>
+<H2>Reverse Proxy</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+...
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## apache-rproxy.conf -- Apache configuration for Reverse Proxy Usage
+##
+
+# server type
+ServerType standalone
+Port 8000
+MinSpareServers 16
+StartServers 16
+MaxSpareServers 16
+MaxClients 16
+MaxRequestsPerChild 100
+
+# server operation parameters
+KeepAlive on
+MaxKeepAliveRequests 100
+KeepAliveTimeout 15
+Timeout 400
+IdentityCheck off
+HostnameLookups off
+
+# paths to runtime files
+PidFile /path/to/apache-rproxy.pid
+LockFile /path/to/apache-rproxy.lock
+ErrorLog /path/to/apache-rproxy.elog
+CustomLog /path/to/apache-rproxy.dlog "%{%v/%T}t %h -&gt; %{SERVER}e URL: %U"
+
+# unused paths
+ServerRoot /tmp
+DocumentRoot /tmp
+CacheRoot /tmp
+RewriteLog /dev/null
+TransferLog /dev/null
+TypesConfig /dev/null
+AccessConfig /dev/null
+ResourceConfig /dev/null
+
+# speed up and secure processing
+&lt;Directory /&gt;
+Options -FollowSymLinks -SymLinksIfOwnerMatch
+AllowOverwrite None
+&lt;/Directory&gt;
+
+# the status page for monitoring the reverse proxy
+&lt;Location /rproxy-status&gt;
+SetHandler server-status
+&lt;/Location&gt;
+
+# enable the URL rewriting engine
+RewriteEngine on
+RewriteLogLevel 0
+
+# define a rewriting map with value-lists where
+# mod_rewrite randomly chooses a particular value
+RewriteMap server rnd:/path/to/apache-rproxy.conf-servers
+
+# make sure the status page is handled locally
+# and make sure no one uses our proxy except ourself
+RewriteRule ^/apache-rproxy-status.* - [L]
+RewriteRule ^(http|ftp)://.* - [F]
+
+# now choose the possible servers for particular URL types
+RewriteRule ^/(.*\.(cgi|shtml))$ to://${server:dynamic}/$1 [S=1]
+RewriteRule ^/(.*)$ to://${server:static}/$1
+
+# and delegate the generated URL by passing it
+# through the proxy module
+RewriteRule ^to://([^/]+)/(.*) http://$1/$2 [E=SERVER:$1,P,L]
+
+# and make really sure all other stuff is forbidden
+# when it should survive the above rules...
+RewriteRule .* - [F]
+
+# enable the Proxy module without caching
+ProxyRequests on
+NoCache *
+
+# setup URL reverse mapping for redirect reponses
+ProxyPassReverse / http://www1.foo.dom/
+ProxyPassReverse / http://www2.foo.dom/
+ProxyPassReverse / http://www3.foo.dom/
+ProxyPassReverse / http://www4.foo.dom/
+ProxyPassReverse / http://www5.foo.dom/
+ProxyPassReverse / http://www6.foo.dom/
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## apache-rproxy.conf-servers -- Apache/mod_rewrite selection table
+##
+
+# list of backend servers which serve static
+# pages (HTML files and Images, etc.)
+static www1.foo.dom|www2.foo.dom|www3.foo.dom|www4.foo.dom
+
+# list of backend servers which serve dynamically
+# generated page (CGI programs or mod_perl scripts)
+dynamic www5.foo.dom|www6.foo.dom
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>New MIME-type, New Service</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+On the net there are a lot of nifty CGI programs. But their usage is usually
+boring, so a lot of webmaster don't use them. Even Apache's Action handler
+feature for MIME-types is only appropriate when the CGI programs don't need
+special URLs (actually PATH_INFO and QUERY_STRINGS) as their input.
+
+First, let us configure a new file type with extension <tt>.scgi</tt>
+(for secure CGI) which will be processed by the popular <tt>cgiwrap</tt>
+program. The problem here is that for instance we use a Homogeneous URL Layout
+(see above) a file inside the user homedirs has the URL
+<tt>/u/user/foo/bar.scgi</tt>. But <tt>cgiwrap</tt> needs the URL in the form
+<tt>/~user/foo/bar.scgi/</tt>. The following rule solves the problem:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^/[uge]/<b>([^/]+)</b>/\.www/(.+)\.scgi(.*) ...
+... /internal/cgi/user/cgiwrap/~<b>$1</b>/$2.scgi$3 [NS,<b>T=application/x-http-cgi</b>]
+</PRE></TD></TR></TABLE>
+
+<P>
+Or assume we have some more nifty programs:
+<tt>wwwlog</tt> (which displays the <tt>access.log</tt> for a URL subtree and
+<tt>wwwidx</tt> (which runs Glimpse on a URL subtree). We have to
+provide the URL area to these programs so they know on which area
+they have to act on. But usually this ugly, because they are all the
+times still requested from that areas, i.e. typically we would run
+the <tt>swwidx</tt> program from within <tt>/u/user/foo/</tt> via
+hyperlink to
+
+<P><PRE>
+/internal/cgi/user/swwidx?i=/u/user/foo/
+</PRE><P>
+
+which is ugly. Because we have to hard-code <b>both</b> the location of the
+area <b>and</b> the location of the CGI inside the hyperlink. When we have to
+reorganise or area, we spend a lot of time changing the various hyperlinks.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+The solution here is to provide a special new URL format which automatically
+leads to the proper CGI invocation. We configure the following:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^/([uge])/([^/]+)(/?.*)/\* /internal/cgi/user/wwwidx?i=/$1/$2$3/
+RewriteRule ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
+</PRE></TD></TR></TABLE>
+
+<P>
+Now the hyperlink to search at <tt>/u/user/foo/</tt> reads only
+
+<P><PRE>
+href="*"
+</PRE><P>
+
+which internally gets automatically transformed to
+
+<P><PRE>
+/internal/cgi/user/wwwidx?i=/u/user/foo/
+</PRE><P>
+
+The same approach leads to an invocation for the access log CGI
+program when the hyperlink <tt>:log</tt> gets used.
+
+</DL>
+
+<P>
+<H2>From Static to Dynamic</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we transform a static page <tt>foo.html</tt> into a dynamic variant
+<tt>foo.cgi</tt> in a seemless way, i.e. without notice by the browser/user.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We just rewrite the URL to the CGI-script and force the correct MIME-type so
+it gets really run as a CGI-script. This way a request to
+<tt>/~quux/foo.html</tt> internally leads to the invokation of
+<tt>/~quux/foo.cgi</tt>.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteBase /~quux/
+RewriteRule ^foo\.<b>html</b>$ foo.<b>cgi</b> [T=<b>application/x-httpd-cgi</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>On-the-fly Content-Regeneration</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Here comes a really esoteric feature: Dynamically generated but statically
+served pages, i.e. pages should be delivered as pur static pages (read from
+the filesystem and just passed through), but they have to be generated
+dynamically by the webserver if missing. This way you can have CGI-generated
+pages which are statically unless one (or a cronjob) removes the static
+contents. Then the contents gets refreshed.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+This is done via the following ruleset:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{REQUEST_FILENAME} <b>!-s</b>
+RewriteCond ^page\.<b>html</b>$ page.<b>cgi</b> [T=application/x-httpd-cgi,L]
+</PRE></TD></TR></TABLE>
+
+<P>
+Here a request to <tt>page.html</tt> leads to a internal run of a
+corresponding <tt>page.cgi</tt> if <tt>page.html</tt> is still missing or has
+filesize null. The trick here is that <tt>page.cgi</tt> is a usual CGI script
+which (additionally to its STDOUT) writes its output to the file
+<tt>page.html</tt>. Once it was run, the server sends out the data of
+<tt>page.html</tt>. When the webmaster wants to force a refresh the contents,
+he just removes <tt>page.html</tt> (usually done by a cronjob).
+
+</DL>
+
+<P>
+<H2>Document With Autorefresh</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Wouldn't it be nice while creating a complex webpage if the webbrowser would
+automatically refresh the page every time we write a new version from within
+our editor? Impossible?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+No! We just combine the MIME multipart feature, the webserver NPH feature and
+the URL manipulation power of mod_rewrite. First, we establish a new URL
+feature: Adding just <tt>:refresh</tt> to any URL causes this to be refreshed
+every time it gets updated on the filesystem.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteRule ^(/[uge]/[^/]+/?.*):refresh /internal/cgi/apache/nph-refresh?f=$1
+</PRE></TD></TR></TABLE>
+
+<P>
+Now when we reference the URL
+
+<P><PRE>
+/u/foo/bar/page.html:refresh
+</PRE><P>
+
+this leads to the internal invocation of the URL
+
+<P><PRE>
+/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
+</PRE><P>
+
+The only missing part is the NPH-CGI script. Although one would usually say
+"left as an exercise to the reader" ;-) I will provide this, too.
+
+<P><PRE>
+#!/sw/bin/perl
+##
+## nph-refresh -- NPH/CGI script for auto refreshing pages
+## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
+##
+$| = 1;
+
+# split the QUERY_STRING variable
+@pairs = split(/&amp;/, $ENV{'QUERY_STRING'});
+foreach $pair (@pairs) {
+ ($name, $value) = split(/=/, $pair);
+ $name =~ tr/A-Z/a-z/;
+ $name = 'QS_' . $name;
+ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+ eval "\$$name = \"$value\"";
+}
+$QS_s = 1 if ($QS_s eq '');
+$QS_n = 3600 if ($QS_n eq '');
+if ($QS_f eq '') {
+ print "HTTP/1.0 200 OK\n";
+ print "Content-type: text/html\n\n";
+ print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: No file given\n";
+ exit(0);
+}
+if (! -f $QS_f) {
+ print "HTTP/1.0 200 OK\n";
+ print "Content-type: text/html\n\n";
+ print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: File $QS_f not found\n";
+ exit(0);
+}
+
+sub print_http_headers_multipart_begin {
+ print "HTTP/1.0 200 OK\n";
+ $bound = "ThisRandomString12345";
+ print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
+ &amp;print_http_headers_multipart_next;
+}
+
+sub print_http_headers_multipart_next {
+ print "\n--$bound\n";
+}
+
+sub print_http_headers_multipart_end {
+ print "\n--$bound--\n";
+}
+
+sub displayhtml {
+ local($buffer) = @_;
+ $len = length($buffer);
+ print "Content-type: text/html\n";
+ print "Content-length: $len\n\n";
+ print $buffer;
+}
+
+sub readfile {
+ local($file) = @_;
+ local(*FP, $size, $buffer, $bytes);
+ ($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
+ $size = sprintf("%d", $size);
+ open(FP, "&amp;lt;$file");
+ $bytes = sysread(FP, $buffer, $size);
+ close(FP);
+ return $buffer;
+}
+
+$buffer = &amp;readfile($QS_f);
+&amp;print_http_headers_multipart_begin;
+&amp;displayhtml($buffer);
+
+sub mystat {
+ local($file) = $_[0];
+ local($time);
+
+ ($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
+ return $mtime;
+}
+
+$mtimeL = &amp;mystat($QS_f);
+$mtime = $mtime;
+for ($n = 0; $n &amp;lt; $QS_n; $n++) {
+ while (1) {
+ $mtime = &amp;mystat($QS_f);
+ if ($mtime ne $mtimeL) {
+ $mtimeL = $mtime;
+ sleep(2);
+ $buffer = &amp;readfile($QS_f);
+ &amp;print_http_headers_multipart_next;
+ &amp;displayhtml($buffer);
+ sleep(5);
+ $mtimeL = &amp;mystat($QS_f);
+ last;
+ }
+ sleep($QS_s);
+ }
+}
+
+&amp;print_http_headers_multipart_end;
+
+exit(0);
+
+##EOF##
+</PRE>
+
+</DL>
+
+<P>
+<H2>Mass Virtual Hosting</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+The <tt>&lt;VirtualHost&gt;</tt> feature of Apache is nice and works great
+when you just have a few dozens virtual hosts. But when you are an ISP and
+have hundreds of virtual hosts to provide this feature is not the best choice.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+To provide this feature we map the remote webpage or even the complete remote
+webarea to our namespace by the use of the <I>Proxy Throughput</I> feature
+(flag [P]):
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## vhost.map
+##
+www.vhost1.dom:80 /path/to/docroot/vhost1
+www.vhost2.dom:80 /path/to/docroot/vhost2
+ :
+www.vhostN.dom:80 /path/to/docroot/vhostN
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## httpd.conf
+##
+ :
+# use the canonical hostname on redirects, etc.
+UseCanonicalName on
+
+ :
+# add the virtual host in front of the CLF-format
+CustomLog /path/to/access_log "%{VHOST}e %h %l %u %t \"%r\" %&gt;s %b"
+ :
+
+# enable the rewriting engine in the main server
+RewriteEngine on
+
+# define two maps: one for fixing the URL and one which defines
+# the available virtual hosts with their corresponding
+# DocumentRoot.
+RewriteMap lowercase int:tolower
+RewriteMap vhost txt:/path/to/vhost.map
+
+# Now do the actual virtual host mapping
+# via a huge and complicated single rule:
+#
+# 1. make sure we don't map for common locations
+RewriteCond %{REQUEST_URL} !^/commonurl1/.*
+RewriteCond %{REQUEST_URL} !^/commonurl2/.*
+ :
+RewriteCond %{REQUEST_URL} !^/commonurlN/.*
+#
+# 2. make sure we have a Host header, because
+# currently our approach only supports
+# virtual hosting through this header
+RewriteCond %{HTTP_HOST} !^$
+#
+# 3. lowercase the hostname
+RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$
+#
+# 4. lookup this hostname in vhost.map and
+# remember it only when it is a path
+# (and not "NONE" from above)
+RewriteCond ${vhost:%1} ^(/.*)$
+#
+# 5. finally we can map the URL to its docroot location
+# and remember the virtual host for logging puposes
+RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]
+ :
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<H1>Access Restriction</H1>
+
+<P>
+<H2>Blocking of Robots</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we block a really annoying robot from retrieving pages of a specific
+webarea? A <tt>/robots.txt</tt> file containing entries of the "Robot
+Exclusion Protocol" is typically not enough to get rid of such a robot.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We use a ruleset which forbids the URLs of the webarea
+<tt>/~quux/foo/arc/</tt> (perhaps a very deep directory indexed area where the
+robot traversal would create big server load). We have to make sure that we
+forbid access only to the particular robot, i.e. just forbidding the host
+where the robot runs is not enough. This would block users from this host,
+too. We accomplish this by also matching the User-Agent HTTP header
+information.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{HTTP_USER_AGENT} ^<b>NameOfBadRobot</b>.*
+RewriteCond %{REMOTE_ADDR} ^<b>123\.45\.67\.[8-9]</b>$
+RewriteRule ^<b>/~quux/foo/arc/</b>.+ - [<b>F</b>]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Blocked Inline-Images</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Assume we have under http://www.quux-corp.de/~quux/ some pages with inlined
+GIF graphics. These graphics are nice, so others directly incorporate them via
+hyperlinks to their pages. We don't like this practice because it adds useless
+traffic to our server.
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+While we cannot 100% protect the images from inclusion, we
+can at least restrict the cases where the browser sends
+a HTTP Referer header.
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{HTTP_REFERER} <b>!^$</b>
+RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
+RewriteRule <b>.*\.gif$</b> - [F]
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{HTTP_REFERER} !^$
+RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$
+RewriteRule <b>^inlined-in-foo\.gif$</b> - [F]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Host Deny</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we forbid a list of externally configured hosts from using our server?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+
+For Apache &gt;= 1.3b6:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteMap hosts-deny txt:/path/to/hosts.deny
+RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
+RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
+RewriteRule ^/.* - [F]
+</PRE></TD></TR></TABLE><P>
+
+For Apache &lt;= 1.3b6:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteMap hosts-deny txt:/path/to/hosts.deny
+RewriteRule ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1
+RewriteRule !^NOT-FOUND/.* - [F]
+RewriteRule ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1
+RewriteRule !^NOT-FOUND/.* - [F]
+RewriteRule ^NOT-FOUND/(.*)$ /$1
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## hosts.deny
+##
+## ATTENTION! This is a map, not a list, even when we treat it as such.
+## mod_rewrite parses it for key/value pairs, so at least a
+## dummy value "-" must be present for each entry.
+##
+
+193.102.180.41 -
+bsdti1.sdm.de -
+192.76.162.40 -
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Proxy Deny</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we forbid a certain host or even a user of a special host from using
+the Apache proxy?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We first have to make sure mod_rewrite is below(!) mod_proxy in the
+<tt>Configuration</tt> file when compiling the Apache webserver. This way it
+gets called _before_ mod_proxy. Then we configure the following for a
+host-dependend deny...
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{REMOTE_HOST} <b>^badhost\.mydomain\.com$</b>
+RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
+</PRE></TD></TR></TABLE>
+
+<P>...and this one for a user@host-dependend deny:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <b>^badguy@badhost\.mydomain\.com$</b>
+RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Special Authentication Variant</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+Sometimes a very special authentication is needed, for instance a
+authentication which checks for a set of explicitly configured users. Only
+these should receive access and without explicit prompting (which would occur
+when using the Basic Auth via mod_access).
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+We use a list of rewrite conditions to exclude all except our friends:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <b>!^friend1@client1.quux-corp\.com$</b>
+RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <b>!^friend2</b>@client2.quux-corp\.com$
+RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <b>!^friend3</b>@client3.quux-corp\.com$
+RewriteRule ^/~quux/only-for-friends/ - [F]
+</PRE></TD></TR></TABLE>
+
+</DL>
+
+<P>
+<H2>Referer-based Deflector</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+How can we program a flexible URL Deflector which acts on the "Referer" HTTP
+header and can be configured with as many referring pages as we like?
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+Use the following really tricky ruleset...
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteMap deflector txt:/path/to/deflector.map
+
+RewriteCond %{HTTP_REFERER} !=""
+RewriteCond ${deflector:%{HTTP_REFERER}} ^-$
+RewriteRule ^.* %{HTTP_REFERER} [R,L]
+
+RewriteCond %{HTTP_REFERER} !=""
+RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
+RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L]
+</PRE></TD></TR></TABLE>
+
+<P>...
+in conjunction with a corresponding rewrite map:
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+##
+## deflector.map
+##
+
+http://www.badguys.com/bad/index.html -
+http://www.badguys.com/bad/index2.html -
+http://www.badguys.com/bad/index3.html http://somewhere.com/
+</PRE></TD></TR></TABLE>
+
+<P>
+This automatically redirects the request back to the referring page (when "-"
+is used as the value in the map) or to a specific URL (when an URL is
+specified in the map as the second argument).
+
+</DL>
+
+<H1>Other</H1>
+
+<P>
+<H2>External Rewriting Engine</H2>
+<P>
+
+<DL>
+<DT><STRONG>Description:</STRONG>
+<DD>
+A FAQ: How can we solve the FOO/BAR/QUUX/etc. problem? There seems no solution
+by the use of mod_rewrite...
+
+<P>
+<DT><STRONG>Solution:</STRONG>
+<DD>
+Use an external rewrite map, i.e. a program which acts like a rewrite map. It
+is run once on startup of Apache receives the requested URLs on STDIN and has
+to put the resulting (usually rewritten) URL on STDOUT (same order!).
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+RewriteEngine on
+RewriteMap quux-map <b>prg:</b>/path/to/map.quux.pl
+RewriteRule ^/~quux/(.*)$ /~quux/<b>${quux-map:$1}</b>
+</PRE></TD></TR></TABLE>
+
+<P><TABLE BGCOLOR="#E0E5F5" BORDER="0" CELLSPACING="0" CELLPADDING="5"><TR><TD><PRE>
+#!/path/to/perl
+
+# disable buffered I/O which would lead
+# to deadloops for the Apache server
+$| = 1;
+
+# read URLs one per line from stdin and
+# generate substitution URL on stdout
+while (&lt;&gt;) {
+ s|^foo/|bar/|;
+ print $_;
+}
+</PRE></TD></TR></TABLE>
+
+<P>
+This is a demonstration-only example and just rewrites all URLs
+<tt>/~quux/foo/...</tt> to <tt>/~quux/bar/...</tt>. Actually you can program
+whatever you like. But notice that while such maps can be <b>used</b> also by
+an average user, only the system administrator can <b>define</b> it.
+
+</DL>
+
+<HR>
+
+<H3 ALIGN="CENTER">
+ Apache HTTP Server Version 1.3
+</H3>
+
+<A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A>
+<A HREF="../"><IMG SRC="../images/home.gif" ALT="Home"></A>
+
+</BLOCKQUOTE>
+</BODY>
+</HTML>
diff --git a/usr.sbin/httpd/htdocs/manual/netware.html b/usr.sbin/httpd/htdocs/manual/netware.html
new file mode 100644
index 00000000000..c7704901ed0
--- /dev/null
+++ b/usr.sbin/httpd/htdocs/manual/netware.html
@@ -0,0 +1,290 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+<TITLE>Using Apache with Novell NetWare 5</TITLE>
+</HEAD>
+
+<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+<BODY
+ BGCOLOR="#FFFFFF"
+ TEXT="#000000"
+ LINK="#0000FF"
+ VLINK="#000080"
+ ALINK="#FF0000"
+>
+<DIV ALIGN="CENTER">
+ <IMG SRC="images/sub.gif" ALT="[APACHE DOCUMENTATION]">
+ <H3>
+ Apache HTTP Server Version 1.3
+ </H3>
+</DIV>
+
+
+<H1 ALIGN="CENTER">Using Apache With Novell NetWare 5</H1>
+
+<P>This document explains how to install, configure and run
+ Apache 1.3 under Novell NetWare 5. Please note that at
+ this time, NetWare support is entirely experimental, and is
+ recommended only for experienced users. The Apache Group does not
+ guarantee that this software will work as documented, or even at
+ all. If you find any bugs, or wish to contribute in other ways, please
+ use our <A HREF="http://www.apache.org/bug_report.html">bug reporting
+ page.</A></P>
+
+<P><STRONG>Warning: Apache on NetWare has not yet been optimized for performance.
+Apache still performs best, and is most reliable on Unix platforms. Over
+time we will improve NetWare performance. Folks doing comparative reviews
+of webserver performance are asked to compare against Apache
+on a Unix platform such as Solaris, FreeBSD, or Linux.</STRONG></P>
+
+<P>
+
+Most of this document assumes that you are installing Apache from a
+binary distribution. If you want to compile Apache yourself (possibly
+to help with development, or to track down bugs), see the section on
+<A HREF="#comp">Compiling Apache for NetWare</A> below.
+
+<HR>
+
+<UL>
+ <LI><A HREF="#req">Requirements</A>
+ <LI><A HREF="#down">Downloading Apache for NetWare</A>
+ <LI><A HREF="#inst">Installing Apache for NetWare</A>
+ <LI><A HREF="#run">Running Apache for NetWare</A>
+ <LI><A HREF="#use">Using Apache for NetWare</A>
+ <LI><A HREF="#comp">Compiling Apache for NetWare</A>
+</UL>
+
+<HR>
+
+<H2><A NAME="req">Requirements</A></H2>
+
+Apache 1.3 is designed to run on NetWare 5.0 and 5.1.
+<P>
+
+<STRONG>If running on NetWare 5.0 you must install Service Pack 4.</STRONG>
+
+<P>
+<P>
+
+Service pack 4 is available <A HREF="http://support.novell.com/misc/patlst.htm#nw">here.</A>
+
+<H2><A NAME="down">Downloading Apache for NetWare 5</A></H2>
+
+<P>Information on the latest version of Apache can be found on the
+Apache web server at <A
+HREF="http://www.apache.org/">http://www.apache.org/</A>. This will
+list the current release, any more recent alpha or beta-test releases,
+together with details of mirror web and anonymous ftp sites.</P>
+
+<P>
+<H2><A NAME="inst">Installing Apache for NetWare</A></H2>
+
+There is no Apache install program for NetWare currently. You will need
+to compile apache and copy the files over to the server manually. An
+install program will be posted at a later date.
+<P>
+Follow these steps to install Apache on NetWare (assuming you will install to sys:/apache):
+
+<UL>
+ <LI>Create a directory called <CODE>Apache</CODE> on a NetWare volume
+ <LI>Copy Apache.nlm, Apachec.nlm, htdigest.nlm, and htpasswd.nlm to sys:/apache
+ <LI>Create a directory under <CODE>sys:/Apache</CODE> called <CODE>conf</CODE>
+ <LI>Copy all the *.conf-dist-nw files to the <CODE>sys:/apache/conf</CODE> directory
+ and rename them all as *.conf files
+ <LI>Copy the mime.types and magic files to sys:/apache/conf directory
+ <LI>Copy all files and subdirectories of \apache-1.3\htdocs to sys:/apache/htdocs and
+ rename the proper index file (index.html.en) to index.html
+ <LI>Copy all files and subdirectories in \apache-1.3\icons to sys:/apache/icons
+ <LI>Create the directory sys:/apache/logs on the server
+ <LI>Create the directory sys:/apache/cgi-bin on the server
+ <LI>Create the directory sys:/apache/modules and copy all nlm modules built into the
+ modules directory
+ <LI>Edit the httpd.conf file setting ServerRoot and ServerName to reflect your correct
+ server settings
+ <LI>Add <CODE>sys:/apache</CODE> to the search path. EXAMPLE: search add sys:\apache
+</UL>
+
+<P>Apache may be installed to other volumes besides the default <CODE>sys</CODE> volume.
+
+<H2><A NAME="run">Running Apache for NetWare</A></H2>
+
+To start Apache just type <STRONG>apache</STRONG> at the console. This
+will load apache in the OS address space. If you prefer to load
+Apache in a protected address space you may specify the address space
+with the load statement as follows:
+<P>
+<PRE>
+ load address space = apache apache
+</PRE>
+<P>
+This will load Apache into an address space called apache. Running multiple instances
+of Apache concurrently on NetWare is possible by loading each instance into its own
+protected address space.
+
+<P>
+After starting Apache it will be listening to port 80 (unless you
+changed the <SAMP>Port</SAMP>, <SAMP>Listen</SAMP> or
+<SAMP>BindAddress</SAMP> directives in the configuration files).
+To connect to the server and access the default page, launch a browser
+and enter the server's name or address.
+
+This should respond with a welcome page, and a link to the Apache
+manual. If nothing happens or you get an error, look in the
+<SAMP>error_log</SAMP> file in the <SAMP>logs</SAMP> directory.
+
+<P>
+
+Once your basic installation is working, you should configure it
+properly by editing the files in the <SAMP>conf</SAMP> directory.
+
+<P>
+To unload Apache running in the OS address space just type the
+following at the console:
+<PRE>
+ unload apache
+</PRE>
+If apache is running in a protected address space specify the
+address space in the unload statement:
+<PRE>
+ unload address space = apache apache
+</PRE>
+
+<P>
+When working with Apache it is important to know how it will find the
+configuration files. You can specify a configuration file on the command line
+in two ways:
+
+<UL>
+<LI>-f specifies a path to a particular configuration file
+</UL>
+<PRE> apache -f "vol:/my server/conf/my.conf"</PRE>
+<PRE> apache -f test/test.conf</PRE>
+
+In these cases, the proper ServerRoot should be set in the configuration file.
+
+<P>
+
+If you don't specify a configuration file name with -f, Apache will
+use the file name compiled into the server, usually "conf/httpd.conf". Invoking
+Apache with the -V switch will display this value labeled as SERVER_CONFIG_FILE.
+Apache will then determine its ServerRoot by trying the following, in this order:
+
+<UL>
+<LI>A ServerRoot directive via a -C switch.
+<LI>The -d switch on the command line.
+<LI>Current working directory
+<LI>The server root compiled into the server.
+</UL>
+
+<P>
+The server root compiled into the server is usually "sys:/apache".
+invoking apache with the -V switch will display this value
+labeled as HTTPD_ROOT.
+
+<H2><A NAME="use">Configuring Apache for NetWare</A></H2>
+
+Apache is configured by files in the <SAMP>conf</SAMP>
+directory. These are the same as files used to configure the Unix
+version, but there are a few different directives for Apache on
+NetWare. See the <A HREF="./">Apache documentation</A> for all the
+available directives.
+
+<P>
+
+The main differences in Apache for NetWare are:
+
+<UL>
+ <LI><P>Because Apache for NetWare is multithreaded, it does not use a
+ separate process for each request, as Apache does with
+ Unix. Instead there are only threads running: a parent thread, and
+ a child which handles the requests. Within the child each request is
+ handled by a separate thread.
+ <P>
+
+ So the "process"-management directives are different:
+ <P><A
+ HREF="mod/core.html#maxrequestsperchild">MaxRequestsPerChild</A>
+ - Like the Unix directive, this controls how many requests a
+ process will serve before exiting. However, unlike Unix, a
+ process serves all the requests at once, not just one, so if
+ this is set, it is recommended that a very high number is
+ used. The recommended default, <CODE>MaxRequestsPerChild
+ 0</CODE>, does not cause the process to ever exit.
+ <P><A HREF="mod/core.html#threadsperchild">ThreadsPerChild</A> -
+ This directive is new, and tells the server how many threads it
+ should use. This is the maximum number of connections the server
+ can handle at once; be sure and set this number high enough for
+ your site if you get a lot of hits. The recommended default is
+ <CODE>ThreadsPerChild 50</CODE>.
+ </P><A HREF="mod/core.html#threadstacksize">ThreadStackSize</A> -
+ This directive tells the server what size of stack to use for
+ the individual threads. The recommended default is
+ <CODE>ThreadStackSize 65536</CODE>.
+ <P>
+ <LI><P>The directives that accept filenames as arguments now must use
+ NetWare filenames instead of Unix ones. However, because Apache
+ uses Unix-style names internally, you must use forward slashes, not
+ backslashes. Volumes can be used; if omitted, the drive with the
+ Apache executable will be assumed.</P>
+ <LI><P>Apache for NetWare contains the ability to load modules at runtime,
+ without recompiling the server. If Apache is compiled normally, it
+ will install a number of optional modules in the
+ <CODE>\Apache\modules</CODE> directory. To activate these, or other
+ modules, the new <A HREF="mod/mod_so.html#loadmodule">LoadModule</A>
+ directive must be used. For example, to active the status module,
+ use the following (in addition to the status-activating directives
+ in <CODE>access.conf</CODE>):</P>
+<PRE>
+ LoadModule status_module modules/status
+</PRE>
+ <P>Information on <A HREF="mod/mod_so.html#creating">creating loadable
+ modules</A> is also available.</P>
+</UL>
+
+<H2><A NAME="comp">Compiling Apache for NetWare</A></H2>
+
+<P>Compiling Apache requires MetroWerks CodeWarrior 5 to be properly
+ installed.
+
+<P>First, unpack the Apache distribution into an appropriate
+ directory. Then go to the <CODE>src</CODE> subdirectory of the Apache
+ distribution and unzip <CODE>ApacheNW.mcp.gz</CODE>. You may use a
+ recent version of WinZip to accomplish this or gzip for Windows. The main
+ Metrowerks project file for Apache <CODE>(ApacheNW.mcp)</CODE> is now ready
+ to use. Just double click on it from within explorer and it should
+ automatically launch MetroWerks CodeWarrior.
+</P>
+
+<P>All major pieces of Apache may be built using the ApacheNW.mcp project
+ file. This includes modules such as status, info, and proxy. In addition,
+ the following project files have been provided as well:
+<PRE>
+ /apache-1.3/src/support/htpasswd.mcp.gz
+ /apache-1.3/src/support/htdigest.mcp.gz
+</PRE>
+
+</P>
+<CODE>htpasswd.mcp.gz</CODE> and <CODE>htdigest.mcp.gz</CODE> will also need
+to be unzipped before they can be used with MetroWerks CodeWarrior.
+
+<P>Once Apache has been compiled, it needs to be installed in its server
+ root directory. The default is the <CODE>sys:/Apache</CODE>
+ directory. </P>
+<P>
+Before running the server you must fill out the conf directory.
+Copy the *.conf-dist-nw from the distribution conf directory
+and rename *.conf. Edit the ServerRoot entries to your
+actual server root (for example "sys:/apache"). Copy over
+the conf/magic and conf/mime.types files as well.
+
+<HR>
+ <H3 ALIGN="CENTER">
+ Apache HTTP Server Version 1.3
+ </H3>
+
+<A HREF="./"><IMG SRC="images/index.gif" ALT="Index"></A>
+
+</BODY>
+</HTML>
+
diff --git a/usr.sbin/httpd/src/ApacheNW.mcp.gz b/usr.sbin/httpd/src/ApacheNW.mcp.gz
new file mode 100644
index 00000000000..71751b7ca63
--- /dev/null
+++ b/usr.sbin/httpd/src/ApacheNW.mcp.gz
Binary files differ
diff --git a/usr.sbin/httpd/src/helpers/GuessCodeset b/usr.sbin/httpd/src/helpers/GuessCodeset
new file mode 100644
index 00000000000..b761efb3150
--- /dev/null
+++ b/usr.sbin/httpd/src/helpers/GuessCodeset
@@ -0,0 +1,15 @@
+#!/bin/sh
+# This script tries to find out whether the native codeset of this machine
+# is ASCII or EBCDIC. On EBCDIC based machines, it is used to activate
+# the mod_ebcdic EBCDIC conversion module.
+#
+# Note: This script will break if you use an ebcdic cross-compiler!
+#
+case `${AWK-awk} 'BEGIN {printf("%c%c%c%c%c<->%c%c%c%c%c%c\n",97,115,99,105,105,133,130,131,132,137,131);}' /dev/null` in
+ ascii*) echo ASCII;;
+ *ebcdic) echo EBCDIC;;
+ *) echo >&2 "ERROR: Your platform codeset could not be detected correctly."
+ echo >&2 "Assuming ASCII. Please send an EMail to <martin@apache.org>"
+ echo >&2 "describing the platform in use. Is your AWK broken?"
+ echo ASCII;;
+esac
diff --git a/usr.sbin/httpd/src/lib/expat-lite/dllmain.c b/usr.sbin/httpd/src/lib/expat-lite/dllmain.c
new file mode 100644
index 00000000000..deb7fafc81a
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/dllmain.c
@@ -0,0 +1,40 @@
+/*
+The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is expat.
+
+The Initial Developer of the Original Code is James Clark.
+Portions created by James Clark are Copyright (C) 1998, 1999
+James Clark. All Rights Reserved.
+
+Contributor(s):
+
+Alternatively, the contents of this file may be used under the terms
+of the GNU General Public License (the "GPL"), in which case the
+provisions of the GPL are applicable instead of those above. If you
+wish to allow use of your version of this file only under the terms of
+the GPL and not to allow others to use your version of this file under
+the MPL, indicate your decision by deleting the provisions above and
+replace them with the notice and other provisions required by the
+GPL. If you do not delete the provisions above, a recipient may use
+your version of this file under either the MPL or the GPL.
+*/
+
+#define STRICT 1
+#define WIN32_LEAN_AND_MEAN 1
+
+#include <windows.h>
+
+BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+{
+ return TRUE;
+}
+
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmlparse.def b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.def
new file mode 100644
index 00000000000..c309076f479
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.def
@@ -0,0 +1,41 @@
+; xmlparse.def
+
+LIBRARY xmlparse
+DESCRIPTION ''
+
+EXPORTS
+ XML_DefaultCurrent @1
+ XML_ErrorString @2
+ XML_ExternalEntityParserCreate @3
+ XML_GetBase @4
+ XML_GetBuffer @5
+ XML_GetCurrentByteCount @6
+ XML_GetCurrentByteIndex @7
+ XML_GetCurrentColumnNumber @8
+ XML_GetCurrentLineNumber @9
+ XML_GetErrorCode @10
+ XML_GetSpecifiedAttributeCount @11
+ XML_Parse @12
+ XML_ParseBuffer @13
+ XML_ParserCreate @14
+ XML_ParserCreateNS @15
+ XML_ParserFree @16
+ XML_SetBase @17
+ XML_SetCdataSectionHandler @18
+ XML_SetCharacterDataHandler @19
+ XML_SetCommentHandler @20
+ XML_SetDefaultHandler @21
+ XML_SetDefaultHandlerExpand @22
+ XML_SetElementHandler @23
+ XML_SetEncoding @24
+ XML_SetExternalEntityRefHandler @25
+ XML_SetExternalEntityRefHandlerArg @26
+ XML_SetNamespaceDeclHandler @27
+ XML_SetNotStandaloneHandler @28
+ XML_SetNotationDeclHandler @29
+ XML_SetProcessingInstructionHandler @30
+ XML_SetUnknownEncodingHandler @31
+ XML_SetUnparsedEntityDeclHandler @32
+ XML_SetUserData @33
+ XML_UseParserAsHandlerArg @34
+
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmlparse.dsp b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.dsp
new file mode 100644
index 00000000000..6681620e8c0
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.dsp
@@ -0,0 +1,124 @@
+# Microsoft Developer Studio Project File - Name="xmlparse" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xmlparse - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlparse.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlparse.mak" CFG="xmlparse - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlparse - Win32 Release" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlparse - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir "."
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"Release\xmlparse.dll"
+# SUBTRACT LINK32 /profile
+
+!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir "."
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\xmltok" /I "..\xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /FD /ZI /c
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:I386 /out:"Debug\xmlparse.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlparse - Win32 Release"
+# Name "xmlparse - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\hashtable.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmlparse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmlparse.def
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\hashtable.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmlparse.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmlparse.mak b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.mak
new file mode 100644
index 00000000000..4f878df12cb
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmlparse.mak
@@ -0,0 +1,289 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on xmlparse.dsp
+!IF "$(CFG)" == ""
+CFG=xmlparse - Win32 Release
+!MESSAGE No configuration specified. Defaulting to xmlparse - Win32 Release.
+!ENDIF
+
+!IF "$(CFG)" != "xmlparse - Win32 Release" && "$(CFG)" !=\
+ "xmlparse - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlparse.mak" CFG="xmlparse - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlparse - Win32 Release" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "xmlparse - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\xmlparse.dll"
+
+!ELSE
+
+ALL : "xmltok - Win32 Release" "$(OUTDIR)\xmlparse.dll"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"xmltok - Win32 ReleaseCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\hashtable.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\xmlparse.obj"
+ -@erase "$(OUTDIR)\xmlparse.dll"
+ -@erase "$(OUTDIR)\xmlparse.exp"
+ -@erase "$(OUTDIR)\xmlparse.lib"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D "NDEBUG" /D\
+ "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
+ XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)\xmlparse.pch" /YX\
+ /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\xmlparse.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no\
+ /pdb:"$(OUTDIR)\xmlparse.pdb" /machine:I386 /def:".\xmlparse.def"\
+ /out:"$(OUTDIR)\xmlparse.dll" /implib:"$(OUTDIR)\xmlparse.lib"
+DEF_FILE= \
+ ".\xmlparse.def"
+LINK32_OBJS= \
+ "$(INTDIR)\hashtable.obj" \
+ "$(INTDIR)\xmlparse.obj" \
+ "$(OUTDIR)\xmltok.lib"
+
+"$(OUTDIR)\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\xmlparse.dll"
+
+!ELSE
+
+ALL : "xmltok - Win32 Debug" "$(OUTDIR)\xmlparse.dll"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"xmltok - Win32 DebugCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\hashtable.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\xmlparse.obj"
+ -@erase "$(OUTDIR)\xmlparse.dll"
+ -@erase "$(OUTDIR)\xmlparse.exp"
+ -@erase "$(OUTDIR)\xmlparse.ilk"
+ -@erase "$(OUTDIR)\xmlparse.lib"
+ -@erase "$(OUTDIR)\xmlparse.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /GX /Od /I "..\xmltok" /I "..\xmlwf" /D "_DEBUG" /D\
+ "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
+ XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)\xmlparse.pch" /YX\
+ /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /Zi /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\xmlparse.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll\
+ /incremental:yes /pdb:"$(OUTDIR)\xmlparse.pdb" /debug /machine:I386\
+ /def:".\xmlparse.def" /out:"$(OUTDIR)\xmlparse.dll"\
+ /implib:"$(OUTDIR)\xmlparse.lib"
+DEF_FILE= \
+ ".\xmlparse.def"
+LINK32_OBJS= \
+ "$(INTDIR)\hashtable.obj" \
+ "$(INTDIR)\xmlparse.obj" \
+ "$(OUTDIR)\xmltok.lib"
+
+"$(OUTDIR)\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+!IF "$(CFG)" == "xmlparse - Win32 Release" || "$(CFG)" ==\
+ "xmlparse - Win32 Debug"
+SOURCE=.\hashtable.c
+DEP_CPP_HASHT=\
+ ".\hashtable.h"\
+ ".\xmldef.h"\
+
+NODEP_CPP_HASHT=\
+ ".\ap_config.h"\
+ ".\nspr.h"\
+
+
+"$(INTDIR)\hashtable.obj" : $(SOURCE) $(DEP_CPP_HASHT) "$(INTDIR)"
+
+
+SOURCE=.\xmlparse.c
+DEP_CPP_XMLPA=\
+ ".\hashtable.h"\
+ ".\xmldef.h"\
+ ".\xmlparse.h"\
+ ".\xmlrole.h"\
+ ".\xmltok.h"\
+
+NODEP_CPP_XMLPA=\
+ ".\ap_config.h"\
+ ".\nspr.h"\
+
+
+"$(INTDIR)\xmlparse.obj" : $(SOURCE) $(DEP_CPP_XMLPA) "$(INTDIR)"
+
+
+!IF "$(CFG)" == "xmlparse - Win32 Release"
+
+"xmltok - Win32 Release" :
+ cd "."
+ $(MAKE) /$(MAKEFLAGS) /F ".\xmltok.mak" CFG="xmltok - Win32 Release"
+ cd "."
+
+"xmltok - Win32 ReleaseCLEAN" :
+ cd "."
+ $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\xmltok.mak" CFG="xmltok - Win32 Release"\
+ RECURSE=1
+ cd "."
+
+!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+
+"xmltok - Win32 Debug" :
+ cd "."
+ $(MAKE) /$(MAKEFLAGS) /F ".\xmltok.mak" CFG="xmltok - Win32 Debug"
+ cd "."
+
+"xmltok - Win32 DebugCLEAN" :
+ cd "."
+ $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\xmltok.mak" CFG="xmltok - Win32 Debug"\
+ RECURSE=1
+ cd "."
+
+!ENDIF
+
+
+!ENDIF
+
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmltok.def b/usr.sbin/httpd/src/lib/expat-lite/xmltok.def
new file mode 100644
index 00000000000..3be476c555b
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmltok.def
@@ -0,0 +1,15 @@
+; xmltok.def
+
+LIBRARY xmltok
+DESCRIPTION ''
+
+EXPORTS
+ XmlGetUtf16InternalEncoding @1
+ XmlGetUtf8InternalEncoding @2
+ XmlInitEncoding @3
+ XmlInitUnknownEncoding @4
+ XmlParseXmlDecl @5
+ XmlPrologStateInit @6
+ XmlSizeOfUnknownEncoding @7
+ XmlUtf16Encode @8
+ XmlUtf8Encode @9
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmltok.dsp b/usr.sbin/httpd/src/lib/expat-lite/xmltok.dsp
new file mode 100644
index 00000000000..f506f15165e
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmltok.dsp
@@ -0,0 +1,160 @@
+# Microsoft Developer Studio Project File - Name="xmltok" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xmltok - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmltok.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmltok.mak" CFG="xmltok - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmltok - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir "."
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"Release\xmltok.dll"
+
+!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir "."
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MTd /W3 /GX /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /FD /ZI /c
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug\xmltok.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmltok - Win32 Release"
+# Name "xmltok - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\dllmain.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmlrole.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmltok.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmltok.def
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\asciitab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\iasciitab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\latin1tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nametab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\utf8tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmldef.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmlrole.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmltok.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmltok_impl.c
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=.\xmltok_impl.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/usr.sbin/httpd/src/lib/expat-lite/xmltok.mak b/usr.sbin/httpd/src/lib/expat-lite/xmltok.mak
new file mode 100644
index 00000000000..45e1e3b6794
--- /dev/null
+++ b/usr.sbin/httpd/src/lib/expat-lite/xmltok.mak
@@ -0,0 +1,261 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on xmltok.dsp
+!IF "$(CFG)" == ""
+CFG=xmltok - Win32 Release
+!MESSAGE No configuration specified. Defaulting to xmltok - Win32 Release.
+!ENDIF
+
+!IF "$(CFG)" != "xmltok - Win32 Release" && "$(CFG)" != "xmltok - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmltok.mak" CFG="xmltok - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "xmltok - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\xmltok.dll"
+
+!ELSE
+
+ALL : "$(OUTDIR)\xmltok.dll"
+
+!ENDIF
+
+CLEAN :
+ -@erase "$(INTDIR)\dllmain.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\xmlrole.obj"
+ -@erase "$(INTDIR)\xmltok.obj"
+ -@erase "$(OUTDIR)\xmltok.dll"
+ -@erase "$(OUTDIR)\xmltok.exp"
+ -@erase "$(OUTDIR)\xmltok.lib"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+ XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)\xmltok.pch" /YX /Fo"$(INTDIR)\\"\
+ /Fd"$(INTDIR)\\" /FD /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\xmltok.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /incremental:no\
+ /pdb:"$(OUTDIR)\xmltok.pdb" /machine:I386 /def:".\xmltok.def"\
+ /out:"$(OUTDIR)\xmltok.dll" /implib:"$(OUTDIR)\xmltok.lib"
+DEF_FILE= \
+ ".\xmltok.def"
+LINK32_OBJS= \
+ "$(INTDIR)\dllmain.obj" \
+ "$(INTDIR)\xmlrole.obj" \
+ "$(INTDIR)\xmltok.obj"
+
+"$(OUTDIR)\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\xmltok.dll"
+
+!ELSE
+
+ALL : "$(OUTDIR)\xmltok.dll"
+
+!ENDIF
+
+CLEAN :
+ -@erase "$(INTDIR)\dllmain.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\xmlrole.obj"
+ -@erase "$(INTDIR)\xmltok.obj"
+ -@erase "$(OUTDIR)\xmltok.dll"
+ -@erase "$(OUTDIR)\xmltok.exp"
+ -@erase "$(OUTDIR)\xmltok.ilk"
+ -@erase "$(OUTDIR)\xmltok.lib"
+ -@erase "$(OUTDIR)\xmltok.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MTd /W3 /GX /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D\
+ XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)\xmltok.pch" /YX /Fo"$(INTDIR)\\"\
+ /Fd"$(INTDIR)\\" /FD /Zi /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\xmltok.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
+ /pdb:"$(OUTDIR)\xmltok.pdb" /debug /machine:I386 /def:".\xmltok.def"\
+ /out:"$(OUTDIR)\xmltok.dll" /implib:"$(OUTDIR)\xmltok.lib"
+DEF_FILE= \
+ ".\xmltok.def"
+LINK32_OBJS= \
+ "$(INTDIR)\dllmain.obj" \
+ "$(INTDIR)\xmlrole.obj" \
+ "$(INTDIR)\xmltok.obj"
+
+"$(OUTDIR)\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+!IF "$(CFG)" == "xmltok - Win32 Release" || "$(CFG)" == "xmltok - Win32 Debug"
+SOURCE=.\dllmain.c
+
+"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\xmlrole.c
+DEP_CPP_XMLRO=\
+ ".\xmldef.h"\
+ ".\xmlrole.h"\
+ ".\xmltok.h"\
+
+NODEP_CPP_XMLRO=\
+ ".\ap_config.h"\
+ ".\nspr.h"\
+
+
+"$(INTDIR)\xmlrole.obj" : $(SOURCE) $(DEP_CPP_XMLRO) "$(INTDIR)"
+
+
+SOURCE=.\xmltok.c
+DEP_CPP_XMLTO=\
+ ".\asciitab.h"\
+ ".\iasciitab.h"\
+ ".\latin1tab.h"\
+ ".\nametab.h"\
+ ".\utf8tab.h"\
+ ".\xmldef.h"\
+ ".\xmltok.h"\
+ ".\xmltok_impl.c"\
+ ".\xmltok_impl.h"\
+ ".\xmltok_ns.c"\
+
+NODEP_CPP_XMLTO=\
+ ".\ap_config.h"\
+ ".\nspr.h"\
+
+
+"$(INTDIR)\xmltok.obj" : $(SOURCE) $(DEP_CPP_XMLTO) "$(INTDIR)"
+
+
+SOURCE=.\xmltok_impl.c
+
+!ENDIF
+
diff --git a/usr.sbin/httpd/src/os/mpeix/Makefile.tmpl b/usr.sbin/httpd/src/os/mpeix/Makefile.tmpl
new file mode 100644
index 00000000000..6cf10dedf61
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/Makefile.tmpl
@@ -0,0 +1,50 @@
+CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
+LIBS=$(EXTRA_LIBS) $(LIBS1)
+INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
+LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+
+LIBOBJS= os.o os-inline.o dlopen.o gettimeofday.o
+OBJS= $(LIBOBJS) mpe_dl_stub.o
+
+LIB= libos.a
+
+all: $(LIB) mpe_dl_stub.o
+
+$(LIB): $(LIBOBJS)
+ rm -f $@
+ ar cr $@ $(LIBOBJS)
+ $(RANLIB) $@
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $<
+
+clean:
+ rm -f $(OBJS) $(LIB)
+
+distclean: clean
+ -rm -f Makefile
+
+# We really don't expect end users to use this rule. It works only with
+# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
+# using it.
+depend:
+ cp Makefile.tmpl Makefile.tmpl.bak \
+ && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
+ && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
+ && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
+ -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
+ > Makefile.tmpl \
+ && rm Makefile.new
+
+$(OBJS): Makefile
+
+# DO NOT REMOVE
+dlopen.o: dlopen.c
+gettimeofday.o: gettimeofday.c
+mpe_dl_stub.o: mpe_dl_stub.c
+os-inline.o: os-inline.c $(INCDIR)/ap_config.h \
+ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \
+ $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h
+os.o: os.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
+ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
+ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.h
diff --git a/usr.sbin/httpd/src/os/mpeix/README b/usr.sbin/httpd/src/os/mpeix/README
new file mode 100644
index 00000000000..33b6a3ff64e
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/README
@@ -0,0 +1,5 @@
+For the latest info about Apache for MPE/iX, please see:
+
+ http://jazz.external.hp.com/src/apache/index.html
+ or
+ http://www.bixby.org/mark/apacheix.html
diff --git a/usr.sbin/httpd/src/os/mpeix/dlopen.c b/usr.sbin/httpd/src/os/mpeix/dlopen.c
new file mode 100644
index 00000000000..f991867c536
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/dlopen.c
@@ -0,0 +1,216 @@
+/*
+ * dlopen()/dlsym()/dlclose()/dlerror() emulation code for MPE
+ *
+ * This is not intended to be a 100% complete implementation.
+ */
+
+#include "httpd.h"
+
+typedef struct {
+ char libname[PATH_MAX + 3];
+ } t_mpe_dld, *p_mpe_dld;
+
+/*
+ * hpunload() is an undocumented and unsupported function used to unload
+ * NMXL library symbols. While it isn't listed in the Intrinsics manual
+ * or SYSINTR.PUB.SYS, it performs the same level of parameter checking
+ * that a regular intrinsic does. The parameter contents are the same
+ * as for HPGETPROCPLABEL(), with the exception of symbolname which can
+ * use the wildcard of " @ " which means unload ALL symbols RIGHT NOW.
+ */
+
+extern void hpunload(
+ int parms, /* option extensible hidden parameter */
+ char * symbolname,
+ char * libname,
+ int * status,
+ int * symboltype,
+ int casesensitive);
+
+#ifdef __GNUC__
+extern void HPGETPROCPLABEL(
+ int parms, /* option extensible hidden parameter */
+ char * symbolname,
+ void * symboladdr,
+ int * status,
+ char * libname,
+ int casesensitive,
+ int symboltype,
+ int * datasize,
+ int position,
+ int searchpath,
+ int binding);
+
+extern void HPERRMSG(
+ int parms, /* option extensible hidden parameter */
+ int displaycode,
+ int depth,
+ short errorproc,
+ int errornum,
+ char * buffer,
+ short * buflength,
+ int * status);
+#else
+#pragma intrinsic HPERRMSG
+#pragma intrinsic HPGETPROCPLABEL
+#endif
+
+int mpe_dl_status = 0;
+char mpe_dl_errmsg[1024];
+char mpe_dl_symname[128];
+int mpe_dl_symtype; /* 0=proc, 1=data, 2=malloc, 3=hpunload */
+
+/*
+ * dlopen()
+ */
+
+void *dlopen(const char *libname, int flag) {
+
+t_mpe_dld *handle;
+char cwd[PATH_MAX+3];
+char library[PATH_MAX+3];
+void *symaddr;
+int datalen;
+
+/* Save the library name in absolute format for later use */
+if (libname[0] != '/') {
+ getcwd(cwd, sizeof(cwd));
+ ap_snprintf(library, sizeof(library), " %s/%s ", cwd, libname);
+} else
+ ap_snprintf(library, sizeof(library), " %s ", libname);
+
+/*
+Unfortunately if we simply tried to load the module structure data item
+directly in dlsym(), it would complain about unresolved function pointer
+references.
+
+However, if we first load an actual dummy procedure, we can then subsequently
+load the data item without trouble. Go figure.
+*/
+
+/* Load the dummy procedure mpe_dl_stub */
+ap_cpystrn(mpe_dl_symname, " mpe_dl_stub ", sizeof(mpe_dl_symname));
+mpe_dl_symtype = 0;
+
+HPGETPROCPLABEL(
+#ifdef __GNUC__
+ 8,
+#endif
+ mpe_dl_symname, &symaddr, &mpe_dl_status, library, 1,
+ mpe_dl_symtype, &datalen, 1, 0, 0);
+
+/* We consider it to be a failure if the dummy procedure doesn't exist */
+if (mpe_dl_status != 0) return NULL;
+
+mpe_dl_symtype = 2;
+
+/* Allocate a handle */
+if ((handle = (t_mpe_dld *)malloc(sizeof(t_mpe_dld))) == NULL) return NULL;
+
+/* Initialize the handle fields */
+memset(handle, 0, sizeof(t_mpe_dld));
+
+ap_cpystrn(handle->libname,library,sizeof(handle->libname));
+
+return handle;
+}
+
+/*
+ * dlsym()
+ */
+
+void *dlsym(void *handle, const char *symbol) {
+
+t_mpe_dld *myhandle = handle;
+int datalen;
+void * symaddr = NULL;
+
+ap_snprintf(mpe_dl_symname, sizeof(mpe_dl_symname), " %s ", symbol);
+mpe_dl_symtype = 1;
+
+HPGETPROCPLABEL(
+#ifdef __GNUC__
+ 8,
+#endif
+ mpe_dl_symname, &symaddr, &mpe_dl_status, myhandle->libname, 1,
+ mpe_dl_symtype, &datalen, 1, 0, 0);
+
+if (mpe_dl_status != 0) {
+ return NULL;
+} else {
+ return symaddr;
+}
+
+}
+
+/*
+ * dlclose()
+ */
+
+int dlclose(void *handle) {
+
+p_mpe_dld myhandle = handle;
+
+mpe_dl_symtype = 3;
+
+/* unload ALL symbols from the library RIGHT NOW */
+hpunload(5, " @ ", myhandle->libname, &mpe_dl_status, NULL, 0);
+
+free(handle);
+
+if (mpe_dl_status == 0)
+ return 0;
+else
+ return -1;
+
+}
+
+/*
+ * dlerror()
+ */
+
+const char *dlerror(void) {
+
+char errmsg[1024];
+short buflen = sizeof(errmsg)-1;
+int status;
+char prefix[80];
+
+if (mpe_dl_status == 0) return NULL;
+
+switch (mpe_dl_symtype) {
+ case 0:
+ ap_snprintf(prefix,sizeof(prefix),
+ "HPGETPROCPLABEL() failed on procedure%s",mpe_dl_symname);
+ break;
+ case 1:
+ ap_snprintf(prefix,sizeof(prefix),
+ "HPGETPROCPLABEL() failed on data item%s",mpe_dl_symname);
+ break;
+ case 3:
+ ap_cpystrn(prefix,"hpunload() failed",sizeof(prefix));
+ break;
+ default:
+ ap_cpystrn(prefix,"Unknown MPE dynaloader error",sizeof(prefix));
+ break;
+}
+
+/* Obtain the error message for the most recent mpe_dl_status value */
+HPERRMSG(
+#ifdef __GNUC__
+ 7,
+#endif
+ 3, 0, 0, mpe_dl_status, (char *)&errmsg, &buflen, &status);
+
+if (status == 0)
+ errmsg[buflen] = '\0';
+else
+ ap_snprintf(errmsg,sizeof(errmsg),
+ "HPERRMSG failed (status=%x); MPE loader status = %x",
+ status, mpe_dl_status);
+
+ap_snprintf(mpe_dl_errmsg,sizeof(mpe_dl_errmsg),"%s\n%s",prefix,errmsg);
+
+return (char *)&mpe_dl_errmsg;
+
+}
diff --git a/usr.sbin/httpd/src/os/mpeix/gettimeofday.c b/usr.sbin/httpd/src/os/mpeix/gettimeofday.c
new file mode 100644
index 00000000000..3b593fa1cd2
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/gettimeofday.c
@@ -0,0 +1,116 @@
+/*
+ stub for gettimeofday():
+ gettimeofday() is UNIX, not POSIX
+*/
+
+/*-------------------------------------------------------------------*/
+/* */
+/* gettimeofday */
+/* */
+/*-------------------------------------------------------------------*/
+/* */
+/* #include <time.h> */
+/* */
+/* int gettimeofday( */
+/* struct timeval *tp, */
+/* struct timezone *tzp, */
+/* ); */
+/* */
+/*-------------------------------------------------------------------*/
+/* */
+/* This function returns seconds and microseconds since midnight */
+/* January 1, 1970. The microseconds is actually only accurate to */
+/* the millisecond. */
+/* */
+/* Note: To pick up the definitions of structs timeval and timezone */
+/* from the <time.h> include file, the directive */
+/* _SOCKET_SOURCE must be used. */
+/* */
+/*-------------------------------------------------------------------*/
+/* */
+/* RETURN VALUE */
+/* A 0 return value indicates that the call succeeded. A -1 return */
+/* value indicates an error occurred; errno is set to indicate the */
+/* error. */
+/* */
+/*-------------------------------------------------------------------*/
+/* */
+/* ERRORS */
+/* EFAULT not implemented yet. */
+/* */
+/*-------------------------------------------------------------------*/
+/* Changes: */
+/* 2-91 DR. Created. */
+/* */
+/*-------------------------------------------------------------------*/
+
+
+/* need _SOCKET_SOURCE to pick up structs timeval and timezone in time.h */
+#ifndef _SOCKET_SOURCE
+# define _SOCKET_SOURCE
+#endif
+
+#include <time.h> /* structs timeval & timezone,
+ difftime(), localtime(), mktime(), time() */
+
+#pragma intrinsic TIMER
+
+
+
+int
+gettimeofday(struct timeval *tp, struct timezone *tpz)
+{
+ static unsigned long basetime = 0;
+ static int dsttime = 0;
+ static int minuteswest = 0;
+ static int oldtime = 0;
+ register int newtime;
+ int TIMER();
+
+
+ /*-------------------------------------------------------------------*/
+ /* Setup a base from which all future time will be computed. */
+ /*-------------------------------------------------------------------*/
+ if ( basetime == 0 )
+ {
+ time_t gmt_time;
+ time_t loc_time;
+ struct tm *loc_time_tm;
+
+ gmt_time = time( NULL );
+ loc_time_tm = localtime( &gmt_time ) ;
+ loc_time = mktime( loc_time_tm );
+
+ oldtime = TIMER();
+ basetime = (unsigned long) ( loc_time - (oldtime/1000) );
+
+ /*----------------------------------------------------------------*/
+ /* The calling process must be restarted if timezone or dst */
+ /* changes. */
+ /*----------------------------------------------------------------*/
+ minuteswest = (int) (difftime( loc_time, gmt_time ) / 60);
+ dsttime = loc_time_tm->tm_isdst;
+ }
+
+ /*-------------------------------------------------------------------*/
+ /* Get the new time value. The timer value rolls over every 24 days, */
+ /* so if the delta is negative, the basetime value is adjusted. */
+ /*-------------------------------------------------------------------*/
+ newtime = TIMER();
+ if ( newtime < oldtime ) basetime += 2073600;
+ oldtime = newtime;
+
+ /*-------------------------------------------------------------------*/
+ /* Return the timestamp info. */
+ /*-------------------------------------------------------------------*/
+ tp->tv_sec = basetime + newtime/1000;
+ tp->tv_usec = (newtime%1000) * 1000; /* only accurate to milli */
+ if (tpz)
+ {
+ tpz->tz_minuteswest = minuteswest;
+ tpz->tz_dsttime = dsttime;
+ }
+
+ return 0;
+
+} /* gettimeofday() */
diff --git a/usr.sbin/httpd/src/os/mpeix/mpe_dl_stub.c b/usr.sbin/httpd/src/os/mpeix/mpe_dl_stub.c
new file mode 100644
index 00000000000..876ba16575c
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/mpe_dl_stub.c
@@ -0,0 +1 @@
+int mpe_dl_stub(void) { return 0; };
diff --git a/usr.sbin/httpd/src/os/mpeix/os-inline.c b/usr.sbin/httpd/src/os/mpeix/os-inline.c
new file mode 100644
index 00000000000..fe3e5fc9a50
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/os-inline.c
@@ -0,0 +1 @@
+#include "../unix/os-inline.c"
diff --git a/usr.sbin/httpd/src/os/mpeix/os.c b/usr.sbin/httpd/src/os/mpeix/os.c
new file mode 100644
index 00000000000..d3884a5dc47
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/os.c
@@ -0,0 +1 @@
+#include "../unix/os.c"
diff --git a/usr.sbin/httpd/src/os/mpeix/os.h b/usr.sbin/httpd/src/os/mpeix/os.h
new file mode 100644
index 00000000000..b92457af16f
--- /dev/null
+++ b/usr.sbin/httpd/src/os/mpeix/os.h
@@ -0,0 +1,147 @@
+/* ====================================================================
+ * 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_OS_H
+#define APACHE_OS_H
+
+#include "ap_config.h"
+
+#ifndef PLATFORM
+#define PLATFORM "MPE/iX"
+#endif
+
+/*
+ * This file in included in all Apache source code. It contains definitions
+ * of facilities available on _this_ operating system (HAVE_* macros),
+ * and prototypes of OS specific functions defined in os.c or os-inline.c
+ */
+
+#if !defined(INLINE) && defined(USE_GNU_INLINE)
+/* Compiler supports inline, so include the inlineable functions as
+ * part of the header
+ */
+#define INLINE extern ap_inline
+
+INLINE int ap_os_is_path_absolute(const char *file);
+
+#include "os-inline.c"
+
+#else
+
+/* Compiler does not support inline, so prototype the inlineable functions
+ * as normal
+ */
+extern int ap_os_is_path_absolute(const char *file);
+#endif
+
+/* Other ap_os_ routines not used by this platform */
+
+#define ap_os_is_filename_valid(f) (1)
+#define ap_os_kill(pid, sig) kill(pid, sig)
+
+/*
+ * Abstraction layer for loading
+ * Apache modules under run-time via
+ * dynamic shared object (DSO) mechanism
+ */
+
+#ifdef HAVE_DL_H
+#include <dl.h>
+#endif
+
+/*
+ * Do not use native AIX DSO support
+ */
+#ifdef AIX
+#undef HAVE_DLFCN_H
+#endif
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#else
+void *dlopen(const char *, int);
+int dlclose(void *);
+void *dlsym(void *, const char *);
+const char *dlerror(void);
+#endif
+
+/* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY.
+ * The below define is a lie since we are really doing RTLD_LAZY since the
+ * system doesn't support RTLD_NOW.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#if (defined(__FreeBSD__) ||\
+ defined(__OpenBSD__) ||\
+ defined(__NetBSD__) ) && !defined(__ELF__)
+#define DLSYM_NEEDS_UNDERSCORE
+#endif
+
+#define ap_os_dso_handle_t void *
+void ap_os_dso_init(void);
+void * ap_os_dso_load(const char *);
+void ap_os_dso_unload(void *);
+void * ap_os_dso_sym(void *, const char *);
+const char *ap_os_dso_error(void);
+
+#endif /* !APACHE_OS_H */
diff --git a/usr.sbin/httpd/src/os/netware/Apache.def b/usr.sbin/httpd/src/os/netware/Apache.def
new file mode 100644
index 00000000000..9f1c81463d9
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/Apache.def
@@ -0,0 +1,4 @@
+# NLMs Apache depends on
+
+MODULE clib.nlm
+MODULE apachec.nlm
diff --git a/usr.sbin/httpd/src/os/netware/ApacheCore.imp b/usr.sbin/httpd/src/os/netware/ApacheCore.imp
new file mode 100644
index 00000000000..072ccaed59e
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheCore.imp
@@ -0,0 +1,347 @@
+ap_MD5Final
+ap_MD5Init
+ap_MD5Update
+ap_acquire_mutex
+ap_add_cgi_vars
+ap_add_common_vars
+ap_add_loaded_module
+ap_add_module
+ap_add_named_module
+ap_add_per_dir_conf
+ap_add_per_url_conf
+ap_add_version_component
+ap_allow_options
+ap_allow_overrides
+ap_append_arrays
+ap_array_cat
+ap_auth_name
+ap_auth_type
+ap_basic_http_header
+ap_bclose
+ap_bcreate
+ap_bfilbuf
+ap_bfileno
+ap_bflsbuf
+ap_bflush
+ap_bgetopt
+ap_bgets
+ap_bhalfduplex
+ap_block_alarms
+ap_blookc
+ap_bnonblock
+ap_bonerror
+ap_bpushfd
+ap_bputs
+ap_bread
+ap_bsetflag
+ap_bsetopt
+ap_bskiplf
+ap_bspawn_child
+ap_bwrite
+ap_bytes_in_free_blocks
+ap_bytes_in_pool
+ap_call_exec
+ap_can_exec
+ap_cfg_closefile
+ap_cfg_getc
+ap_cfg_getline
+ap_chdir_file
+ap_check_alarm
+ap_check_cmd_context
+ap_checkmask
+ap_cleanup_for_exec
+ap_clear_module_list
+ap_clear_pool
+ap_clear_table
+ap_close_piped_log
+ap_construct_server
+ap_construct_url
+ap_content_type_tolower
+ap_copy_array
+ap_copy_array_hdr
+ap_copy_table
+ap_count_dirs
+ap_cpystrn
+ap_create_environment
+ap_create_mutex
+ap_create_per_dir_config
+ap_custom_response
+ap_default_port_for_request
+ap_default_port_for_scheme
+ap_default_type
+ap_destroy_mutex
+ap_destroy_pool
+ap_destroy_sub_req
+ap_die
+ap_discard_request_body
+ap_document_root
+ap_each_byterange
+ap_error_log2stderr
+ap_escape_html
+ap_escape_path_segment
+ap_escape_quotes
+ap_escape_shell_cmd
+ap_exists_scoreboard_image
+ap_finalize_request_protocol
+ap_find_command
+ap_find_command_in_modules
+ap_find_last_token
+ap_find_linked_module
+ap_find_module_name
+ap_find_path_info
+ap_find_token
+ap_get_basic_auth_pw
+ap_get_client_block
+ap_get_gmtoff
+ap_get_limit_req_body
+ap_get_remote_host
+ap_get_remote_logname
+ap_get_server_built
+ap_get_server_name
+ap_get_server_port
+ap_get_server_version
+ap_get_time
+ap_get_token
+ap_getparents
+ap_getword
+ap_getword_conf
+ap_getword_conf_nc
+ap_getword_nc
+ap_getword_nulls
+ap_getword_nulls_nc
+ap_getword_white
+ap_getword_white_nc
+ap_gm_timestr_822
+ap_gname2id
+ap_handle_command
+ap_hard_timeout
+ap_ht_time
+ap_ind
+ap_index_of_response
+ap_init_virtual_host
+ap_internal_redirect
+ap_internal_redirect_handler
+ap_is_directory
+ap_is_fnmatch
+ap_is_initial_req
+ap_is_matchexp
+ap_is_url
+ap_kill_cleanup
+ap_kill_cleanups_for_fd
+ap_kill_cleanups_for_socket
+ap_kill_timeout
+ap_log_assert
+ap_log_error_old
+ap_log_reason
+ap_log_unixerr
+ap_make_array
+ap_make_dirstr
+ap_make_dirstr_parent
+ap_make_dirstr_prefix
+ap_make_full_path
+ap_make_sub_pool
+ap_make_table
+ap_matches_request_vhost
+ap_md5
+ap_md5_binary
+ap_md5contextTo64
+ap_md5digest
+ap_meets_conditions
+ap_no2slash
+ap_note_auth_failure
+ap_note_basic_auth_failure
+ap_note_cleanups_for_fd
+ap_note_cleanups_for_file
+ap_note_cleanups_for_socket
+ap_note_digest_auth_failure
+ap_note_subprocess
+ap_open_mutex
+ap_open_piped_log
+ap_os_escape_path
+ap_overlap_tables
+ap_overlay_tables
+ap_palloc
+ap_parseHTTPdate
+ap_parse_hostinfo_components
+ap_parse_uri
+ap_parse_uri_components
+ap_pcalloc
+ap_pcfg_open_custom
+ap_pcfg_openfile
+ap_pclosedir
+ap_pclosef
+ap_pclosesocket
+ap_pduphostent
+ap_pfclose
+ap_pfdopen
+ap_pfopen
+ap_pgethostbyname
+ap_popendir
+ap_popenf
+ap_pregcomp
+ap_pregfree
+ap_pregsub
+ap_psignature
+ap_psocket
+ap_pstrdup
+ap_pstrndup
+ap_push_array
+ap_pvsprintf
+ap_rationalize_mtime
+ap_register_cleanup
+ap_release_mutex
+ap_remove_loaded_module
+ap_remove_module
+ap_requires
+ap_reset_timeout
+ap_rflush
+ap_rind
+ap_rputc
+ap_rputs
+ap_run_cleanup
+ap_run_sub_req
+ap_rwrite
+ap_satisfies
+ap_scan_script_header_err
+ap_scan_script_header_err_buff
+ap_scan_script_header_err_core
+ap_send_fb
+ap_send_fb_length
+ap_send_fd
+ap_send_fd_length
+ap_send_http_header
+ap_send_http_trace
+ap_send_mmap
+ap_send_size
+ap_server_root_relative
+ap_set_byterange
+ap_set_content_length
+ap_set_etag
+ap_set_keepalive
+ap_set_last_modified
+ap_setup_client_block
+ap_should_client_block
+ap_soft_timeout
+ap_some_auth_required
+ap_spawn_child
+ap_srm_command_loop
+ap_str_tolower
+ap_strcasecmp_match
+ap_strcmp_match
+ap_sub_req_lookup_file
+ap_sub_req_lookup_uri
+ap_sync_scoreboard_image
+ap_table_add
+ap_table_addn
+ap_table_get
+ap_table_merge
+ap_table_mergen
+ap_table_set
+ap_table_setn
+ap_table_unset
+ap_tm2sec
+ap_uname2id
+ap_unblock_alarms
+ap_unescape_url
+ap_unparse_uri_components
+ap_update_mtime
+ap_uudecode
+ap_uuencode
+ap_vbprintf
+ap_vformatter
+ap_vsnprintf
+regcomp
+regexec
+regfree
+access_module
+alias_module
+ap_bprintf
+ap_bvputs
+ap_day_snames
+ap_extended_status
+ap_limit_section
+ap_loaded_modules
+ap_log_error
+ap_log_printf
+ap_log_rerror
+ap_month_snames
+ap_null_cleanup
+ap_psprintf
+ap_pstrcat
+ap_restart_time
+ap_rprintf
+ap_rvputs
+ap_scoreboard_image
+ap_send_header_field
+ap_server_argv0
+ap_server_root
+ap_set_file_slot
+ap_set_flag_slot
+ap_set_string_slot
+ap_set_string_slot_lower
+ap_snprintf
+ap_suexec_enabled
+ap_table_do
+apache_main
+asis_module
+auth_module
+autoindex_module
+config_log_module
+core_module
+dir_module
+env_module
+imap_module
+includes_module
+mime_module
+negotiation_module
+setenvif_module
+so_module
+top_module
+ap_fnmatch
+ap_method_number_of
+ap_exists_config_define
+ap_single_module_configure
+ap_make_etag
+ap_array_pstrcat
+ap_find_list_item
+ap_MD5Encode
+ap_validate_password
+ap_size_list_item
+ap_get_list_item
+ap_scoreboard_fname
+ap_pid_fname
+ap_excess_requests_per_child
+ap_threads_per_child
+ap_max_requests_per_child
+ap_daemons_to_start
+ap_daemons_min_free
+ap_daemons_max_free
+ap_daemons_limit
+ap_user_name
+ap_user_id
+ap_group_id
+ap_standalone
+ap_server_confname
+ap_sub_req_method_uri
+ap_regerror
+ap_regexec
+ap_field_noparam
+ap_pbase64decode
+ap_pbase64encode
+ap_base64encode
+ap_base64encode_binary
+ap_base64encode_len
+ap_base64decode
+ap_base64decode_binary
+ap_base64decode_len
+ap_SHA1Init
+ap_SHA1Update_binary
+ap_SHA1Update
+ap_SHA1Final
+ap_sha1_base64
+ap_my_generation
+apache_main
+ap_get_virthost_addr
+ap_listeners
+ap_listenbacklog
+
diff --git a/usr.sbin/httpd/src/os/netware/ApacheCoreNW.def b/usr.sbin/httpd/src/os/netware/ApacheCoreNW.def
new file mode 100644
index 00000000000..f171a764a66
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheCoreNW.def
@@ -0,0 +1,4 @@
+MODULE CLIB.NLM
+MODULE WS2_32.NLM
+IMPORT KillMe
+EXPORT @apachecore.imp
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleAuthAnon.def b/usr.sbin/httpd/src/os/netware/ApacheModuleAuthAnon.def
new file mode 100644
index 00000000000..7465f677d16
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleAuthAnon.def
@@ -0,0 +1,2 @@
+EXPORT anon_auth_module
+
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleCERNMeta.def b/usr.sbin/httpd/src/os/netware/ApacheModuleCERNMeta.def
new file mode 100644
index 00000000000..cb57210ebd5
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleCERNMeta.def
@@ -0,0 +1 @@
+EXPORT cern_meta_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleDigest.def b/usr.sbin/httpd/src/os/netware/ApacheModuleDigest.def
new file mode 100644
index 00000000000..74575fff4f3
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleDigest.def
@@ -0,0 +1 @@
+EXPORT digest_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleExpires.def b/usr.sbin/httpd/src/os/netware/ApacheModuleExpires.def
new file mode 100644
index 00000000000..b48301ca058
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleExpires.def
@@ -0,0 +1 @@
+EXPORT expires_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleHeaders.def b/usr.sbin/httpd/src/os/netware/ApacheModuleHeaders.def
new file mode 100644
index 00000000000..5c765c286e2
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleHeaders.def
@@ -0,0 +1 @@
+EXPORT headers_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleInfo.def b/usr.sbin/httpd/src/os/netware/ApacheModuleInfo.def
new file mode 100644
index 00000000000..66690990048
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleInfo.def
@@ -0,0 +1,2 @@
+EXPORT info_module
+
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleProxy.def b/usr.sbin/httpd/src/os/netware/ApacheModuleProxy.def
new file mode 100644
index 00000000000..7b1c93b7d75
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleProxy.def
@@ -0,0 +1 @@
+EXPORT proxy_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleRewrite.def b/usr.sbin/httpd/src/os/netware/ApacheModuleRewrite.def
new file mode 100644
index 00000000000..2f7d7e8c113
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleRewrite.def
@@ -0,0 +1 @@
+EXPORT rewrite_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleSpeling.def b/usr.sbin/httpd/src/os/netware/ApacheModuleSpeling.def
new file mode 100644
index 00000000000..dec9ffc3662
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleSpeling.def
@@ -0,0 +1,2 @@
+EXPORT speling_module
+
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleStatus.def b/usr.sbin/httpd/src/os/netware/ApacheModuleStatus.def
new file mode 100644
index 00000000000..06f9577ceac
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleStatus.def
@@ -0,0 +1 @@
+EXPORT status_module
diff --git a/usr.sbin/httpd/src/os/netware/ApacheModuleUserTrack.def b/usr.sbin/httpd/src/os/netware/ApacheModuleUserTrack.def
new file mode 100644
index 00000000000..bd975910c23
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/ApacheModuleUserTrack.def
@@ -0,0 +1 @@
+EXPORT usertrack_module
diff --git a/usr.sbin/httpd/src/os/netware/getopt.c b/usr.sbin/httpd/src/os/netware/getopt.c
new file mode 100644
index 00000000000..969a5629e7d
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/getopt.c
@@ -0,0 +1,161 @@
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#define OPTERRCOLON (1)
+#define OPTERRNF (2)
+#define OPTERRARG (3)
+
+char *optarg;
+int optind = 1;
+int opterr = 1;
+int optopt;
+
+static int
+optiserr(int argc, char * const *argv, int oint, const char *optstr,
+ int optchr, int err)
+{
+ if (opterr) {
+ fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr + 1);
+
+ switch (err) {
+ case OPTERRCOLON:
+ fprintf(stderr, ": in flags\n");
+ break;
+ case OPTERRNF:
+ fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
+ break;
+ case OPTERRARG:
+ fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
+ break;
+ default:
+ fprintf(stderr, "unknown\n");
+ break;
+ }
+ }
+ optopt = argv[oint][optchr];
+ return('?');
+}
+
+int
+getopt(int argc, char* const *argv, const char *optstr)
+{
+ static int optchr = 0;
+ static int dash = 0; /* have already seen the - */
+
+ char *cp;
+
+ if (optind >= argc)
+ return(EOF);
+
+ if (!dash && (argv[optind][0] != '-'))
+ return(EOF);
+
+ if (!dash && (argv[optind][0] == '-') && !argv[optind][1]) {
+ /*
+ * use to specify stdin. Need to let pgm process this and
+ * the following args
+ */
+ return(EOF);
+ }
+
+ if ((argv[optind][0] == '-') && (argv[optind][1] == '-')) {
+ /* -- indicates end of args */
+ optind++;
+ return(EOF);
+ }
+
+ if (!dash) {
+ assert((argv[optind][0] == '-') && argv[optind][1]);
+ dash = 1;
+ optchr = 1;
+ }
+
+ /* Check if the guy tries to do a -: kind of flag */
+ assert(dash);
+ if (argv[optind][optchr] == ':') {
+ dash = 0;
+ optind++;
+ return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRCOLON));
+ }
+
+ if (!(cp = strchr(optstr, argv[optind][optchr]))) {
+ int errind = optind;
+ int errchr = optchr;
+
+ if (!argv[optind][optchr+1]) {
+ dash = 0;
+ optind++;
+ }
+ else
+ optchr++;
+ return(optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
+ }
+
+ if (cp[1] == ':') {
+ dash = 0;
+ optind++;
+
+ if(optind == argc)
+ return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRARG));
+ optarg = argv[optind++];
+ return(*cp);
+ } else {
+ if (!argv[optind][optchr+1]) {
+ dash = 0;
+ optind++;
+ }
+ else
+ optchr++;
+ return(*cp);
+ }
+ assert(0);
+ return(0);
+}
+
+#ifdef TESTGETOPT
+int main(int argc, char **argv)
+{
+ int c;
+ extern char *optarg;
+ extern int optind;
+ int aflg = 0;
+ int bflg = 0;
+ int errflg = 0;
+ char *ofile = NULL;
+
+ while ((c = getopt(argc, argv, "abo:")) != EOF)
+ switch (c) {
+ case 'a':
+ if (bflg)
+ errflg++;
+ else
+ aflg++;
+ break;
+ case 'b':
+ if (aflg)
+ errflg++;
+ else
+ bflg++;
+ break;
+ case 'o':
+ ofile = optarg;
+ (void)printf("ofile = %s\n", ofile);
+ break;
+ case '?':
+ errflg++;
+ }
+
+ if (errflg) {
+ (void)fprintf(stderr, "usage: cmd [-a|-b] [-o <filename>] files...\n");
+ exit(2);
+ }
+
+ for ( ; optind < argc; optind++)
+ (void)printf("%s\n", argv[optind]);
+
+ return 0;
+}
+
+#endif /* TESTGETOPT */ \ No newline at end of file
diff --git a/usr.sbin/httpd/src/os/netware/getopt.h b/usr.sbin/httpd/src/os/netware/getopt.h
new file mode 100644
index 00000000000..f0a4e696ce3
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/getopt.h
@@ -0,0 +1,10 @@
+#ifndef GETOPT_H
+#define GETOPT_H
+
+extern char *optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
+int getopt(int argc, char* const *argv, const char *optstr);
+
+#endif /* GETOPT_H */ \ No newline at end of file
diff --git a/usr.sbin/httpd/src/os/netware/main_nlm.c b/usr.sbin/httpd/src/os/netware/main_nlm.c
new file mode 100644
index 00000000000..5950d4f73b5
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/main_nlm.c
@@ -0,0 +1,10 @@
+/* main_NLM.c - Apache executable stub file for NetWare
+ * This file's purpose in life is to load, and call the
+ * "real" main function, apache_main(), located in ApacheC.nlm
+ */
+int apache_main(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+ return apache_main(argc, argv);
+}
diff --git a/usr.sbin/httpd/src/os/netware/mod_nlm.c b/usr.sbin/httpd/src/os/netware/mod_nlm.c
new file mode 100644
index 00000000000..2b1aabd5f55
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/mod_nlm.c
@@ -0,0 +1,148 @@
+/* ====================================================================
+ * 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/>.
+ *
+ */
+
+#include "httpd.h"
+#include "http_config.h"
+#include <nwadv.h>
+
+module MODULE_VAR_EXPORT nlm_module;
+static int been_there_done_that = 0; /* Loaded the modules yet? */
+
+char *load_module(cmd_parms *cmd, void *dummy, char *modname, char *filename)
+{
+ module *modp;
+ int nlmHandle;
+ const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
+
+ if (been_there_done_that)
+ return NULL;
+
+ nlmHandle = FindNLMHandle(filename);
+
+ if (nlmHandle == NULL) {
+ spawnlp(P_NOWAIT, szModuleFile, NULL);
+ nlmHandle = FindNLMHandle(filename);
+
+ if (nlmHandle == NULL)
+ return ap_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
+ " into server", NULL);
+ }
+
+ modp = (module *) ImportSymbol(nlmHandle, modname);
+
+ if (!modp)
+ return ap_pstrcat(cmd->pool, "Can't find module ", modname,
+ " in file ", filename, NULL);
+
+ ap_add_module(modp);
+
+ if (modp->create_server_config)
+ ((void**)cmd->server->module_config)[modp->module_index] =
+ (*modp->create_server_config)(cmd->pool, cmd->server);
+
+ if (modp->create_dir_config)
+ ((void**)cmd->server->lookup_defaults)[modp->module_index] =
+ (*modp->create_dir_config)(cmd->pool, NULL);
+
+ return NULL;
+}
+
+char *load_file(cmd_parms *cmd, void *dummy, char *filename)
+{
+ if (been_there_done_that)
+ return NULL;
+
+ if (spawnlp(P_NOWAIT, ap_server_root_relative(cmd->pool, filename), NULL))
+ return ap_pstrcat(cmd->pool, "Cannot load ", filename, " into server", NULL);
+
+ return NULL;
+}
+
+void check_loaded_modules(server_rec *dummy, pool *p)
+{
+ if (been_there_done_that)
+ return;
+
+ been_there_done_that = 1;
+}
+
+command_rec nlm_cmds[] = {
+{ "LoadModule", load_module, NULL, RSRC_CONF, TAKE2,
+ "a module name, and the name of a file to load it from"},
+{ "LoadFile", load_file, NULL, RSRC_CONF, ITERATE,
+ "files or libraries to link into the server at runtime"},
+{ NULL }
+};
+
+module nlm_module = {
+ STANDARD_MODULE_STUFF,
+ check_loaded_modules, /* initializer */
+ NULL, /* create per-dir config */
+ NULL, /* merge per-dir config */
+ NULL, /* server config */
+ NULL, /* merge server config */
+ nlm_cmds, /* command table */
+ NULL, /* handlers */
+ NULL, /* filename translation */
+ NULL, /* check_user_id */
+ NULL, /* check auth */
+ NULL, /* check access */
+ NULL, /* type_checker */
+ NULL, /* logger */
+ NULL /* header parser */
+};
+
diff --git a/usr.sbin/httpd/src/os/netware/modules.c b/usr.sbin/httpd/src/os/netware/modules.c
new file mode 100644
index 00000000000..16e6688a762
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/modules.c
@@ -0,0 +1,70 @@
+/* modules.c --- major modules compiled into Apache for NetWare.
+ * Only insert an entry for a module if it must be compiled into
+ * the core server
+ */
+
+#include "httpd.h"
+#include "http_config.h"
+
+extern module core_module;
+extern module so_module;
+extern module mime_module;
+extern module access_module;
+extern module auth_module;
+extern module negotiation_module;
+extern module includes_module;
+extern module autoindex_module;
+extern module dir_module;
+// extern module cgi_module;
+extern module userdir_module;
+extern module alias_module;
+extern module env_module;
+extern module config_log_module;
+extern module asis_module;
+extern module imap_module;
+extern module action_module;
+extern module setenvif_module;
+
+module *ap_prelinked_modules[] = {
+ &core_module,
+ &so_module,
+ &mime_module,
+ &access_module,
+ &auth_module,
+ &negotiation_module,
+ &includes_module,
+ &autoindex_module,
+ &dir_module,
+// &cgi_module,
+ &userdir_module,
+ &alias_module,
+ &env_module,
+ &config_log_module,
+ &asis_module,
+ &imap_module,
+ &action_module,
+ &setenvif_module,
+ NULL
+};
+
+module *ap_preloaded_modules[] = {
+ &core_module,
+ &so_module,
+ &mime_module,
+ &access_module,
+ &auth_module,
+ &negotiation_module,
+ &includes_module,
+ &autoindex_module,
+ &dir_module,
+// &cgi_module,
+ &userdir_module,
+ &alias_module,
+ &env_module,
+ &config_log_module,
+ &asis_module,
+ &imap_module,
+ &action_module,
+ &setenvif_module,
+ NULL
+};
diff --git a/usr.sbin/httpd/src/os/netware/multithread.c b/usr.sbin/httpd/src/os/netware/multithread.c
new file mode 100644
index 00000000000..2b306d8fe9d
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/multithread.c
@@ -0,0 +1,102 @@
+
+#include "ap_config.h"
+#include "httpd.h"
+#include "http_conf_globals.h"
+#include "multithread.h"
+#include <nwsemaph.h>
+
+
+
+thread *create_thread(void (thread_fn)(void *), void *thread_arg)
+{
+ int rv;
+
+ rv = BeginThread(thread_fn, NULL, ap_thread_stack_size, thread_arg);
+ return((thread *)rv);
+}
+
+int kill_thread(thread *thread_id)
+{
+ return(0);
+}
+
+int await_thread(thread *thread_id, int sec_to_wait)
+{
+ return(0);
+}
+
+void exit_thread(int status)
+{}
+
+void free_thread(thread *thread_id)
+{}
+
+
+mutex * ap_create_mutex(char *name)
+{
+ return(malloc(1));
+}
+
+mutex * ap_open_mutex(char *name)
+{
+ return((mutex*)EnterCritSec());
+}
+
+int ap_acquire_mutex(mutex *mutex_id)
+{
+ return(EnterCritSec());
+}
+
+int ap_release_mutex(mutex *mutex_id)
+{
+ return(ExitCritSec());
+}
+
+void ap_destroy_mutex(mutex *mutex_id)
+{
+ free(mutex_id);
+}
+
+
+semaphore *create_semaphore(int initial)
+{
+ return((semaphore*)OpenLocalSemaphore(initial));
+}
+int acquire_semaphore(semaphore *semaphore_id)
+{
+ return(WaitOnLocalSemaphore((long)semaphore_id));
+}
+int release_semaphore(semaphore *semaphore_id)
+{
+ return(SignalLocalSemaphore((long)semaphore_id));
+}
+void destroy_semaphore(semaphore *semaphore_id)
+{
+ CloseLocalSemaphore((long)semaphore_id);
+}
+
+event *create_event(int manual, int initial, char *name)
+{
+ return(NULL);
+}
+event *open_event(char *name)
+{
+ return(NULL);
+}
+int acquire_event(event *event_id)
+{
+ return(0);
+}
+int set_event(event *event_id)
+{
+ return(0);
+}
+int reset_event(event *event_id)
+{
+ return(0);
+}
+void destroy_event(event *event_id)
+{}
+
+
+
diff --git a/usr.sbin/httpd/src/os/netware/os.c b/usr.sbin/httpd/src/os/netware/os.c
new file mode 100644
index 00000000000..1518ba5e8b5
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/os.c
@@ -0,0 +1,124 @@
+/* ====================================================================
+ * 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/>.
+ *
+ */
+
+#include "ap_config.h"
+
+void ap_os_dso_init(void)
+{
+}
+
+void *ap_os_dso_load(const char *path)
+{
+ unsigned int nlmHandle;
+ char *moduleName = NULL;
+
+ moduleName = strrchr(path, '/');
+
+ if (moduleName)
+ moduleName++;
+
+ nlmHandle = FindNLMHandle((char*)moduleName);
+
+ if (nlmHandle == NULL) {
+ spawnlp(P_NOWAIT | P_SPAWN_IN_CURRENT_DOMAIN, path, NULL);
+ nlmHandle = FindNLMHandle((char *)moduleName);
+ }
+
+ return (void *)nlmHandle;
+}
+
+void ap_os_dso_unload(void *handle)
+{
+ KillMe(handle);
+}
+
+void *ap_os_dso_sym(void *handle, const char *symname)
+{
+ return ImportSymbol((int)GetNLMHandle(), (char *)symname);
+}
+
+const char *ap_os_dso_error(void)
+{
+ return NULL;
+}
+
+char *remove_filename(char* str)
+{
+ int i, len = strlen(str);
+
+ for (i=len; i; i--) {
+ if (str[i] == '\\' || str[i] == '/') {
+ str[i] = NULL;
+ break;
+ }
+ }
+ return str;
+}
+
+char *bslash2slash(char* str)
+{
+ int i, len = strlen(str);
+
+ for (i=0; i<len; i++) {
+ if (str[i] == '\\') {
+ str[i] = '/';
+ break;
+ }
+ }
+ return str;
+}
+
diff --git a/usr.sbin/httpd/src/os/netware/os.h b/usr.sbin/httpd/src/os/netware/os.h
new file mode 100644
index 00000000000..6463ab13553
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/os.h
@@ -0,0 +1,143 @@
+/* ====================================================================
+ * 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_OS_H
+#define APACHE_OS_H
+
+#define PLATFORM "NETWARE"
+
+/*
+ * This file in included in all Apache source code. It contains definitions
+ * of facilities available on _this_ operating system (HAVE_* macros),
+ * and prototypes of OS specific functions defined in os.c or os-inline.c
+ */
+
+typedef int int32;
+typedef int uid_t;
+typedef int gid_t;
+
+#include "ap_config.h"
+#include <string.h>
+#include <stddef.h>
+#include <nwthread.h>
+#include <nwmalloc.h>
+#include <nwnamspc.h>
+#include <nwadv.h>
+#include <ws2nlm.h>
+#include <winsock2.h>
+#include <fcntl.h>
+
+#define NO_LINGCLOSE
+#define NO_SLACK
+#define HAVE_UNISTD_H
+#define NO_SETSID
+#define NO_KILLPG
+#define NO_WRITEV
+#define NO_GETTIMEOFDAY
+#define NO_TIMES
+#define NO_USE_SIGACTION
+#define USE_LONGJMP
+#define MULTITHREAD
+
+#define NO_RELIABLE_PIPED_LOGS
+#define CASE_BLIND_FILESYSTEM
+#define NO_OTHER_CHILD
+
+#define USE_HSREGEX
+#define NETDB_USE_INTERNET
+#define N_PLAT_NLM
+#define APX386
+#define ALLOC_USE_MALLOC
+#define OPTIMIZE_TIMEOUTS
+#define FD_SETSIZE 128
+#define NO_DBM_REWRITEMAP
+
+
+
+#define crypt(buf,salt) (buf)
+#define sleep(t) delay(t*1000)
+#define getpid GetThreadID
+#define lstat(x, y) stat(x, y)
+#define ap_os_is_filename_valid(f) (1)
+#define strcasecmp(s1, s2) stricmp(s1, s2)
+#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
+#define mktemp(s) tmpnam(s)
+#define _getch(c) getch(c)
+
+
+/* Prototypes */
+void AMCSocketCleanup(void);
+static void clean_parent_exit(int code);
+
+inline int ap_os_is_path_absolute(const char *file)
+{
+ if (strstr(file, ":/"))
+ return 1;
+ else
+ return 0;
+}
+
+#define ap_os_dso_handle_t void *
+void ap_os_dso_init(void);
+void *ap_os_dso_load(const char *);
+void ap_os_dso_unload(void *);
+void *ap_os_dso_sym(void *, const char *);
+const char *ap_os_dso_error(void);
+char *remove_filename(char*);
+char *bslash2slash(char*);
+#endif /*! APACHE_OS_H*/
+
diff --git a/usr.sbin/httpd/src/os/netware/precomp.h b/usr.sbin/httpd/src/os/netware/precomp.h
new file mode 100644
index 00000000000..b5c7d0f86b9
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/precomp.h
@@ -0,0 +1,11 @@
+#pragma precompile_target "precomp.mch"
+#define NETWARE
+
+#ifndef __int64
+#define __int64 long long
+#endif
+
+
+
+
+
diff --git a/usr.sbin/httpd/src/os/netware/test_char.h b/usr.sbin/httpd/src/os/netware/test_char.h
new file mode 100644
index 00000000000..bd26df220aa
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/test_char.h
@@ -0,0 +1,21 @@
+/* this file is automatically generated by gen_test_char, do not edit */
+#define T_ESCAPE_SHELL_CMD (1)
+#define T_ESCAPE_PATH_SEGMENT (2)
+#define T_OS_ESCAPE_PATH (4)
+#define T_HTTP_TOKEN_STOP (8)
+
+static const unsigned char test_char_table[256] = {
+ 0,14,14,14,14,14,14,14,14,14,15,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,0,7,6,1,6,1,1,
+ 9,9,1,0,8,0,0,10,0,0,0,0,0,0,0,0,0,0,8,15,
+ 15,8,15,15,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,15,15,15,7,0,7,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,15,7,15,1,14,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
+};
diff --git a/usr.sbin/httpd/src/os/netware/uri_delims.h b/usr.sbin/httpd/src/os/netware/uri_delims.h
new file mode 100644
index 00000000000..0c855bf7269
--- /dev/null
+++ b/usr.sbin/httpd/src/os/netware/uri_delims.h
@@ -0,0 +1,16 @@
+/* this file is automatically generated by gen_uri_delims, do not edit */
+static const unsigned char uri_delims[256] = {
+ T_NUL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T_HASH,0,0,0,0,
+ 0,0,0,0,0,0,0,T_SLASH,0,0,0,0,0,0,0,0,0,0,T_COLON,0,
+ 0,0,0,T_QUESTION,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
diff --git a/usr.sbin/httpd/src/os/os390/Makefile.tmpl b/usr.sbin/httpd/src/os/os390/Makefile.tmpl
new file mode 100644
index 00000000000..5592c9300fa
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/Makefile.tmpl
@@ -0,0 +1,72 @@
+CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
+LIBS=$(EXTRA_LIBS) $(LIBS1)
+INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
+LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+
+OBJS= os.o os-inline.o ebcdic.o
+
+LIB= libos.a
+
+all: $(LIB)
+
+$(LIB): $(OBJS)
+ rm -f $@
+ ar cr $@ $(OBJS)
+ $(RANLIB) $@
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $<
+
+clean:
+ rm -f $(OBJS) $(LIB)
+
+distclean: clean
+ -rm -f Makefile
+
+# We really don't expect end users to use this rule. It works only with
+# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
+# using it.
+depend:
+ cp Makefile.tmpl Makefile.tmpl.bak \
+ && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
+ && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
+ && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
+ -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
+ > Makefile.tmpl \
+ && rm Makefile.new
+
+$(OBJS): Makefile
+
+# DO NOT REMOVE
+
+ebcdic.o: ebcdic.c
+ebcdic.o: $(INCDIR)/ap_config.h
+ebcdic.o: $(INCDIR)/ap_mmn.h
+ebcdic.o: $(INCDIR)/ap_config_auto.h
+ebcdic.o: os.h
+ebcdic.o: $(INCDIR)/ap_ctype.h
+ebcdic.o: $(INCDIR)/hsregex.h
+ebcdic.o: ebcdic.h
+os-inline.o: os-inline.c
+os-inline.o: $(INCDIR)/ap_config.h
+os-inline.o: $(INCDIR)/ap_mmn.h
+os-inline.o: $(INCDIR)/ap_config_auto.h
+os-inline.o: os.h
+os-inline.o: $(INCDIR)/ap_ctype.h
+os-inline.o: $(INCDIR)/hsregex.h
+os.o: os.c
+os.o: $(INCDIR)/httpd.h
+os.o: $(INCDIR)/ap_config.h
+os.o: $(INCDIR)/ap_mmn.h
+os.o: $(INCDIR)/ap_config_auto.h
+os.o: os.h
+os.o: $(INCDIR)/ap_ctype.h
+os.o: $(INCDIR)/hsregex.h
+os.o: $(INCDIR)/alloc.h
+os.o: $(INCDIR)/buff.h
+os.o: $(INCDIR)/ap.h
+os.o: ebcdic.h
+os.o: $(INCDIR)/util_uri.h
+os.o: $(INCDIR)/http_core.h
+
+
diff --git a/usr.sbin/httpd/src/os/os390/README.os390 b/usr.sbin/httpd/src/os/os390/README.os390
new file mode 100644
index 00000000000..547b3f6633a
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/README.os390
@@ -0,0 +1,86 @@
+README.os390
+==============
+
+This file describes how one extracts the apache source files from a compressed
+archive on one of the apache source code distribution web pages to an OS/390
+system. OS/390 represents characters with the ebcdic code set. The files
+in the apache source trees on the web represent characters using the ascii
+code set. The procedure described here de-compresses the archive file and
+extracts the files from the archive while translating characters in the files
+from ascii to ebcdic. Once you download the compressed archive to an OS/390
+system and follow this procedure, you will be ready to configure, compile, and
+install apache on your OS/390 system.
+
+This procedure assumes that you will download the apache tree using a browser
+on a workstation and then you will transfer the compressed archive from your
+workstation to an OS/390 system. You could probably just ftp the compressed
+archive to your OS/390 system ifyou like. If you download to a workstation as
+described here, it is assumed that the workstation has TCP/IP and FTP installed
+on it. It is also assumed that you have TCP/IP and FTP access from the
+workstation to the OS/390 system you want to put apache on.
+
+Procedure for extracting apache source to an OS/390 system:
+-----------------------------------------------------------
+
+- From either www.apache.org/dist or from dev.apache.org/from-CVS/apache-version
+ select one of the source trees with a file type of .tar.gz or .tar.Z and
+ download it to your workstation. Ensure that the name of the downloaded
+ file remains the same as the name of the file on the web page.
+
+- Also from the same web page download xebcdic.sh.
+
+- From your workstation ftp to the OS/390 system you would like to run apache
+ on.
+ - ftp os390-host-name
+ - You'll be prompted for user id and password.
+ - Once you've logged in successfully you'll get the ftp prompt.
+
+- FTP the .tar.gz file and xebcdic.sh files you downloaded to your workstation
+ to the OS/390 system. The xebcdic.sh file must be ftp'ed in ascii mode. The
+ apache compressed archive file must be ftp'ed in binary mode.
+ - put xebcdic.sh
+ - bin
+ - put apache-compressed-archive-file-name
+
+- End your ftp connection.
+ - bye or quit
+
+- From your OS/390 system use the xebcdic.sh shell script to de-compress and
+ extract the apache source. This script will de-compress the apache source
+ tree and will then extract all the files from the archive. As the files are
+ extracted, they are all translated from ascii to ebcdic. All the gif files
+ are then re-extracted from the archive without applying the ascii to ebcdic
+ translation so that they won't be corrupted.
+
+ The name of the compressed archive file you specify to xebcdic.sh must follow
+ the following format:
+
+ apache-version_timeStamp.tar.gz or
+ apache-version_timeStamp.tar.Z or
+ apache-version.tar.gz or
+ apache-version.tar.Z or
+ apache_version.tar.gz or
+ apache_version.tar.Z
+
+ When you invoke the script, you may specify which file types should be
+ re-extracted without applying the ascii to ebcdic translation. This can be
+ used to save static pages as ascii improving performance when serving those
+ pages by avoiding the ebcdic to ascii translation at the time they are served.
+ Please refer to top-of-source-tree/src/README.ebcdic for information on how
+ to use the AddType and DefaultType directives to serve static pages without
+ trying to translate from ebcdic to ascii.
+
+ - To extract the source tree and have html and txt files re-extracted
+ without translation specify the following:
+
+ ./xebcdic.sh apache-compressed-archive-file-name --f=*.html --f=*.txt
+
+ - To extract the source tree and have the static text content files that
+ are part of the source tree stored on your OS/390 system in ascii specify
+ the following:
+
+ ./xebcdic.sh apache-compressed-archive-file-name --all-ascii-content
+
+- The apache source tree is now ready for you to configure, make and install.
+ Refer to top-of-source-tree/INSTALL for directions on how to proceed.
+
diff --git a/usr.sbin/httpd/src/os/os390/ebcdic.h b/usr.sbin/httpd/src/os/os390/ebcdic.h
new file mode 100644
index 00000000000..82b6f699be8
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/ebcdic.h
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+extern const unsigned char os_toascii[256];
+extern const unsigned char os_toebcdic[256];
+void ebcdic2ascii(void *dest, const void *srce, size_t count);
+void ascii2ebcdic(void *dest, const void *srce, size_t count);
diff --git a/usr.sbin/httpd/src/os/os390/os-inline.c b/usr.sbin/httpd/src/os/os390/os-inline.c
new file mode 100644
index 00000000000..e58917af369
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/os-inline.c
@@ -0,0 +1,31 @@
+/*
+ * This file contains functions which can be inlined if the compiler
+ * has an "inline" modifier. Because of this, this file is both a
+ * header file and a compilable module.
+ *
+ * Only inlineable functions should be defined in here. They must all
+ * include the INLINE modifier.
+ *
+ * If the compiler supports inline, this file will be #included as a
+ * header file from os.h to create all the inline function
+ * definitions. INLINE will be defined to whatever is required on
+ * function definitions to make them inline declarations.
+ *
+ * If the compiler does not support inline, this file will be compiled
+ * as a normal C file into libos.a (along with os.c). In this case
+ * INLINE will _not_ be set so we can use this to test if we are
+ * compiling this source file.
+ */
+
+#ifndef INLINE
+#define INLINE
+
+/* Anything required only when compiling */
+#include "ap_config.h"
+
+#endif
+
+INLINE int ap_os_is_path_absolute(const char *file)
+{
+ return (file && file[0] == '/' ? 1 : 0);
+}
diff --git a/usr.sbin/httpd/src/os/os390/os.c b/usr.sbin/httpd/src/os/os390/os.c
new file mode 100644
index 00000000000..c33810a2f0d
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/os.c
@@ -0,0 +1,103 @@
+/* ====================================================================
+ * 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/>.
+ *
+ */
+
+/*
+ * This file will include OS specific functions which are not inlineable.
+ * Any inlineable functions should be defined in os-inline.c instead.
+ */
+
+#include "httpd.h"
+#include "http_core.h"
+#include "os.h"
+
+/* Check the Content-Type to decide if conversion is needed */
+int ap_checkconv(struct request_rec *r)
+{
+ int convert_to_ascii;
+ const char *type;
+
+ /* To make serving of "raw ASCII text" files easy (they serve faster
+ * since they don't have to be converted from EBCDIC), a new
+ * "magic" type prefix was invented: text/x-ascii-{plain,html,...}
+ * If we detect one of these content types here, we simply correct
+ * the type to the real text/{plain,html,...} type. Otherwise, we
+ * set a flag that translation is required later on.
+ */
+
+ type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type;
+
+ /* If no content type is set then treat it as (ebcdic) text/plain */
+ convert_to_ascii = (type == NULL);
+
+ /* Conversion is applied to text/ files only, if ever. */
+ if (type && (strncasecmp(type, "text/", 5) == 0 ||
+ strncasecmp(type, "message/", 8) == 0)) {
+ if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX,
+ sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0)
+ r->content_type = ap_pstrcat(r->pool, "text/",
+ type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1,
+ NULL);
+ else
+ /* translate EBCDIC to ASCII */
+ convert_to_ascii = 1;
+ }
+ /* Enable conversion if it's a text document */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
+
+ return convert_to_ascii;
+}
+
diff --git a/usr.sbin/httpd/src/os/os390/os.h b/usr.sbin/httpd/src/os/os390/os.h
new file mode 100644
index 00000000000..4aec04aa5f5
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/os.h
@@ -0,0 +1,40 @@
+#ifndef APACHE_OS_H
+#define APACHE_OS_H
+
+#define PLATFORM "OS390"
+
+/*
+ * This file in included in all Apache source code. It contains definitions
+ * of facilities available on _this_ operating system (HAVE_* macros),
+ * and prototypes of OS specific functions defined in os.c or os-inline.c
+ */
+
+#if !defined(INLINE) && defined(USE_GNU_INLINE)
+/* Compiler supports inline, so include the inlineable functions as
+ * part of the header
+ */
+#define INLINE extern ap_inline
+
+INLINE int ap_os_is_path_absolute(const char *file);
+
+#include "os-inline.c"
+#endif
+
+#ifndef INLINE
+/* Compiler does not support inline, so prototype the inlineable functions
+ * as normal
+ */
+extern int ap_os_is_path_absolute(const char *file);
+#endif
+
+/* Other ap_os_ routines not used by this platform */
+
+#define ap_os_is_filename_valid(f) (1)
+#define ap_os_kill(pid, sig) kill(pid, sig)
+
+/* Sorry if this is ugly, but the include order doesn't allow me
+ * to use request_rec here... */
+struct request_rec;
+extern int ap_checkconv(struct request_rec *r);
+
+#endif /*! APACHE_OS_H*/
diff --git a/usr.sbin/httpd/src/os/os390/xebcdic.sh b/usr.sbin/httpd/src/os/os390/xebcdic.sh
new file mode 100644
index 00000000000..8aa69980658
--- /dev/null
+++ b/usr.sbin/httpd/src/os/os390/xebcdic.sh
@@ -0,0 +1,202 @@
+#!/bin/sh
+#
+# xebcdic.sh fileName [--all-ascii-content] [--f=pattern ... ]
+#
+# This shell script decompresses an archive containing an apache source tree
+# and then extracts the source files from the archive. The source files are
+# translated from ASCII to EBCDIC as they are extracted from the archive.
+# Once all the files have been extracted and translated, the binary files are
+# re-extracted to undo the ASCII to EBCDIC translation on those files. Once
+# this script is done, the extracted tree can be used on an EBCDIC based
+# system.
+#
+# Input: fileName -- fileName has one of the following formats:
+# apache-version_timeStamp.tar.gz or
+# apache-version_timeStamp.tar.Z or
+# apache-version.tar.gz or
+# apache-version.tar.Z or
+# apache_version.tar.gz or
+# apache_version.tar.Z
+#
+# --f=pattern -- specifies that all files which match the pattern
+# are to be re-extracted without ascii to ebcdic
+# translation being applied. pattern is a file name
+# specification that may contain path names and
+# the wildcard character. All paths are assumed to
+# be under the apache source tree top. Binary files
+# are always re-extracted without ascii to ebcdic
+# translation regardless of whether any pattern is
+# specified or not. Multiple patterns may be specified
+# by repeating this option.
+#
+#
+# --all-ascii-content -- specifies that all the text content shipped
+# with the apache tree should be stored in
+# ascii on the OS/390 system. This re-extracts
+# all the *.htm* files in the htdocs directory
+# of the apache tree without doing the ascii
+# to ebcdic translation. In addition to the
+# *.htm* files, file htdocs/manual/LICENSE and
+# file htdocs/manual/misc/HTTP_Features.tsv
+# are also stored in ascii. If this option
+# is specified, directives AddType and
+# DefaultType need to be used to correctly
+# serve the pages without trying to first
+# translate from ebcdic to ascii. See
+# apache-tree-top/src/README.EBCDIC.
+#
+# Example Invocations:
+#
+# ./xebcdic.sh apache_1.3.9.tar.gz: Runs gunzip, runs pax and
+# extracts everything translating it to ebcdic, and re-extracts
+# all gif files in the htdocs and icons directories without
+# applying ascii to ebcdic translation.
+#
+# ./xebcdic.sh apache_1.3.9.tar.gz --f=*.htm* --f=htdocs/*.tsv:
+# Runs gunzip, runs pax and extracts everything translating it to
+# ebcdic, re-extracts all gif files without ascii to ebcdic
+# translation, and re-extracts all the *.htm* files in the apache
+# source tree and all *.tsv files in the htdocs directory of the
+# apache source tree without ascii to ebcdic translation.
+#
+# ./xebcdic.sh apache_1.3.9.tar.gz --all-ascii-content: Runs gunzip,
+# runs pax and extracts everything translating it to ebcdic,
+# re-extracts all gif files without ascii to ebcdic translation,
+# and re-extracts all the *.htm* files in the htdocs directory
+# as well as htdocs/manual/LICENSE and
+# htdocs/manual/misc/HTTP_Features.tsv without ascii to ebcdic
+# translation.
+#
+# Output: fileName.tar.gz is replaced with fileName.tar and the apache
+# source tree is extracted into a directory named apache-version or
+# apache_version. All files except binary files and any files
+# specified through the options are translated from ascii to
+# ebcdic.
+#
+# Assumptions: The path to gunzip, uncompress and pax is defined and
+# from where this script is invoked.
+#
+
+echo "Input file name is: $1"
+
+# Verify fileName
+if ! echo $1 | grep -q 'apache_.*\.tar\.gz' && \
+ ! echo $1 | grep -q 'apache_.*\.tar\.Z' && \
+ ! echo $1 | grep -q 'apache-.*_.*\.tar\.gz' && \
+ ! echo $1 | grep -q 'apache-.*_.*\.tar\.Z' && \
+ ! echo $1 | grep -q 'apache-.*\.tar\.gz' && \
+ ! echo $1 | grep -q 'apache-.*\.tar\.Z'
+then
+ echo "Filename, $1, does not follow required format."
+ echo "Filename should have one of the following formats:"
+ echo "apache-version_timeStamp.tar.gz or"
+ echo "apache-version_timeStamp.tar.Z or"
+ echo "apache-version.tar.gz or"
+ echo "apache-version.tar.Z or"
+ echo "apache_version.tar.gz or"
+ echo "apache_version.tar.Z"
+ exit 1;
+fi
+
+if [ ! -f $1 ]; then
+ echo "$1 is not a file"
+ exit 1;
+fi
+
+if [ ! -a $1 ]; then
+ echo "$1 file does not exist"
+ exit 1;
+fi
+
+# Verify fileType option if specified
+for option in $@
+do
+ case "$option" in
+ $1) ;;
+ --all-ascii-content) ;;
+ --f=*) ;;
+ *) echo "Invalid option specified. Command syntax is:"
+ echo "xebcdic.sh compressed-archive-file-name [--all-ascii-content]"
+ echo " [--f=pattern ... ]"
+ exit 1;
+ ;;
+ esac
+done
+
+# Figure out whether to gunzip or uncompress
+if echo $1 | grep -q 'apache[-_].*\.tar\.gz'; then
+ DECOMPRESS="gunzip"
+else
+ DECOMPRESS="uncompress"
+fi
+echo "Decompression utility $DECOMPRESS will be used."
+
+# Set name of tar file after decompressing
+if [ "x$DECOMPRESS" = "xgunzip" ]; then
+ TARFILE=`echo $1 | sed s/\.tar\.gz/\.tar/`
+else
+ TARFILE=`echo $1 | sed s/\.tar\.Z/\.tar/`
+fi
+echo "Archive file name is: $TARFILE"
+
+# Set name of apache source tree directory
+if echo $1 | grep -q 'apache-.*_.*\.tar*'; then
+ APDIR=`echo $1 | sed s/_.*//`
+else
+ APDIR=`echo $1 | sed s/\.tar.*//`
+fi
+echo "Apache source tree top is: $APDIR"
+
+# Decompress input file
+echo "Starting decompression of $1"
+if [ "x$DECOMPRESS" = "xgunzip" ]; then
+ if gunzip $1; then
+ echo "Decompression of $1 completed successfully"
+ else
+ exit 1;
+ fi
+else
+ if uncompress $1; then
+ echo "Decompression of $1 completed successfully"
+ else
+ exit 1;
+ fi
+fi
+
+# Extract source files and translate them all from ASCII to EBCDIC
+
+# Determine code page for locale
+
+echo "Starting extraction of source files from archive $TARFILE."
+echo "ASCII being translated to EBCDIC."
+echo "ASCII code page assumed to be ISO8859-1."
+echo "EBCDIC code page assumed to be IBM-1047."
+pax -ofrom=ISO8859-1,to=IBM-1047 -rvf $TARFILE
+echo "Extraction and translation of source files from archive completed."
+
+# Re-extract gif files without ASCII to EBCDIC translation
+echo "Re-extracting gif files without ASCII to EBCDIC translation"
+pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.gif*")
+pax -rvf $TARFILE $(find $APDIR/icons -type f -name "*.gif*")
+
+# Re-extract appropriate files as requested by user
+for option in $@; do
+ case "$option" in
+ $1)
+ ;;
+ --all-ascii-content) echo "Re-extracting files in $APDIR/htdocs without ASCII to EBCDIC translation"
+ pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.htm*")
+ pax -rvf $TARFILE $(find $APDIR/htdocs -type f -name "*.tsv*")
+ pax -rvf $TARFILE $(find $APDIR/htdocs -name "manual/LICENSE")
+ ;;
+ --f=*) PATTERN=`echo $option | sed s/--f=//`
+ if [ "x$PATTERN" != "x" ]; then
+ echo "Re-extracting files matching $PATTERN without ASCII to EBCDIC translation"
+ pax -rvf $TARFILE $(find $APDIR -type f -name "$PATTERN")
+ fi
+ ;;
+ *)
+ ;;
+ esac
+done
+