summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>1999-05-09 20:51:22 +0000
committertron <tron@pkgsrc.org>1999-05-09 20:51:22 +0000
commit564122732e46406fcd0b98bb6251a90a50b6654e (patch)
tree819cb4863210b40f181cdf1c831d92dbb788d63e
parent9ce511fa5c4a137ffaa0ca8bb62c9c1d4c148595 (diff)
downloadpkgsrc-564122732e46406fcd0b98bb6251a90a50b6654e.tar.gz
Import FreeBSD's "w3c-httpd" port:
WWW server from the W3 Consortium (W3C).
-rw-r--r--www/w3c-httpd/Makefile49
-rw-r--r--www/w3c-httpd/files/md51
-rw-r--r--www/w3c-httpd/patches/patch-CacheCheckSize147
-rw-r--r--www/w3c-httpd/patches/patch-CacheDirs101
-rw-r--r--www/w3c-httpd/patches/patch-SSL532
-rw-r--r--www/w3c-httpd/patches/patch-aa12
-rw-r--r--www/w3c-httpd/patches/patch-ab22
-rw-r--r--www/w3c-httpd/patches/patch-ba42
-rw-r--r--www/w3c-httpd/patches/patch-bb19
-rw-r--r--www/w3c-httpd/patches/patch-bc81
-rw-r--r--www/w3c-httpd/patches/patch-ca12
-rw-r--r--www/w3c-httpd/pkg/COMMENT1
-rw-r--r--www/w3c-httpd/pkg/DESCR17
-rw-r--r--www/w3c-httpd/pkg/PLIST34
14 files changed, 1070 insertions, 0 deletions
diff --git a/www/w3c-httpd/Makefile b/www/w3c-httpd/Makefile
new file mode 100644
index 00000000000..b6376e29bd0
--- /dev/null
+++ b/www/w3c-httpd/Makefile
@@ -0,0 +1,49 @@
+# New ports collection makefile for: w3c-httpd
+# Version required: 3.0A
+# Date created: 29 October 1994
+# Whom: pst
+#
+# FreeBSD Id: Makefile,v 1.19 1999/01/08 19:59:26 fenner Exp
+#
+
+DISTNAME= w3c-httpd-3.0A
+CATEGORIES= www
+MASTER_SITES= ftp://ftp.w3.org/pub/httpd/ \
+ ftp://ftp-eu.w3.org/pub/httpd/
+
+MAINTAINER= giffunip@asme.org
+
+NO_WRKSUBDIR= yes
+
+BROKEN_ELF= yes
+
+WWW_ROOT= ${PREFIX}/www
+
+pre-configure:
+.if !defined(MD5_PW)
+ @echo ""
+ @echo "Defaulting to DES encrypted passwords."
+ @echo "Set the environment variable MD5_PW if you want MD5 encrypted passwords."
+ @echo ""
+.else
+ @echo "CFLAGS += -DMD5_PW" >> ${WRKDIR}/All/${OSNAME}/Makefile.include
+.endif
+
+do-install:
+ ${MKDIR} ${WWW_ROOT}/data ${WWW_ROOT}/cgi-bin ${WWW_ROOT}/htbin
+ ${CP} -R ${WRKSRC}/server_root/icons $(WWW_ROOT)
+ ${CP} ${WRKSRC}/server_root/config/*.conf $(PREFIX)/etc
+ ${INSTALL_PROGRAM} ${WRKSRC}/Daemon/${OSNAME}/httpd ${PREFIX}/libexec
+ ${INSTALL_PROGRAM} ${WRKSRC}/Daemon/${OSNAME}/htadm ${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/Daemon/${OSNAME}/htimage ${WWW_ROOT}/htbin
+ ${INSTALL_PROGRAM} ${WRKSRC}/Daemon/${OSNAME}/cgiparse ${WWW_ROOT}/cgi-bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/Daemon/${OSNAME}/cgiutils ${WWW_ROOT}/cgi-bin
+
+.include <bsd.port.mk>
+
+.if (${OPSYS} == "FreeBSD")
+OSNAME= freebsd
+.else
+# covers OpenBSD too
+OSNAME= netbsd
+.endif
diff --git a/www/w3c-httpd/files/md5 b/www/w3c-httpd/files/md5
new file mode 100644
index 00000000000..631df9aa37d
--- /dev/null
+++ b/www/w3c-httpd/files/md5
@@ -0,0 +1 @@
+MD5 (w3c-httpd-3.0A.tar.gz) = 8f9df48bb4fecdc6f1925573df8eb171
diff --git a/www/w3c-httpd/patches/patch-CacheCheckSize b/www/w3c-httpd/patches/patch-CacheCheckSize
new file mode 100644
index 00000000000..7f5c3983988
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-CacheCheckSize
@@ -0,0 +1,147 @@
+*** /dev/null Tue Feb 6 11:05:04 1996
+--- README-CACHE_CHECK_SIZE Tue Feb 6 13:27:32 1996
+***************
+*** 0 ****
+--- 1,11 ----
++ Patch to avoid serving truncated files from the cache.
++
++ Apply the patch, modify WWW/All/<model>/Makefile.include (for your model
++ system) and add '-DCACHE_CHECK_SIZE' to CFLAGS.
++
++ With the patch, the server checks the size of a file in the cache before
++ returning it to the user; if the size is incorrect, the server will
++ refresh the file in the cache.
++
++ --
++ -- 19960205, Gertjan van Oosten, gertjan@West.NL, West Consulting bv
+*** WWW/Daemon/Implementation/HTCache.c.orig Fri Aug 12 12:36:11 1994
+--- Daemon/Implementation/HTCache.c Mon Feb 5 14:02:11 1996
+***************
+*** 382,387 ****
+--- 382,437 ----
+ }
+
+
++ #ifdef CACHE_CHECK_SIZE
++ /*
++ ** Check whether cache file has correct size
++ **
++ ** On exit:
++ ** return YES
++ ** if size is good
++ ** return NO
++ ** if size is too small or too large
++ **
++ */
++ PRIVATE BOOL cache_check_size ARGS2(char *, cfn,
++ struct stat *, stat_info)
++ {
++ char buf[BUF_SIZE+2];
++ FILE *cf;
++ long cl = 0, pos, size, actual;
++
++ if (!cfn)
++ return NO;
++
++ cf = fopen(cfn, "r");
++ if (!cf)
++ return NO;
++
++ while (fgets(buf, sizeof(buf), cf)) {
++ if (!buf[0]
++ || (buf[0] == '\n' && !buf[1])
++ || (buf[0] == '\r' && buf[1] == '\n' && !buf[2]))
++ break;
++
++ if (!strncasecomp(buf, "content-length:", 15))
++ sscanf(buf+15, "%ld", &cl);
++ }
++ pos = ftell(cf);
++ fclose(cf);
++
++ size = stat_info->st_size;
++
++ actual = size - pos;
++ if (TRACE) {
++ fprintf(stderr,"Cache....... checking \"%s\": content-length %ld =?= %ld\n",
++ cfn,cl,actual);
++ }
++
++ return (cl == actual ? YES : NO);
++ }
++ #endif /* CACHE_CHECK_SIZE */
++
++
+ PRIVATE BOOL do_caching ARGS1(char *, url)
+ {
+ HTList * cur = cc.no_caching;
+***************
+*** 460,465 ****
+--- 510,518 ----
+ time_t *, expires)
+ {
+ struct stat stat_info;
++ #ifdef CACHE_CHECK_SIZE
++ BOOL size_ok;
++ #endif
+
+ if (!url || !cfn || !cf || !if_ms) return CACHE_NO;
+ *cfn = NULL;
+***************
+*** 497,503 ****
+--- 550,563 ----
+ }
+
+ success = HTCacheInfo_for(*cfn, &ld, &lc, &ex, &mu, &lm);
++ #ifdef CACHE_CHECK_SIZE
++ /* Check whether file in cache has correct size */
++ size_ok = cache_check_size(*cfn, &stat_info);
++ #endif
+ if (!success /* no entry */
++ #ifdef CACHE_CHECK_SIZE
++ || !size_ok /* wrong size */
++ #endif
+ || ex - cc.cache_time_margin <= cur_time /* expired */
+ || cur_time - lc >= refresh_interval /* time to refresh */
+ || in.no_cache_pragma) { /* override cache */
+***************
+*** 507,512 ****
+--- 567,576 ----
+ if (TRACE) {
+ if (!success)
+ fprintf(stderr, "NoEntry..... %s -- expiring\n",*cfn);
++ #ifdef CACHE_CHECK_SIZE
++ else if (!size_ok)
++ fprintf(stderr, "Truncated...... %s -- refresh\n",*cfn);
++ #endif
+ else if (in.no_cache_pragma)
+ fprintf(stderr, "Forced...... refresh of %s\n",*cfn);
+ else if (ex - cc.cache_time_margin <= cur_time)
+***************
+*** 527,533 ****
+--- 591,601 ----
+ if (cc.cache_no_connect) {
+ CTRACE(stderr, "Standalone.. caching mode but expired\n");
+ cache_hit = YES;
++ #ifdef CACHE_CHECK_SIZE
++ return size_ok ? CACHE_IF_MODIFIED : CACHE_CREATE;
++ #else
+ return CACHE_IF_MODIFIED;
++ #endif
+ }
+
+ if (!(*cf = do_lock(*cfn))) {
+***************
+*** 550,556 ****
+--- 618,628 ----
+ CTRACE(stderr,"IfModSince.. time: %s", ctime(if_ms));
+
+ free(backup);
++ #ifdef CACHE_CHECK_SIZE
++ return size_ok ? CACHE_IF_MODIFIED : CACHE_CREATE;
++ #else
+ return CACHE_IF_MODIFIED;
++ #endif
+ }
+ else {
+ CTRACE(stderr, "Cache....... not expired %s\n", *cfn);
diff --git a/www/w3c-httpd/patches/patch-CacheDirs b/www/w3c-httpd/patches/patch-CacheDirs
new file mode 100644
index 00000000000..db73a694a80
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-CacheDirs
@@ -0,0 +1,101 @@
+*** /dev/null Tue Feb 6 11:05:04 1996
+--- README-CACHEDIRS Tue Feb 6 13:03:37 1996
+***************
+*** 0 ****
+--- 1,12 ----
++ Patch to translate directory names in the cache from e.g.
++ /www-cache/http/www.some.where.org/
++ to
++ /www-cache/http/org/where/some/www/
++
++ Note that this can lead to unexpected problems, when you have two URLs
++ like <URL:http://some.where.org/www/> and <URL:http://www.some.where.org/>.
++ [This does happen, e.g. many sites out there have "some.where.org" and
++ "www.some.where.org" point to the same machine.]
++
++ --
++ -- 19950915, Gertjan van Oosten, gertjan@West.NL, West Consulting B.V.
+*** WWW/Daemon/Implementation/HTCache.c.orig Fri Aug 12 12:36:11 1994
+--- Daemon/Implementation/HTCache.c Fri Sep 15 16:25:33 1995
+***************
+*** 5,16 ****
+--- 5,19 ----
+ ** AUTHORS:
+ ** AL Ari Luotonen luotonen@dxcern.cern.ch
+ ** FM Fote Macrides macrides@sci.wfeb.edu
++ ** GJ Gertjan van Oosten gertjan@West.NL
+ **
+ ** HISTORY:
+ ** 31 Jan 94 AL Written from scratch on a *very* beautiful
+ ** Sunday afternoon -- seems like the spring
+ ** is already coming, yippee!
+ ** 8 Jul 94 FM Insulate free() from _free structure element.
++ ** 15 Sep 95 GJ Translate host names in cache to (reversed)
++ ** directories.
+ **
+ ** BUGS:
+ **
+***************
+*** 243,248 ****
+--- 246,252 ----
+ {
+ char * access = NULL;
+ char * host = NULL;
++ char * revhost = NULL;
+ char * path = NULL;
+ char * cfn = NULL;
+ BOOL welcome = NO;
+***************
+*** 274,291 ****
+ *cur = TOLOWER(*cur);
+ cur++;
+ }
+ }
+
+ cfn = (char*)malloc(strlen(cc.cache_root) +
+ strlen(access) +
+! (host ? strlen(host) : 0) +
+ (path ? strlen(path) : 0) +
+ (welcome ? strlen(WELCOME_FILE) : 0) + 3);
+ if (!cfn) outofmem(__FILE__, "cache_file_name");
+! sprintf(cfn, "%s/%s/%s%s%s", cc.cache_root, access, host, path,
+ (welcome ? WELCOME_FILE : ""));
+
+! FREE(access); FREE(host); FREE(path);
+
+ /*
+ ** This checks that the last component is not too long.
+--- 278,310 ----
+ *cur = TOLOWER(*cur);
+ cur++;
+ }
++ /*
++ ** Now transform host name from "www.some.where.org"
++ ** to "org/where/some/www".
++ ** [For nameless hosts, you'd want the IP address
++ ** translated from "10.127.7.254" to "10/127/7/254",
++ ** but that is left as an exercise.]
++ */
++ revhost = malloc(strlen(host)+1);
++ revhost[0] = '\0';
++ while (cur = strrchr(host, '.')) {
++ strcat(revhost, cur+1);
++ strcat(revhost, "/");
++ *cur = '\0';
++ }
++ strcat(revhost, host);
+ }
+
+ cfn = (char*)malloc(strlen(cc.cache_root) +
+ strlen(access) +
+! (revhost ? strlen(revhost) : 0) +
+ (path ? strlen(path) : 0) +
+ (welcome ? strlen(WELCOME_FILE) : 0) + 3);
+ if (!cfn) outofmem(__FILE__, "cache_file_name");
+! sprintf(cfn, "%s/%s/%s%s%s", cc.cache_root, access, revhost, path,
+ (welcome ? WELCOME_FILE : ""));
+
+! FREE(access); FREE(host); FREE(revhost); FREE(path);
+
+ /*
+ ** This checks that the last component is not too long.
diff --git a/www/w3c-httpd/patches/patch-SSL b/www/w3c-httpd/patches/patch-SSL
new file mode 100644
index 00000000000..fea2f33d83d
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-SSL
@@ -0,0 +1,532 @@
+============================================================================
+README:
+============================================================================
+
+OVERVIEW
+
+ This SSL tunneling patch for CERN httpd adds support for the
+ CONNECT method used by SSL enhanced clients to open a secure
+ tunnel through the proxy.
+
+THEORY
+
+ The CONNECT method takes
+
+ hostname:port
+
+ as its argument, and the request is in the form of the
+ HTTP/1.0 request (that is, the string "HTTP/1.0" and the
+ request headers must follow the request). Example:
+
+ CONNECT home1.netscape.com:443 HTTP/1.0<crlf>
+ <crlf>
+
+ The response will be either a normal HTTP/1.0 error response
+ (in case the host is unreachable for one reason or another),
+ or in case of success:
+
+ HTTP/1.0 200 Connection established<crlf>
+ <crlf>
+
+ after which the connection is open, and the client may start
+ the SSL handshake.
+
+ This is a superior approach because it allows the HTTP request
+ headers to be passed, making it possible to do authentication
+ on the proxy, and allows any other future extension.
+
+CONFIGURATION
+
+ Because the configuration of CERN httpd is based on URL
+ patterns, for ease of configuration, the hostname:port
+ argument in automatically transformed into an internal
+ representation:
+
+ connect://hostname:port
+
+ connect:// URLs do not exist in real life -- this is just a
+ notion in the configuration file to make life easier!!
+
+ENABLING
+
+ SSL tunneling is disabled by default. To enable it for HTTPS
+ (uses the port 443), add the following line in the
+ configuration file:
+
+ Pass connect://*:443
+
+ To enable secure news (SNEWS, uses port 563) tunneling, add
+ line:
+
+ Pass connect://*:563
+
+ DO NOT use trailing slashes. DO NOT allow all connect://
+ requests, the following is unsafe:
+
+ Pass connect://*
+
+PROTECTION
+
+ IP address protection should always be used in connection with
+ SSL tunneling. To create a protection template P which allows
+ access only for hosts with IP addresses 198.93.*.* and
+ 198.95.*.*, use the template:
+
+ Protection P {
+ CONNECT-Mask @(198.93.*.*, 198.95.*.*)
+ }
+
+ Note that this only declares a template; to actually apply the
+ protection use the Protect rule, AFTER the Protection
+ declaration, but BEFORE the Pass rule:
+
+ Protect connect://* P
+
+ Or, to collect them all together:
+
+ Protection P {
+ CONNECT-Mask @(198.93.*.*, 198.95.*.*)
+ }
+ Protect connect://* P
+ Pass connect://*:443
+ Pass connect://*:563
+
+ The Protection binding to name P may be left out in case it's
+ only used once, and the protection configuration may be
+ inlined in place of the protection name in Protect rule:
+
+ Protect connect://* {
+ CONNECT-Mask @(198.93.*.*, 198.95.*.*)
+ }
+ Pass connect://*:443
+ Pass connect://*:563
+
+ For a better insight of the CERN httpd's configuration system,
+ please refer to the online manual:
+
+ http://www.w3.org/httpd/
+
+PROXY AUTHENTICATION
+
+ This patch does not enable proxy authentication. Proxy
+ authentication is not supported by the CERN proxy. Proxy
+ authentication uses the status code 407, and headers
+ Proxy-Authenticate and Proxy-Authorization.
+
+ You MUST NOT try to use the Protect directive to turn on
+ normal user authentication on (the one that uses the 401
+ status code, and WWW-Authenticate and Authorization headers).
+ That is an incorrect way to do authentication for the proxy,
+ and causes compatibility and security problems.
+
+CHAINING PROXIES
+
+ This patch does not enable chaining proxies to do SSL
+ tunneling. More specifically, the CERN proxy with this patch
+ IS able to act as the OUTMOST proxy in the chain, but it
+ doesn't work if it is the inner proxy that has to speak to
+ another, outer proxy to establish a secure connection through
+ that. Therefore, a combination such as inner Netscape Proxy
+ and outer CERN httpd would work, but not vice versa.
+
+THE NETSCAPE PROXY SERVER
+
+ The Netscape Proxy Server is a commercially supported proxy
+ server available from Netscape Communications Corporation. In
+ addition to it's unique, more efficient architecture, it
+ natively supports proxy authentication, proxy chaining, SSL
+ tunneling and HTTPS proxying, enabling also clients without
+ native SSL support to use HTTPS.
+
+AUTHOR
+ Ari Luotonen, Netscape Communications Corporation, 1995
+ <ari@netscape.com>
+
+DISCLAIMER
+
+ I do not have any official connection to the CERN httpd
+ development anymore. I have left the CERN WWW project in
+ summer '94. I do not provide any support for this software or
+ this patch. For general CERN httpd support, please contact:
+
+ httpd@w3.org
+
+ THIS PATCH IS PROVIDED IN GOOD FAITH, AS IS. I AND NETSCAPE
+ MAKE NO CLAIMS TO ITS SUITABILITY FOR ANY PARTICULAR PURPOSE,
+ AND I AND NETSCAPE PROVIDE ABSOLUTELY NO WARRANTY OF ANY KIND
+ WITH RESPECT TO THIS PATCH OR THIS SOFTWARE. THE ENTIRE RISK
+ AS TO THE QUALITY AND PERFORMANCE OF THIS SOFTWARE/PATCH IS
+ WITH THE USER. IN NO EVENT WILL I OR NETSCAPE BE LIABLE TO
+ ANYONE FOR ANY DAMAGES ARISING OUT THE USE OF THIS
+ SOFTWARE/PATCH, INCLUDING, WITHOUT LIMITATION, DAMAGES
+ RESULTING FROM LOST DATA OR LOST PROFITS, OR FOR ANY SPECIAL,
+ INCIDENTAL OR CONSEQUENTIAL DAMAGES.
+
+
+============================================================================
+PATCH TO WWW COMMON LIBRARY 2.17 AND CERN HTTPD 3.0:
+============================================================================
+
+*** Library/Implementation/HTAccess.c.orig Thu Sep 29 04:53:28 1994
+--- Library/Implementation/HTAccess.c Tue May 9 13:16:50 1995
+***************
+*** 146,151 ****
+--- 146,152 ----
+ "SHOWMETHOD",
+ "LINK",
+ "UNLINK",
++ "CONNECT",
+ NULL
+ };
+
+*** Library/Implementation/HTAccess.h.orig Sun Sep 25 07:15:14 1994
+--- Library/Implementation/HTAccess.h Tue May 9 13:15:47 1995
+***************
+*** 60,65 ****
+--- 60,66 ----
+ METHOD_SHOWMETHOD,
+ METHOD_LINK,
+ METHOD_UNLINK,
++ METHOD_CONNECT,
+ MAX_METHODS
+ } HTMethod;
+ /*
+*** Daemon/Implementation/HTAAProt.h.orig Sun Sep 25 06:55:47 1994
+--- Daemon/Implementation/HTAAProt.h Mon May 15 21:05:40 1995
+***************
+*** 52,57 ****
+--- 52,58 ----
+ GroupDef * put_mask; /* - " - (PUT) */
+ GroupDef * post_mask; /* - " - (POST) */
+ GroupDef * delete_mask; /* - " - (DELETE) */
++ GroupDef * connect_mask; /* - " - (CONNECT) */
+ GroupDef * gen_mask; /* General mask (used when needed but */
+ /* other masks not set). */
+ HTList * valid_schemes;/* Valid authentication schemes */
+*** Daemon/Implementation/HTAAProt.c.orig Sun Sep 25 11:53:03 1994
+--- Daemon/Implementation/HTAAProt.c Mon May 15 21:18:05 1995
+***************
+*** 356,361 ****
+--- 356,373 ----
+ }
+ } /* if "Post-Mask" */
+
++ else if (0==strncasecomp(fieldname, "connect", 7)) {
++ prot->connect_mask = HTAA_parseGroupDef(fp);
++ lex_item=LEX_REC_SEP; /*groupdef parser read this already*/
++ if (TRACE) {
++ if (prot->connect_mask) {
++ fprintf(stderr, "CONNECT-Mask\n");
++ HTAA_printGroupDef(prot->connect_mask);
++ }
++ else fprintf(stderr,"SYNTAX ERROR parsing CONNECT-Mask\n");
++ }
++ } /* if "Connect-Mask" */
++
+ else if (0==strncasecomp(fieldname, "delete", 6)) {
+ prot->delete_mask = HTAA_parseGroupDef(fp);
+ lex_item=LEX_REC_SEP; /*groupdef parser read this already*/
+*** Daemon/Implementation/HTAAServ.c.orig Sun Sep 25 06:52:53 1994
+--- Daemon/Implementation/HTAAServ.c Mon May 15 21:06:18 1995
+***************
+*** 208,213 ****
+--- 208,215 ----
+ mask = prot->post_mask;
+ else if (!strcmp(method_name, "DELETE"))
+ mask = prot->delete_mask;
++ else if (!strcmp(method_name, "CONNECT"))
++ mask = prot->connect_mask;
+ if (!mask)
+ mask = prot->gen_mask;
+ }
+*** Daemon/Implementation/HTRequest.c.orig Fri Aug 12 03:36:29 1994
+--- Daemon/Implementation/HTRequest.c Mon May 15 21:32:44 1995
+***************
+*** 1006,1011 ****
+--- 1006,1028 ----
+ }
+
+ /*
++ * SSL tunneling -- make host:port appear as connect://host:port
++ * to make it work better with the configuration system.
++ * Ari Luotonen <ari@netscape.com> May 1995
++ */
++ if (req->method == METHOD_CONNECT && HTReqArg) {
++ char *tmp = HTReqArg;
++ HTReqArg = NULL;
++ StrAllocCopy(HTReqArg, "connect://");
++ StrAllocCat(HTReqArg, tmp);
++ free(tmp);
++ if ((tmp = strchr(HTReqArg + 10, ':'))) {
++ for (tmp++; *tmp && isdigit(*tmp); tmp++);
++ *tmp = '\0';
++ }
++ }
++
++ /*
+ ** Check that the third argument actually is a valid
+ ** client protocol specifier (if it is not we might wait
+ ** for an eternity for the rest of an HTTP1 request when it
+*** Daemon/Implementation/HTDaemon.c.orig Mon Sep 26 07:23:00 1994
+--- Daemon/Implementation/HTDaemon.c Mon Jun 12 15:58:58 1995
+***************
+*** 65,70 ****
+--- 65,71 ----
+ ** defined via "ServerRoot" in the configuration file.
+ ** Commented out dead extern declarations.
+ ** 8 Jul 94 FM Insulate free() from _free structure element.
++ ** May 95 AL SSL tunneling support
+ */
+
+ /* (c) CERN WorldWideWeb project 1990-1992. See Copyright.html for details */
+***************
+*** 162,167 ****
+--- 163,173 ----
+ #include <sys/param.h>
+ #include <errno.h>
+
++ #if !defined(__osf__) && !defined(AIX) && !defined(_HPUX_SOURCE) && \
++ !defined(BSDI) && !defined(__linux)
++ #include <sys/filio.h>
++ #endif
++
+ #ifndef SIGCLD
+ #ifdef SIGCHLD
+ #define SIGCLD SIGCHLD
+***************
+*** 376,381 ****
+--- 382,602 ----
+
+
+
++ /*
++ * SSL tunneling support by Ari Luotonen <ari@netscape.com>, May 1995
++ */
++
++
++ #define SSL_PROXY_BUFSIZE 4096
++
++
++ int shove_buffer ARGS4(int, sd,
++ char *, b,
++ int *, i,
++ int *, c)
++ {
++ int n = write(sd, &b[*i], *c);
++
++ if (n > 0)
++ {
++ *i += n;
++ *c -= n;
++ }
++ else if (n == -1 && (errno == EWOULDBLOCK || errno == EINTR))
++ {
++ n = 0;
++ }
++
++ return n;
++ }
++
++ int drag_buffer ARGS4(int, sd,
++ char *, b,
++ int *, i,
++ int *, c)
++ {
++ int n = read(sd, b, SSL_PROXY_BUFSIZE);
++
++ *i = *c = 0;
++
++ if (n > 0)
++ {
++ *c = n;
++ }
++ else if (n == -1 && errno != EWOULDBLOCK && errno != EINTR)
++ {
++ return 0;
++ }
++ return n;
++ }
++
++
++ int ssl_proxy_pump ARGS3(int, sd1,
++ int, sd2,
++ char *, initial)
++ {
++ char b1[SSL_PROXY_BUFSIZE];
++ char b2[SSL_PROXY_BUFSIZE];
++ int i1=0, i2=0; /* Buffer start index */
++ int c1=0, c2=0; /* Buffer data counter */
++ int r1=0, r2=0; /* Socket read ready */
++ int w1=0, w2=0; /* Socket write ready */
++ int closed1=0, closed2=0; /* Socket close */
++ int n_fds = ((sd1 > sd2) ? sd1 : sd2) + 1;
++ fd_set rd_fds, wr_fds;
++ int status;
++
++ memset(&rd_fds, 0, sizeof(rd_fds));
++ memset(&wr_fds, 0, sizeof(wr_fds));
++
++ if (initial && *initial) {
++ strcpy(b1, initial);
++ c1 = strlen(initial);
++ }
++
++ while (1) {
++ FD_SET(sd1, &rd_fds);
++ FD_SET(sd2, &rd_fds);
++ FD_SET(sd1, &wr_fds);
++ FD_SET(sd2, &wr_fds);
++
++ if (!(status = select(n_fds, &rd_fds, &wr_fds, NULL, NULL)))
++ {
++ break;
++ }
++ else if (status == -1)
++ {
++ if (errno == EINTR)
++ continue;
++ else
++ break;
++ }
++
++ r1 = FD_ISSET(sd1, &rd_fds);
++ r2 = FD_ISSET(sd2, &rd_fds);
++ w1 = FD_ISSET(sd1, &wr_fds);
++ w2 = FD_ISSET(sd2, &wr_fds);
++
++ if (w1 && c1 > 0)
++ {
++ if (shove_buffer(sd1, b1, &i1, &c1) == -1)
++ closed1 = 1;
++ }
++ if (w2 && c2 > 0)
++ {
++ if (shove_buffer(sd2, b2, &i2, &c2) == -1)
++ closed2 = 1;
++ }
++ if (r1 && !c2)
++ {
++ if (!drag_buffer(sd1, b2, &i2, &c2))
++ closed1 = 1;
++ }
++ if (r2 && !c1)
++ {
++ if (!drag_buffer(sd2, b1, &i1, &c1))
++ closed2 = 1;
++ }
++
++ if (closed1 || closed2)
++ {
++ break;
++ }
++ }
++
++ NETCLOSE(sd1);
++ NETCLOSE(sd2);
++
++ return 1;
++ }
++
++
++ BOOL ssl_proxy_get_addr ARGS3(char *, arg,
++ char **, host,
++ int *, port)
++ {
++ char *p;
++
++ if (arg && host && port && !strncmp(arg, "connect://", 10)) {
++
++ *host = NULL;
++ StrAllocCopy(*host, arg + 10);
++
++ if ((p = strchr(*host, ':'))) {
++ *p++ = '\0';
++ if ((*port = atoi(p)) > 0)
++ return YES;
++ }
++ }
++ return NO;
++ }
++
++
++ int ssl_proxy_connect ARGS3(HTRequest *, req,
++ char *, host,
++ int, port)
++ {
++ struct sockaddr_in sa;
++ struct hostent *hp;
++ int sd, status, one=1;
++
++ memset(&sa, 0, sizeof(sa));
++ sa.sin_family = AF_INET;
++ sa.sin_port = htons(port);
++
++ if (isdigit(*host))
++ sa.sin_addr.s_addr = inet_addr(host);
++ else if ((hp = gethostbyname(host)))
++ memcpy(&sa.sin_addr, hp->h_addr, hp->h_length);
++ else {
++ HTLoadError(req, 500, "Unable to locate host");
++ return -1;
++ }
++
++ if ((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
++ HTLoadError(req, 500, "Can't create socket");
++ return -1;
++ }
++
++ if ((status = connect(sd, (struct sockaddr *)&sa, sizeof(sa))) == -1) {
++ HTLoadError(req, 500, "Can't connect to host");
++ return -1;
++ }
++
++ if ((status = ioctl(sd, FIONBIO, &one)) == -1) {
++ HTLoadError(req, 500, "Can't make socket non-blocking");
++ return -1;
++ }
++
++ return sd;
++ }
++
++
++
++ BOOL ssl_proxy_request ARGS2(char *, arg, HTRequest *, req)
++ {
++ char *host = NULL;
++ int port = 0;
++ int sd, one=1;
++
++ CTRACE(stderr, "Handling CONNECT %s\n", arg);
++
++ if (!ssl_proxy_get_addr(arg, &host, &port)) {
++ HTLoadError(req, 400, "Bad CONNECT request address");
++ return NO;
++ }
++
++ if ((sd = ssl_proxy_connect(req, host, port)) < 0)
++ return NO;
++
++ if (ioctl(HTSoc, FIONBIO, &one) < -1) {
++ HTLoadError(req, 500, "Can't make client socket non-blocking");
++ return NO;
++ }
++
++ ssl_proxy_pump(HTSoc, sd, "HTTP/1.0 200 Connection established\r\n\r\n");
++ return YES;
++ }
+
+
+ #if defined(Mips)
+***************
+*** 1832,1837 ****
+--- 2053,2062 ----
+ }
+ FREE(cfn);
+ }
++ else if (req->method==METHOD_CONNECT) {
++ /* SSL tunneling by Ari Luotonen <ari@netscape.com>, May 1995 */
++ ssl_proxy_request(HTReqArg, req);
++ }
+ else {
+ /* Normal retrieve with no caching */
+ CTRACE(stderr, "No caching.. %s\n",
diff --git a/www/w3c-httpd/patches/patch-aa b/www/w3c-httpd/patches/patch-aa
new file mode 100644
index 00000000000..a0248083d19
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-aa
@@ -0,0 +1,12 @@
+--- BUILD.orig Sat Sep 24 11:28:46 1994
++++ BUILD Sat Mar 8 10:08:38 1997
+@@ -56,6 +56,9 @@
+ if ($UNAME == "AIX") setenv WWW_MACH rs6000
+ if ($UNAME == "OSF1") setenv WWW_MACH osf1
+ if ($UNAME == "BSD/386") setenv WWW_MACH unix
++if ($UNAME == "FreeBSD") setenv WWW_MACH freebsd
++if ($UNAME == "OpenBSD") setenv WWW_MACH netbsd
++if ($UNAME == "NetBSD") setenv WWW_MACH netbsd
+ if ($UNAME == "Linux") setenv WWW_MACH linux
+ if ($UNAME == "A/UX") setenv WWW_MACH aux
+ if ($UNAME == "SMP_DC.SOx") setenv WWW_MACH pyramid
diff --git a/www/w3c-httpd/patches/patch-ab b/www/w3c-httpd/patches/patch-ab
new file mode 100644
index 00000000000..898f14824e2
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-ab
@@ -0,0 +1,22 @@
+*** Library/Implementation/HTTCP.c.orig Mon Dec 30 12:20:05 1996
+--- Library/Implementation/HTTCP.c Mon Dec 30 13:23:20 1996
+***************
+*** 113,118 ****
+--- 113,119 ----
+ extern int errno;
+ #endif /* errno */
+
++ #if !(defined(BSD) && (BSD >= 199306))
+ #ifndef VM
+ #ifndef VMS
+ #ifndef NeXT
+***************
+*** 123,128 ****
+--- 124,130 ----
+ #endif /* NeXT */
+ #endif /* VMS */
+ #endif /* VM */
++ #endif /* FreeBSD */
+
+ #endif /* PCNFS */
+
diff --git a/www/w3c-httpd/patches/patch-ba b/www/w3c-httpd/patches/patch-ba
new file mode 100644
index 00000000000..e579d3ca954
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-ba
@@ -0,0 +1,42 @@
+*** Daemon/Implementation/CommonMakefile.orig Mon Dec 30 17:25:30 1996
+--- Daemon/Implementation/CommonMakefile Mon Dec 30 17:27:26 1996
+***************
+*** 35,41 ****
+ # If this env var is set to something else Some makes will use that instead
+ SHELL = /bin/sh
+ # Rule file to be used by target daemon
+! RULE_FILE = "/etc/httpd.conf"
+
+ CMN = $(WWW)/Library/Implementation
+ INC = $(WWW)/Library/Implementation
+--- 35,41 ----
+ # If this env var is set to something else Some makes will use that instead
+ SHELL = /bin/sh
+ # Rule file to be used by target daemon
+! RULE_FILE = "/usr/local/etc/httpd.conf"
+
+ CMN = $(WWW)/Library/Implementation
+ INC = $(WWW)/Library/Implementation
+***************
+*** 157,166 ****
+
+ # Hypertext File server
+
+! PURIFY_CACHE = /home2/frystyk/purify-cache
+
+ PURIFY = purify \
+! -logfile=$(HOME)/purify.log
+ -cache-dir=$(PURIFY_CACHE)
+
+ #
+--- 157,166 ----
+
+ # Hypertext File server
+
+! PURIFY_CACHE = /tmp/purify-cache
+
+ PURIFY = purify \
+! -logfile=$(HOME)/purify.log \
+ -cache-dir=$(PURIFY_CACHE)
+
+ #
diff --git a/www/w3c-httpd/patches/patch-bb b/www/w3c-httpd/patches/patch-bb
new file mode 100644
index 00000000000..e7bd67a2316
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-bb
@@ -0,0 +1,19 @@
+*** All/freebsd/Makefile.include.orig Mon Dec 30 17:18:49 1996
+--- All/freebsd/Makefile.include Mon Dec 30 17:19:46 1996
+***************
+*** 5,11 ****
+ WWW_MACH = freebsd
+
+ CFLAGS += -DDEBUG -D__BSD__
+! LFLAGS =
+
+ # Directory for installed binary:
+ BINDIR = /usr/local/bin
+--- 5,11 ----
+ WWW_MACH = freebsd
+
+ CFLAGS += -DDEBUG -D__BSD__
+! LFLAGS = -lcrypt
+
+ # Directory for installed binary:
+ BINDIR = /usr/local/bin
diff --git a/www/w3c-httpd/patches/patch-bc b/www/w3c-httpd/patches/patch-bc
new file mode 100644
index 00000000000..08790f2fb18
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-bc
@@ -0,0 +1,81 @@
+--- Daemon/Implementation/HTPasswd.c.orig Sun Sep 25 06:48:03 1994
++++ Daemon/Implementation/HTPasswd.c Sat Mar 8 10:02:19 1997
+@@ -77,6 +77,7 @@
+ ** string at once, but then again, we are not that paranoid
+ ** about the security inside the machine.
+ **
++ NOTE: MD5: 28 characters (8 - setting, 20 - crypted password)
+ */
+ PUBLIC char *HTAA_encryptPasswd ARGS1(CONST char *, password)
+ {
+@@ -101,7 +102,7 @@
+ strncpy(chunk, cur, 8);
+ chunk[8] = (char)0;
+
+- tmp = crypt((char*)password, salt); /*crypt() doesn't change its args*/
++ tmp = crypt((char*)chunk , salt); /*crypt() doesn't change its args*/
+ strcat(result, tmp);
+
+ cur += 8;
+@@ -139,11 +140,24 @@
+ char *result;
+ int len;
+ int status;
++#ifdef MD5_PW
++ char salt[9];
++#else
++ char salt[3];
++#endif
++ char chunk[9];
++ CONST char *cur1 = password;
++ CONST char *cur2 = encrypted;
++ char *tmp;
+
+ if (!password || !encrypted)
+ return NO;
+
++#ifdef MD5_PW
++ len = 28*(((int)strlen(password)+7)/8);
++#else
+ len = 13*(((int)strlen(password)+7)/8);
++#endif
+ if (len < (int)strlen(encrypted))
+ return NO;
+
+@@ -152,25 +166,30 @@
+
+ *result = (char)0;
+ while (len > 0) {
+- char salt[3];
+- char chunk[9];
+- CONST char *cur1 = password;
+- CONST char *cur2 = encrypted;
+- char *tmp;
+
++#ifdef MD5_PW
++ for(status=0;status<8;status++) salt[status]=cur2[status];
++ salt[8]=0;
++#else
+ salt[0] = *cur2;
+ salt[1] = *(cur2+1);
+ salt[2] = (char)0;
++#endif
+
+ strncpy(chunk, cur1, 8);
+ chunk[8] = (char)0;
+
+- tmp = crypt((char*)password, salt);
++ tmp = crypt((char*)chunk, salt);
+ strcat(result, tmp);
+
+ cur1 += 8;
++#ifdef MD5_PW
++ cur2 += 28;
++ len -= 28;
++#else
+ cur2 += 13;
+ len -= 13;
++#endif
+ } /* while */
+
+ status = strncmp(result, encrypted, strlen(encrypted));
diff --git a/www/w3c-httpd/patches/patch-ca b/www/w3c-httpd/patches/patch-ca
new file mode 100644
index 00000000000..110d585868e
--- /dev/null
+++ b/www/w3c-httpd/patches/patch-ca
@@ -0,0 +1,12 @@
+--- Daemon/Implementation/CGIParse.c.orig Wed Jun 3 12:38:15 1998
++++ Daemon/Implementation/CGIParse.c Wed Jun 3 12:38:41 1998
+@@ -293,7 +293,8 @@
+ *cur = 0;
+
+ if (init) {
+- printf("QUERY_STRING='%s'; export QUERY_STRING\n", query_string);
++ printf("QUERY_STRING='%s'; export QUERY_STRING\n",
++ sh_escape(query_string) );
+ exit(0);
+ }
+ }
diff --git a/www/w3c-httpd/pkg/COMMENT b/www/w3c-httpd/pkg/COMMENT
new file mode 100644
index 00000000000..1561b559a08
--- /dev/null
+++ b/www/w3c-httpd/pkg/COMMENT
@@ -0,0 +1 @@
+WWW server from the W3 Consortium (W3C).
diff --git a/www/w3c-httpd/pkg/DESCR b/www/w3c-httpd/pkg/DESCR
new file mode 100644
index 00000000000..daca7da7dca
--- /dev/null
+++ b/www/w3c-httpd/pkg/DESCR
@@ -0,0 +1,17 @@
+W3C httpd is a generic public domain full-featured hypertext server
+which can be used as a regular HTTP server. The running typically on
+port 80 to serve hypertext and other documents, and also as a proxy --
+a server on a firewall machine -- that provides access for people
+inside a firewall to the outside world. When running as proxy httpd
+may be configured to do caching of documents resulting in faster
+response times.
+
+For more information on the Library, please look at the page
+
+WWW: http://www.w3.org/hypertext/WWW/Daemon/Status.html
+
+Have fun!
+
+--
+
+httpd@w3.org, May 1995
diff --git a/www/w3c-httpd/pkg/PLIST b/www/w3c-httpd/pkg/PLIST
new file mode 100644
index 00000000000..e80e966e033
--- /dev/null
+++ b/www/w3c-httpd/pkg/PLIST
@@ -0,0 +1,34 @@
+bin/htadm
+etc/all.conf
+etc/caching.conf
+etc/httpd.conf
+etc/prot.conf
+etc/proxy.conf
+libexec/httpd
+www/cgi-bin/cgiparse
+www/cgi-bin/cgiutils
+www/htbin/htimage
+www/icons/back.xbm
+www/icons/binary.xbm
+www/icons/binhex.xbm
+www/icons/blank.xbm
+www/icons/compressed.xbm
+www/icons/dir.gif
+www/icons/directory.xbm
+www/icons/doc.gif
+www/icons/doc.xbm
+www/icons/dummy.xbm
+www/icons/ftp.xbm
+www/icons/gzip.xbm
+www/icons/image.xbm
+www/icons/index.xbm
+www/icons/index2.xbm
+www/icons/movie.xbm
+www/icons/sound.xbm
+www/icons/tar.xbm
+www/icons/telnet.xbm
+www/icons/text.xbm
+www/icons/unknown.doc.xbm
+www/icons/unknown.old.xbm
+www/icons/unknown.xbm
+www/icons/uu.xbm