From ac2912d8655b53d2d02a73fad7fda96a811f763b Mon Sep 17 00:00:00 2001 From: jlam Date: Wed, 23 Aug 2000 12:24:41 +0000 Subject: Add itojun's patch for IPv6 support --- www/bozohttpd/Makefile | 11 ++++- www/bozohttpd/files/md5 | 2 +- www/bozohttpd/files/patch-sum | 5 ++- www/bozohttpd/patches/patch-ab | 11 +++-- www/bozohttpd/patches/patch-ac | 93 ++++++++++++++++++++++++++++++++++++++++++ www/bozohttpd/pkg/DESCR | 4 +- 6 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 www/bozohttpd/patches/patch-ac (limited to 'www') diff --git a/www/bozohttpd/Makefile b/www/bozohttpd/Makefile index e1a166b4dbe..8e12269bd7f 100644 --- a/www/bozohttpd/Makefile +++ b/www/bozohttpd/Makefile @@ -1,12 +1,21 @@ -# $NetBSD: Makefile,v 1.3 2000/05/24 14:52:49 mrg Exp $ +# $NetBSD: Makefile,v 1.4 2000/08/23 12:24:41 jlam Exp $ # DISTNAME= bozohttpd-5.05 +PKGNAME= ${DISTNAME}nb1 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_LOCAL} + EXTRACT_SUFX= .tar.bz2 MAINTAINER= packages@netbsd.org HOMEPAGE= http://www.eterna.com.au/bozohttpd/ +.include "../../mk/bsd.prefs.mk" + +.if defined(USE_INET6) && (${USE_INET6} == "YES") +CPPFLAGS+= -DINET6 +MAKE_ENV+= CPPFLAGS="${CPPFLAGS}" +.endif + .include "../../mk/bsd.pkg.mk" diff --git a/www/bozohttpd/files/md5 b/www/bozohttpd/files/md5 index 7978a26d092..11e9fbdb049 100644 --- a/www/bozohttpd/files/md5 +++ b/www/bozohttpd/files/md5 @@ -1,3 +1,3 @@ -$NetBSD: md5,v 1.4 2000/05/24 14:52:49 mrg Exp $ +$NetBSD: md5,v 1.5 2000/08/23 12:24:42 jlam Exp $ MD5 (bozohttpd-5.05.tar.bz2) = e51b8fa1277e49d06700999c891bb2e0 diff --git a/www/bozohttpd/files/patch-sum b/www/bozohttpd/files/patch-sum index 3f50c622ee0..eab45e7fa50 100644 --- a/www/bozohttpd/files/patch-sum +++ b/www/bozohttpd/files/patch-sum @@ -1,4 +1,5 @@ -$NetBSD: patch-sum,v 1.3 2000/08/05 10:00:07 jlam Exp $ +$NetBSD: patch-sum,v 1.4 2000/08/23 12:24:42 jlam Exp $ MD5 (patch-aa) = c02c925955768359ff9fdcb5be35582d -MD5 (patch-ab) = 9dc85b202e3554b4a1e5c0bb9e88e9de +MD5 (patch-ab) = 19043309a67e73ba33f13d9ec1ba0285 +MD5 (patch-ac) = 7e0ae73e85fa65acd024f1a8bd0b5dd4 diff --git a/www/bozohttpd/patches/patch-ab b/www/bozohttpd/patches/patch-ab index ea879eef28a..4836c475f41 100644 --- a/www/bozohttpd/patches/patch-ab +++ b/www/bozohttpd/patches/patch-ab @@ -1,7 +1,7 @@ -$NetBSD: patch-ab,v 1.3 2000/08/05 10:01:06 jlam Exp $ +$NetBSD: patch-ab,v 1.4 2000/08/23 12:24:42 jlam Exp $ --- bozohttpd.8.orig Tue May 23 03:14:38 2000 -+++ bozohttpd.8 Sat Aug 5 05:48:56 2000 ++++ bozohttpd.8 @@ -59,7 +59,7 @@ The following options are available: .Bl -tag -width xxxcgibin @@ -20,7 +20,12 @@ $NetBSD: patch-ab,v 1.3 2000/08/05 10:01:06 jlam Exp $ .Nm to automatically redirect Uniform Resource Locators that have their trailing slash missing. The default behaviour is to send a message -@@ -116,8 +116,8 @@ +@@ -112,12 +112,13 @@ + .Xr inetd.conf 5 + entry would be: + .Dl www stream tcp nowait httpd /usr/pkg/libexec/httpd httpd /var/www ++.Dl www stream tcp6 nowait httpd /usr/pkg/libexec/httpd httpd /var/www + .Pp Using the .Nx .Xr inetd 8 , diff --git a/www/bozohttpd/patches/patch-ac b/www/bozohttpd/patches/patch-ac new file mode 100644 index 00000000000..c3dba037488 --- /dev/null +++ b/www/bozohttpd/patches/patch-ac @@ -0,0 +1,93 @@ +$NetBSD: patch-ac,v 1.1 2000/08/23 12:24:42 jlam Exp $ + +itojun's patch for IPv6 support as provided tech-pkg@netbsd.org at 20000815. + +--- bozohttpd.c.orig Tue May 23 03:14:30 2000 ++++ bozohttpd.c +@@ -913,14 +913,20 @@ + http_req *request; + { + struct _headers *headp; ++#ifdef INET6 ++ char hbuf[NI_MAXHOST], abuf[NI_MAXSERV]; ++ struct sockaddr_storage ss; ++#else ++ struct sockaddr ss; ++ struct sockaddr_in *sin; + struct hostent *hp; +- struct sockaddr_in in; ++#endif + char *host, *addr, *port, *info, *type, *clen, *query, *s, *t, + *path, *env, *command = NULL, + *url = strdup(request->url + strlen("/cgi-bin")); + char **envp, *argv[3]; + char bufport[10]; +- int envpsize, ix, slen = sizeof(in); ++ int envpsize, ix, slen = sizeof(ss); + + debug((DEBUG_FAT, "process_cgi: writing HTTP header ..")); + +@@ -952,23 +958,52 @@ + type = request->content_type; + clen = request->content_length; + +- if (getpeername(0, (struct sockaddr *)&in, &slen) < 0) ++ if (getpeername(0, (struct sockaddr *)&ss, &slen) < 0) + host = addr = NULL; + else { +- addr = inet_ntoa(in.sin_addr); +- +- if (nflag == 0 || (hp = gethostbyaddr((char *)&in.sin_addr, +- sizeof(in.sin_addr), AF_INET)) == NULL) +- host = NULL; +- else +- host = hp->h_name; ++#ifdef INET6 ++ addr = host = NULL; ++ if (getnameinfo((struct sockaddr *)&ss, slen, ++ abuf, sizeof abuf, NULL, 0, NI_NUMERICHOST) == 0) ++ addr = abuf; ++ if (nflag != 0 && getnameinfo((struct sockaddr *)&ss, slen, ++ hbuf, sizeof hbuf, NULL, 0, 0) == 0) ++ host = hbuf; ++#else ++ switch (((struct sockaddr *)&ss)->sa_family) { ++ case AF_INET: ++ sin = (struct sockaddr_in *)&ss; ++ addr = inet_ntoa(sin->sin_addr); ++ if (nflag == 0 || ++ (hp = gethostbyaddr((char *)&sin->sin_addr, ++ sizeof(sin->sin_addr), AF_INET)) == NULL) ++ host = NULL; ++ else ++ host = hp->h_name; ++ break; ++ default: ++ host = addr = NULL; ++ break; ++ } ++#endif + } + +- if (getsockname(0, (struct sockaddr *)&in, &slen) < 0) ++ slen = sizeof(ss); ++ if (getsockname(0, (struct sockaddr *)&ss, &slen) < 0) + port = NULL; +- else ++ else { ++#ifdef INET6 ++ if (getnameinfo((struct sockaddr *)&ss, slen, NULL, 0, ++ bufport, sizeof bufport, NI_NUMERICSERV) == 0) ++ port = bufport; ++ else ++ port = NULL; ++#else ++ sin = (struct sockaddr_in *)&ss; + (void)snprintf(port = bufport, sizeof bufport, "%d", +- ntohs(in.sin_port)); ++ ntohs(sin->sin_port)); ++#endif ++ } + + envpsize = 10 + request->nheaders + + (info && *info ? 1 : 0) + diff --git a/www/bozohttpd/pkg/DESCR b/www/bozohttpd/pkg/DESCR index e2b74ae549d..7ec406d1f08 100644 --- a/www/bozohttpd/pkg/DESCR +++ b/www/bozohttpd/pkg/DESCR @@ -1,6 +1,6 @@ -bozohttpd is a small and secure http version 1.1 server. it's main +bozohttpd is a small and secure http version 1.1 server. It's main feature is the lack of features, reducing the code size and improving verifiability. -it supports CGI/1.1, HTTP/1.1, HTTP/1.0, HTTP/0.9, ~user translations, +It supports CGI/1.1, HTTP/1.1, HTTP/1.0, HTTP/0.9, ~user translations, and can run multiple IP-based http servers on single machine. -- cgit v1.2.3