diff options
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | PKGBUILD | 73 | ||||
-rw-r--r-- | config | 4 | ||||
-rw-r--r-- | crypt.patch | 24 | ||||
-rw-r--r-- | discreet.patch | 37 | ||||
-rw-r--r-- | forwarded-for.patch | 16 | ||||
-rw-r--r-- | service | 10 |
7 files changed, 188 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2a7dab86bd40 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = thttpd + pkgdesc = Simple, small, portable, fast, and secure HTTP server + pkgver = 2.26 + pkgrel = 5 + url = http://www.acme.com/software/thttpd/ + arch = i686 + arch = x86_64 + license = custom:BSD + backup = etc/thttpd.conf + source = http://www.acme.com/software/thttpd/thttpd-2.26.tar.gz + source = forwarded-for.patch + source = discreet.patch + source = crypt.patch + source = service + source = config + sha1sums = 9b943aeeab9ef92dfd60595649cbe9cf7394968c + sha1sums = 1293fbaf83a489c65d6d2b107d797c687233d96a + sha1sums = b954028d4360ad856f7fb1edc8534f0652f33d20 + sha1sums = 603007a9292e84eea864b9ffb3bdf34c7e4dd8c9 + sha1sums = 73bd76de0e89a9cc31e5605659837d83b3c8dfde + sha1sums = 7a6413491b6ba68625d450caa3c6f071af0ca1ac + +pkgname = thttpd + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..021b0d4a3043 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,73 @@ +# $Id: PKGBUILD 135280 2015-06-13 19:44:48Z bisson $ +# Maintainer: Gaetan Bisson <bisson@archlinux.org> +# Contributor: Damir Perisa <damir.perisa@bluewin.ch> +# Contributor: Stewart Starbuck <stewart@stewartstarbuck.co.uk> + +pkgname=thttpd +pkgver=2.26 +pkgrel=5 +pkgdesc='Simple, small, portable, fast, and secure HTTP server' +url='http://www.acme.com/software/thttpd/' +license=('custom:BSD') +arch=('i686' 'x86_64') +backup=('etc/thttpd.conf') +source=("http://www.acme.com/software/thttpd/${pkgname}-${pkgver}.tar.gz" + 'forwarded-for.patch' + 'discreet.patch' + 'crypt.patch' + 'service' + 'config') +sha1sums=('9b943aeeab9ef92dfd60595649cbe9cf7394968c' + '1293fbaf83a489c65d6d2b107d797c687233d96a' + 'b954028d4360ad856f7fb1edc8534f0652f33d20' + '603007a9292e84eea864b9ffb3bdf34c7e4dd8c9' + '73bd76de0e89a9cc31e5605659837d83b3c8dfde' + '7a6413491b6ba68625d450caa3c6f071af0ca1ac') + +prepare() { + cd "${srcdir}/${pkgname}-${pkgver}" + patch -p1 -i ../forwarded-for.patch + patch -p1 -i ../discreet.patch + patch -p1 -i ../crypt.patch + sed \ + -e 's/^CFLAGS =/CFLAGS +=/' \ + -e '/^STATICFLAG =/c STATICFLAG =' \ + -i {*/,}Makefile.in +} + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + + # ./configure messes up DEFS when FORTIFY_SOURCE=1 + CPPFLAGS= ./configure \ + --prefix=/usr \ + --mandir=/usr/share/man \ + + CFLAGS+=" $CPPFLAGS" + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + install -d "${pkgdir}"/usr/share/man/man1 + make \ + BINDIR="${pkgdir}"/usr/bin \ + WEBDIR="${pkgdir}"/srv/http \ + MANDIR="${pkgdir}"/usr/share/man \ + WEBGROUP=root \ + install + + rm -fr "${pkgdir}"/srv + chown root:root -R "${pkgdir}" + chmod 755 -R "${pkgdir}"/usr/bin # strip needs u+w + + install -Dm644 ../config "${pkgdir}"/etc/thttpd.conf + install -Dm644 ../service "${pkgdir}"/usr/lib/systemd/system/thttpd.service + + install -d "${pkgdir}"/usr/share/licenses/"${pkgname}" + head -n 26 thttpd.c > "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE + + # conflicts with apache + mv "${pkgdir}"/usr/bin/htpasswd{,-thttpd} + mv "${pkgdir}"/usr/share/man/man1/htpasswd{,-thttpd}.1 +} diff --git a/config b/config new file mode 100644 index 000000000000..1f0ea0687529 --- /dev/null +++ b/config @@ -0,0 +1,4 @@ +dir=/srv/http +vhost +user=http +cgipat=**.cgi diff --git a/crypt.patch b/crypt.patch new file mode 100644 index 000000000000..982e6780fc9f --- /dev/null +++ b/crypt.patch @@ -0,0 +1,24 @@ +diff -Naur old/extras/htpasswd.c new/extras/htpasswd.c +--- old/extras/htpasswd.c 2014-10-19 10:28:39.782856897 -1000 ++++ new/extras/htpasswd.c 2014-10-19 10:29:12.842911168 -1000 +@@ -8,6 +8,8 @@ + ** if stdin is a pipe or file. This is necessary for use from CGI. + */ + ++#define _XOPEN_SOURCE ++ + #include <sys/types.h> + #include <stdio.h> + #include <string.h> +diff -Naur old/libhttpd.c new/libhttpd.c +--- old/libhttpd.c 2014-10-19 10:28:39.782856897 -1000 ++++ new/libhttpd.c 2014-10-19 10:29:01.679559501 -1000 +@@ -39,6 +39,8 @@ + #include <sys/param.h> + #include <sys/stat.h> + ++#define __USE_XOPEN ++ + #include <ctype.h> + #include <errno.h> + #include <fcntl.h> diff --git a/discreet.patch b/discreet.patch new file mode 100644 index 000000000000..14c84e0f00cb --- /dev/null +++ b/discreet.patch @@ -0,0 +1,37 @@ +diff -Naur old/libhttpd.c new/libhttpd.c +--- old/libhttpd.c 2014-08-15 11:32:31.040595413 +0900 ++++ new/libhttpd.c 2014-08-15 11:34:57.690595931 +0900 +@@ -754,7 +754,7 @@ + <title>%d %s</title>\n\ + </head>\n\ + \n\ +- <body bgcolor=\"#cc9999\" text=\"#000000\" link=\"#2020ff\" vlink=\"#4040cc\">\n\ ++ <body>\n\ + \n\ + <h2>%d %s</h2>\n", + status, title, status, title ); +@@ -780,14 +780,9 @@ + char buf[1000]; + + (void) my_snprintf( buf, sizeof(buf), "\ +- <hr>\n\ +-\n\ +- <address><a href=\"%s\">%s</a></address>\n\ +-\n\ + </body>\n\ + \n\ +-</html>\n", +- SERVER_ADDRESS, EXPOSED_SERVER_SOFTWARE ); ++</html>\n" ); + add_response( hc, buf ); + } + +@@ -2798,7 +2793,7 @@ + <title>Index of %.80s</title>\n\ + </head>\n\ + \n\ +- <body bgcolor=\"#99cc99\" text=\"#000000\" link=\"#2020ff\" vlink=\"#4040cc\">\n\ ++ <body>\n\ + \n\ + <h2>Index of %.80s</h2>\n\ + \n\ diff --git a/forwarded-for.patch b/forwarded-for.patch new file mode 100644 index 000000000000..348eb00cf2b8 --- /dev/null +++ b/forwarded-for.patch @@ -0,0 +1,16 @@ +diff -Naur old/libhttpd.c new/libhttpd.c +--- old/libhttpd.c 2005-06-30 03:50:39.000000000 +1000 ++++ new/libhttpd.c 2012-10-24 12:12:17.144560917 +1100 +@@ -2207,6 +2207,12 @@ + if ( strcasecmp( cp, "keep-alive" ) == 0 ) + hc->keep_alive = 1; + } ++ else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 ) ++ { ++ cp = &buf[16]; ++ cp += strspn( cp, " \t" ); ++ inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) ); ++ } + #ifdef LOG_UNKNOWN_HEADERS + else if ( strncasecmp( buf, "Accept-Charset:", 15 ) == 0 || + strncasecmp( buf, "Accept-Language:", 16 ) == 0 || diff --git a/service b/service new file mode 100644 index 000000000000..2b40115baeb2 --- /dev/null +++ b/service @@ -0,0 +1,10 @@ +[Unit] +Description=Tiny HTTP Daemon + +[Service] +PIDFile=/run/thttpd.pid +ExecStart=/usr/bin/thttpd -D -C /etc/thttpd.conf +Restart=always + +[Install] +WantedBy=multi-user.target |