diff options
author | danfe <danfe@FreeBSD.org> | 2015-01-18 21:37:34 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2015-01-18 21:37:34 +0800 |
commit | b6598ad7fc14177a3d0505a246549666855a559f (patch) | |
tree | 5dd119063f7f6c9ec737f7d263b52910222acb71 /www | |
parent | 19aa602c58f4c3896bd5c886829ad5a95c91ca29 (diff) | |
download | freebsd-ports-gnome-b6598ad7fc14177a3d0505a246549666855a559f.tar.gz freebsd-ports-gnome-b6598ad7fc14177a3d0505a246549666855a559f.tar.zst freebsd-ports-gnome-b6598ad7fc14177a3d0505a246549666855a559f.zip |
- Update to version 2.26 and cleanup MASTER_SITES; define LICENSE
- Change default WWW root from ${PREFIX}/www/data to more expected (and
standard) ${WWWDIR} (${PREFIX}/www/thttpd) and default CGI pattern to
"/cgi-bin/*" since this goes better in line with default installation
- Enable IPREAL option by default (do not convert it to unconditional
patch as it could lead to privacy violation, which might be unwanted)
- Change served data default MIME type to "application/octet-stream"
- Rename thttpdpasswd(1) and its manpage to thtpasswd(1); this not just
makes it shorter, but is more consistent with what popular GNU/Linux
distributions do
- Stop generating index pages for directories by default for security
reasons, provide an option for that
- Properly stagify port by patching upstream makefiles instead of doing
entire installation by hand (and thus retire `do-install' target)
- Adjust and sort pkg-plist in accordance with the the above changes
Diffstat (limited to 'www')
-rw-r--r-- | www/thttpd/Makefile | 47 | ||||
-rw-r--r-- | www/thttpd/distinfo | 4 | ||||
-rw-r--r-- | www/thttpd/files/patch-Makefile.in | 12 | ||||
-rw-r--r-- | www/thttpd/files/patch-cgi-src_Makefile.in | 29 | ||||
-rw-r--r-- | www/thttpd/files/patch-extras_Makefile.in | 29 | ||||
-rw-r--r-- | www/thttpd/files/patch-extras_htpasswd.c | 4 | ||||
-rw-r--r-- | www/thttpd/files/patch-libhttpd.c | 34 | ||||
-rw-r--r-- | www/thttpd/files/patch-thttpd.c | 2 | ||||
-rw-r--r-- | www/thttpd/files/pkg-message.in | 2 | ||||
-rw-r--r-- | www/thttpd/files/thttpd.conf.sample.in | 4 | ||||
-rw-r--r-- | www/thttpd/pkg-plist | 16 |
11 files changed, 137 insertions, 46 deletions
diff --git a/www/thttpd/Makefile b/www/thttpd/Makefile index 5a7a79aaa226..5e41b7810482 100644 --- a/www/thttpd/Makefile +++ b/www/thttpd/Makefile @@ -2,54 +2,47 @@ # $FreeBSD$ PORTNAME= thttpd -PORTVERSION= 2.25b -PORTREVISION= 6 +PORTVERSION= 2.26 CATEGORIES= www ipv6 -MASTER_SITES= http://www.acme.com/software/thttpd/ \ - http://atreides.freenix.no/~anders/ +MASTER_SITES= http://www.acme.com/software/thttpd/ MAINTAINER= danfe@FreeBSD.org COMMENT= Tiny/turbo/throttling HTTP server with CGI support +LICENSE= BSD2CLAUSE + USES= gmake # parallel builds (-jX) are broken with BSD make(1) GNU_CONFIGURE= yes +MAKE_ARGS= WEBDIR=${WWWDIR} USE_RC_SUBR= ${PORTNAME} SUB_FILES= pkg-message thttpd.conf.sample SUB_LIST= WWWOWN=${WWWOWN} WWWGRP=${WWWGRP} -OPTIONS_DEFINE= SENDFILE IPREAL -OPTIONS_DEFAULT= SENDFILE +OPTIONS_DEFINE= SENDFILE IPREAL INDEXES +OPTIONS_DEFAULT= SENDFILE IPREAL + SENDFILE_DESC= Use sendfile(2) to serve files IPREAL_DESC= Respect (pass on) "X-Forwarded-For" header +INDEXES_DESC= Generate index pages for directories SENDFILE_EXTRA_PATCHES= ${FILESDIR}/extra-patch-config.h IPREAL_EXTRA_PATCHES= ${FILESDIR}/extra-patch-ip_real +.include <bsd.port.options.mk> + post-patch: -.for f in extras/htpasswd.1 extras/htpasswd.c thttpd.8 extras/Makefile.in - @${REINPLACE_CMD} -e '/\.htpasswd/!s|htpasswd|thttpdpasswd|g' \ - ${WRKSRC}/${f} +# To avoid conflict with other ports that also install htpasswd(1) +.for f in extras/htpasswd.1 extras/htpasswd.c thttpd.8 + @${REINPLACE_CMD} -e '/\.htpasswd/!s|htpasswd|t&|g' ${WRKSRC}/${f} .endfor @${REINPLACE_CMD} -e 's|/var/www|${WWWDIR}|' \ ${WRKSRC}/extras/makeweb.1 - @${MV} ${WRKSRC}/extras/htpasswd.1 ${WRKSRC}/extras/thttpdpasswd.1 - @${MV} ${WRKSRC}/extras/htpasswd.c ${WRKSRC}/extras/thttpdpasswd.c - -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/thttpd ${STAGEDIR}${PREFIX}/sbin - ${INSTALL_PROGRAM} ${WRKSRC}/extras/makeweb \ - ${WRKSRC}/extras/thttpdpasswd ${STAGEDIR}${PREFIX}/bin - ${INSTALL_SCRIPT} ${WRKSRC}/extras/syslogtocern \ - ${STAGEDIR}${PREFIX}/bin - @${MKDIR} ${STAGEDIR}${PREFIX}/www/data \ - ${STAGEDIR}${PREFIX}/www/cgi-bin - ${INSTALL_PROGRAM} ${WRKSRC}/cgi-src/redirect ${WRKSRC}/cgi-src/ssi \ - ${WRKSRC}/cgi-src/phf ${STAGEDIR}${PREFIX}/www/cgi-bin - ${INSTALL_MAN} ${WRKSRC}/extras/makeweb.1 \ - ${WRKSRC}/extras/thttpdpasswd.1 ${STAGEDIR}${PREFIX}/man/man1 - ${INSTALL_MAN} ${WRKSRC}/thttpd.8 ${WRKSRC}/cgi-src/redirect.8 \ - ${WRKSRC}/cgi-src/ssi.8 ${WRKSRC}/extras/syslogtocern.8 \ - ${STAGEDIR}${PREFIX}/man/man8 +.if ! ${PORT_OPTIONS:MINDEXES} + @${REINPLACE_CMD} -e '/GENERATE_INDEXES/s|.*|/* & */|' \ + ${WRKSRC}/config.h +.endif + +post-install: ${INSTALL_DATA} ${WRKDIR}/thttpd.conf.sample ${STAGEDIR}${PREFIX}/etc .include <bsd.port.mk> diff --git a/www/thttpd/distinfo b/www/thttpd/distinfo index 6cc816c66711..a3b0b96f4eb7 100644 --- a/www/thttpd/distinfo +++ b/www/thttpd/distinfo @@ -1,2 +1,2 @@ -SHA256 (thttpd-2.25b.tar.gz) = 07719b08b1cff6a21c08697a7bcb4395425b07ee753106262fb62a03a7d32360 -SIZE (thttpd-2.25b.tar.gz) = 132275 +SHA256 (thttpd-2.26.tar.gz) = 15b3f6c60f854061e333227e9ea9ff789d34a092c9365690a8c0d3ecfc85cbb7 +SIZE (thttpd-2.26.tar.gz) = 132950 diff --git a/www/thttpd/files/patch-Makefile.in b/www/thttpd/files/patch-Makefile.in index 9a6a89018812..94492c68c966 100644 --- a/www/thttpd/files/patch-Makefile.in +++ b/www/thttpd/files/patch-Makefile.in @@ -20,7 +20,17 @@ WEBDIR=$(WEBDIR) \ CGIBINDIR=$(CGIBINDIR) \ MANDIR=$(MANDIR) \ -@@ -118,9 +116,7 @@ install-man: +@@ -110,17 +108,15 @@ install: installthis install-man install + + installthis: + -mkdir -p $(DESTDIR)$(BINDIR) +- $(INSTALL) -m 555 -o bin -g bin thttpd $(DESTDIR)$(BINDIR) ++ $(INSTALL) -m 555 thttpd $(DESTDIR)$(BINDIR) + + install-man: + -mkdir -p $(DESTDIR)$(MANDIR)/man8 +- $(INSTALL) -m 444 -o bin -g bin thttpd.8 $(DESTDIR)$(MANDIR)/man8 ++ $(INSTALL) -m 444 thttpd.8 $(DESTDIR)$(MANDIR)/man8 installsubdirs: for i in $(SUBDIRS) ; do ( \ diff --git a/www/thttpd/files/patch-cgi-src_Makefile.in b/www/thttpd/files/patch-cgi-src_Makefile.in index 5c8235ba280c..83f12c2d2150 100644 --- a/www/thttpd/files/patch-cgi-src_Makefile.in +++ b/www/thttpd/files/patch-cgi-src_Makefile.in @@ -9,3 +9,32 @@ DEFS = @DEFS@ INCLS = -I.. CFLAGS = $(CCOPT) $(DEFS) $(INCLS) +@@ -67,17 +67,17 @@ + cd .. ; $(MAKE) $(MFLAGS) strerror.o + + install: all +- -mkdir -p $(CGIBINDIR) +- rm -f $(CGIBINDIR)/redirect +- cp redirect $(CGIBINDIR)/redirect +- rm -f $(MANDIR)/man8/redirect.8 +- cp redirect.8 $(MANDIR)/man8/redirect.8 +- rm -f $(CGIBINDIR)/ssi +- cp ssi $(CGIBINDIR)/ssi +- rm -f $(MANDIR)/man8/ssi.8 +- cp ssi.8 $(MANDIR)/man8/ssi.8 +- rm -f $(CGIBINDIR)/phf +- cp phf $(CGIBINDIR)/phf ++ -mkdir -p $(DESTDIR)$(CGIBINDIR) ++ rm -f $(DESTDIR)$(CGIBINDIR)/redirect ++ cp redirect $(DESTDIR)$(CGIBINDIR)/redirect ++ rm -f $(DESTDIR)$(MANDIR)/man8/redirect.8 ++ cp redirect.8 $(DESTDIR)$(MANDIR)/man8/redirect.8 ++ rm -f $(DESTDIR)$(CGIBINDIR)/ssi ++ cp ssi $(DESTDIR)$(CGIBINDIR)/ssi ++ rm -f $(DESTDIR)$(MANDIR)/man8/ssi.8 ++ cp ssi.8 $(DESTDIR)$(MANDIR)/man8/ssi.8 ++ rm -f $(DESTDIR)$(CGIBINDIR)/phf ++ cp phf $(DESTDIR)$(CGIBINDIR)/phf + + clean: + rm -f $(CLEANFILES) diff --git a/www/thttpd/files/patch-extras_Makefile.in b/www/thttpd/files/patch-extras_Makefile.in index ffbea63562e0..4791c5c0b74d 100644 --- a/www/thttpd/files/patch-extras_Makefile.in +++ b/www/thttpd/files/patch-extras_Makefile.in @@ -9,3 +9,32 @@ DEFS = @DEFS@ INCLS = -I.. CFLAGS = $(CCOPT) $(DEFS) $(INCLS) +@@ -66,18 +66,16 @@ + + + install: all +- rm -f $(BINDIR)/makeweb $(BINDIR)/htpasswd $(BINDIR)/syslogtocern +- cp makeweb $(BINDIR)/makeweb +- chgrp $(WEBGROUP) $(BINDIR)/makeweb +- chmod 2755 $(BINDIR)/makeweb +- cp htpasswd $(BINDIR)/htpasswd +- cp syslogtocern $(BINDIR)/syslogtocern +- rm -f $(MANDIR)/man1/makeweb.1 +- cp makeweb.1 $(MANDIR)/man1/makeweb.1 +- rm -f $(MANDIR)/man1/htpasswd.1 +- cp htpasswd.1 $(MANDIR)/man1/htpasswd.1 +- rm -f $(MANDIR)/man8/syslogtocern.8 +- cp syslogtocern.8 $(MANDIR)/man8/syslogtocern.8 ++ rm -f $(DESTDIR)$(BINDIR)/makeweb $(DESTDIR)$(BINDIR)/thtpasswd $(DESTDIR)$(BINDIR)/syslogtocern ++ cp makeweb $(DESTDIR)$(BINDIR)/makeweb ++ cp htpasswd $(DESTDIR)$(BINDIR)/thtpasswd ++ cp syslogtocern $(DESTDIR)$(BINDIR)/syslogtocern ++ rm -f $(DESTDIR)$(MANDIR)/man1/makeweb.1 ++ cp makeweb.1 $(DESTDIR)$(MANDIR)/man1/makeweb.1 ++ rm -f $(DESTDIR)$(MANDIR)/man1/thtpasswd.1 ++ cp htpasswd.1 $(DESTDIR)$(MANDIR)/man1/thtpasswd.1 ++ rm -f $(DESTDIR)$(MANDIR)/man8/syslogtocern.8 ++ cp syslogtocern.8 $(DESTDIR)$(MANDIR)/man8/syslogtocern.8 + + clean: + rm -f $(CLEANFILES) diff --git a/www/thttpd/files/patch-extras_htpasswd.c b/www/thttpd/files/patch-extras_htpasswd.c index 3aa8fb394f6c..52aa93e0725c 100644 --- a/www/thttpd/files/patch-extras_htpasswd.c +++ b/www/thttpd/files/patch-extras_htpasswd.c @@ -143,9 +143,9 @@ strcpy(user,argv[2]); found = 0; -- while(!(getline(line,MAX_STRING_LEN,f))) { +- while(!(my_getline(line,MAX_STRING_LEN,f))) { + /* line we get is username:pwd, or possibly any other cruft */ -+ while(!(getline(line,MAX_LINE_LEN,f))) { ++ while(!(my_getline(line,MAX_LINE_LEN,f))) { + char *i; + if(found || (line[0] == '#') || (!line[0])) { diff --git a/www/thttpd/files/patch-libhttpd.c b/www/thttpd/files/patch-libhttpd.c index f7b5453196ee..194aef1ff64e 100644 --- a/www/thttpd/files/patch-libhttpd.c +++ b/www/thttpd/files/patch-libhttpd.c @@ -18,7 +18,39 @@ rest[--restlen] = '\0'; /* trim trailing slash */ if ( ! tildemapped ) /* Remove any leading slashes. */ -@@ -3889,6 +3889,9 @@ +@@ -2348,8 +2348,11 @@ + { + int i; + i = strlen( hc->origfilename ) - strlen( hc->pathinfo ); +- if ( i > 0 && strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 ) +- hc->origfilename[i - 1] = '\0'; ++ if ( strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 ) ++ { ++ if ( i == 0 ) hc->origfilename[0] = '\0'; ++ else hc->origfilename[i - 1] = '\0'; ++ } + } + + /* If the expanded filename is an absolute path, check that it's still +@@ -2571,7 +2574,7 @@ + size_t ext_len, encodings_len; + int i, top, bot, mid; + int r; +- char* default_type = "text/plain; charset=%s"; ++ char* default_type = "application/octet-stream"; + + /* Peel off encoding extensions until there aren't any more. */ + n_me_indexes = 0; +@@ -3312,7 +3315,7 @@ + cp += strcspn( cp, " \t" ); + status = atoi( cp ); + } +- if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 && ++ else if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 && + cp < br && + ( cp == headers || *(cp-1) == '\012' ) ) + status = 302; +@@ -3889,6 +3892,9 @@ httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl ); return -1; } diff --git a/www/thttpd/files/patch-thttpd.c b/www/thttpd/files/patch-thttpd.c index 509fb9a14f97..d8300c239193 100644 --- a/www/thttpd/files/patch-thttpd.c +++ b/www/thttpd/files/patch-thttpd.c @@ -13,7 +13,7 @@ syslog( LOG_NOTICE, "re-opening logfile" ); logfp = fopen( logfile, "a" ); - if ( logfp == (FILE*) 0 ) -+ retchmod = chmod( logfile, S_IRUSR|S_IWUSR ); ++ retchmod = chmod( logfile, S_IRUSR|S_IWUSR|S_IRGRP ); + if ( logfp == (FILE*) 0 || retchmod != 0 ) { syslog( LOG_CRIT, "re-opening %.80s - %m", logfile ); diff --git a/www/thttpd/files/pkg-message.in b/www/thttpd/files/pkg-message.in index b006e17fb49e..7662341373bc 100644 --- a/www/thttpd/files/pkg-message.in +++ b/www/thttpd/files/pkg-message.in @@ -3,7 +3,7 @@ If you want users to be able to create their own Web subdirectories off of the main web directory, you need to: 1. Add a group for www admins (e.g., "%%WWWGRP%%") - 2. chgrp thatgroup %%PREFIX%%/bin/makeweb %%PREFIX%%/www + 2. chgrp thatgroup %%PREFIX%%/bin/makeweb %%WWWDIR%% 3. chmod 2755 %%PREFIX%%/bin/makeweb 4. Tell users about makeweb(1) diff --git a/www/thttpd/files/thttpd.conf.sample.in b/www/thttpd/files/thttpd.conf.sample.in index 8d6398397142..b27bd4850abb 100644 --- a/www/thttpd/files/thttpd.conf.sample.in +++ b/www/thttpd/files/thttpd.conf.sample.in @@ -1,6 +1,6 @@ user=%%WWWOWN%% -dir=%%PREFIX%%/www/data +dir=%%WWWDIR%% chroot -cgipat=*.cgi +cgipat=/cgi-bin/* logfile=/var/log/thttpd.log pidfile=/var/run/thttpd.pid diff --git a/www/thttpd/pkg-plist b/www/thttpd/pkg-plist index 46d83a69633e..438b9e4c710c 100644 --- a/www/thttpd/pkg-plist +++ b/www/thttpd/pkg-plist @@ -1,16 +1,14 @@ -bin/thttpdpasswd -bin/makeweb -bin/syslogtocern @sample etc/thttpd.conf.sample man/man1/makeweb.1.gz -man/man1/thttpdpasswd.1.gz +man/man1/thtpasswd.1.gz man/man8/redirect.8.gz man/man8/ssi.8.gz man/man8/syslogtocern.8.gz man/man8/thttpd.8.gz +sbin/makeweb +sbin/syslogtocern sbin/thttpd -www/cgi-bin/phf -www/cgi-bin/redirect -www/cgi-bin/ssi -@dirrmtry www/cgi-bin -@dirrmtry www/data +sbin/thtpasswd +%%WWWDIR%%/cgi-bin/phf +%%WWWDIR%%/cgi-bin/redirect +%%WWWDIR%%/cgi-bin/ssi |