Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7-0]: src/libexec/httpd Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/e46953da448b
branches:  netbsd-7-0
changeset: 801263:e46953da448b
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Dec 23 07:47:40 2016 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1309):
        libexec/httpd/CHANGES: revisions 1.23, 1.24
        libexec/httpd/bozohttpd.8: revisions 1.60-1.62
        libexec/httpd/bozohttpd.c: revisions 1.81-1.84
        libexec/httpd/bozohttpd.h: revision 1.46
        libexec/httpd/cgi-bozo.c: revision 1.35
        libexec/httpd/content-bozo.c: revision 1.14
        libexec/httpd/main.c: revisions 1.14-1.16
        libexec/httpd/testsuite/Makefile: revision 1.6
        libexec/httpd/testsuite/test-bigfile: revision 1.3
        libexec/httpd/testsuite/test-simple: revisions 1.1, 1.2
update bozohttpd to 2016072:
- fix memory leak
- addd -G option to display version
- fix some content type issues
- fix issues in testsuite

diffstat:

 libexec/httpd/CHANGES                |   5 ++++-
 libexec/httpd/bozohttpd.8            |  19 ++++++++++++-------
 libexec/httpd/bozohttpd.c            |  16 ++++++++++++----
 libexec/httpd/bozohttpd.h            |   4 +++-
 libexec/httpd/cgi-bozo.c             |   8 ++++----
 libexec/httpd/content-bozo.c         |  22 +++++++++++-----------
 libexec/httpd/main.c                 |  17 ++++++++++++++---
 libexec/httpd/testsuite/Makefile     |  19 ++++++++++++-------
 libexec/httpd/testsuite/test-bigfile |   9 +++++++++
 libexec/httpd/testsuite/test-simple  |  23 +++++++++++++++++++++++
 10 files changed, 104 insertions(+), 38 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/CHANGES
--- a/libexec/httpd/CHANGES     Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/CHANGES     Fri Dec 23 07:47:40 2016 +0000
@@ -1,4 +1,7 @@
-$eterna: CHANGES,v 1.78 2011/11/18 01:25:11 mrg Exp $
+$NetBSD: CHANGES,v 1.19.2.1.2.2 2016/12/23 07:47:40 snj Exp $
+
+changes in bozohttpd 20160517:
+       o add a bozo_get_version() function which returns the version number
 
 changes in bozohttpd 20160415:
        o  add search-word support for CGI
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/bozohttpd.8
--- a/libexec/httpd/bozohttpd.8 Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/bozohttpd.8 Fri Dec 23 07:47:40 2016 +0000
@@ -1,8 +1,8 @@
-.\"    $NetBSD: bozohttpd.8,v 1.46.4.4.2.1 2016/04/15 18:55:49 snj Exp $
+.\"    $NetBSD: bozohttpd.8,v 1.46.4.4.2.2 2016/12/23 07:47:40 snj Exp $
 .\"
 .\"    $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
 .\"
-.\" Copyright (c) 1997-2015 Matthew R. Green
+.\" Copyright (c) 1997-2016 Matthew R. Green
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 12, 2015
+.Dd December 11, 2016
 .Dt BOZOHTTPD 8
 .Os
 .Sh NAME
@@ -34,7 +34,7 @@
 .Nd hyper text transfer protocol version 1.1 daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl EHVXefhnsu
+.Op Fl EGHVXefhnsu
 .Op Fl C Ar suffix cgihandler
 .Op Fl I Ar port
 .Op Fl L Ar prefix script
@@ -132,6 +132,10 @@
 flag from
 .Nm
 detaching from the tty and going into the background.
+.It Fl G
+Get the
+.Nm
+version string, print it on standard output, and exit.
 .It Fl H
 Causes directory index mode to hide files and directories
 that start with a period, except for
@@ -272,8 +276,9 @@
 Note that enabling this support implies that users can run
 commands as web server user, this may have security implications.
 .It Fl V
-Sets the default virtual host directory to
-.Ar slashdir .
+Sets the backup virtual host directory to the
+.Ar slashdir
+argument.
 If no directory exists in
 .Ar virtualroot
 for the request, then
@@ -526,7 +531,7 @@
 and regular code audits.
 This manual documents
 .Nm
-version 20150501.
+version 20160720.
 .Sh AUTHORS
 .An -nosplit
 .Nm
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/bozohttpd.c Fri Dec 23 07:47:40 2016 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: bozohttpd.c,v 1.56.2.4.2.1 2016/04/15 18:55:49 snj Exp $       */
+/*     $NetBSD: bozohttpd.c,v 1.56.2.4.2.2 2016/12/23 07:47:40 snj Exp $       */
 
 /*     $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $      */
 
 /*
- * Copyright (c) 1997-2015 Matthew R. Green
+ * Copyright (c) 1997-2016 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -109,7 +109,7 @@
 #define INDEX_HTML             "index.html"
 #endif
 #ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE                "bozohttpd/20160415"
+#define SERVER_SOFTWARE                "bozohttpd/20160720"
 #endif
 #ifndef DIRECT_ACCESS_FILE
 #define DIRECT_ACCESS_FILE     ".bzdirect"
@@ -2244,6 +2244,7 @@
        extern char     **environ;
        static char      *cleanenv[1] = { NULL };
        uid_t             uid;
+       int               uidset = 0;
        char             *chrootdir;
        char             *username;
        char             *portnum;
@@ -2339,6 +2340,7 @@
                        bozoerr(httpd, 1, "setgid(%u): %s", pw->pw_gid,
                                strerror(errno));
                uid = pw->pw_uid;
+               uidset = 1;
        }
        /*
         * handle chroot.
@@ -2353,7 +2355,7 @@
                                strerror(errno));
        }
 
-       if (username != NULL && setuid(uid) == -1)
+       if (uidset && setuid(uid) == -1)
                bozoerr(httpd, 1, "setuid(%d): %s", uid, strerror(errno));
 
        /*
@@ -2375,3 +2377,9 @@
 
        return 1;
 }
+
+int
+bozo_get_version(char *buf, size_t size)
+{
+       return snprintf(buf, size, "%s", SERVER_SOFTWARE);
+}
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/bozohttpd.h
--- a/libexec/httpd/bozohttpd.h Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/bozohttpd.h Fri Dec 23 07:47:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.h,v 1.33.2.2.2.1 2016/04/15 18:55:49 snj Exp $       */
+/*     $NetBSD: bozohttpd.h,v 1.33.2.2.2.2 2016/12/23 07:47:40 snj Exp $       */
 
 /*     $eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $       */
 
@@ -367,4 +367,6 @@
 int bozo_set_pref(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
 char *bozo_get_pref(bozoprefs_t *, const char *);
 
+int bozo_get_version(char */*buf*/, size_t /*size*/);
+
 #endif /* BOZOHTTOPD_H_ */
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/cgi-bozo.c
--- a/libexec/httpd/cgi-bozo.c  Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/cgi-bozo.c  Fri Dec 23 07:47:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgi-bozo.c,v 1.25.2.2.2.2 2016/04/15 20:24:04 mrg Exp $        */
+/*     $NetBSD: cgi-bozo.c,v 1.25.2.2.2.3 2016/12/23 07:47:40 snj Exp $        */
 
 /*     $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $        */
 
@@ -333,12 +333,12 @@
 
 parse_err:
 
+       free (str);
        free (*args);
-       free (str);
-       *args = NULL;
+       free(args);
        *args_len = 0;
 
-       return 0;
+       return NULL;
 
 }
 
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/content-bozo.c
--- a/libexec/httpd/content-bozo.c      Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/content-bozo.c      Fri Dec 23 07:47:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: content-bozo.c,v 1.10.2.2.2.1 2016/04/15 18:55:49 snj Exp $    */
+/*     $NetBSD: content-bozo.c,v 1.10.2.2.2.2 2016/12/23 07:47:40 snj Exp $    */
 
 /*     $eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $    */
 
@@ -62,16 +62,16 @@
        { ".pac",       "application/x-ns-proxy-autoconfig", "",        "", NULL },
        { ".pa",        "application/x-ns-proxy-autoconfig", "",        "", NULL },
        { ".tar",       "multipart/x-tar",              "",             "", NULL },
-       { ".gtar",      "multipart/x-gtar",             "",             "", NULL },
-       { ".tar.Z",     "multipart/x-tar",              "x-compress",   "compress", NULL },
-       { ".tar.gz",    "multipart/x-tar",              "x-gzip",       "gzip", NULL },
-       { ".taz",       "multipart/x-tar",              "x-gzip",       "gzip", NULL },
-       { ".tgz",       "multipart/x-tar",              "x-gzip",       "gzip", NULL },
-       { ".tar.z",     "multipart/x-tar",              "x-pack",       "x-pack", NULL },
-       { ".Z",         "application/x-compress",       "x-compress",   "compress", NULL },
-       { ".gz",        "application/x-gzip",           "x-gzip",       "gzip", NULL },
-       { ".z",         "unknown",                      "x-pack",       "x-pack", NULL },
-       { ".bz2",       "application/x-bzip2",          "x-bzip2",      "x-bzip2", NULL },
+       { ".gtar",      "application/x-gtar-compressed", "",            "", NULL },
+       { ".tar.Z",     "application/x-gtar-compressed", "",            "", NULL },
+       { ".tar.gz",    "application/x-gtar-compressed", "",            "", NULL },
+       { ".taz",       "application/x-gtar-compressed", "",            "", NULL },
+       { ".tgz",       "application/x-gtar-compressed", "",            "", NULL },
+       { ".tar.z",     "application/x-gtar-compressed", "",            "", NULL },
+       { ".Z",         "application/x-compress",       "",             "", NULL },
+       { ".gz",        "application/x-gzip",           "",             "", NULL },
+       { ".z",         "unknown",                      "",             "", NULL },
+       { ".bz2",       "application/x-bzip2",          "",             "", NULL },
        { ".ogg",       "application/x-ogg",            "",             "", NULL },
        { ".mkv",       "video/x-matroska",             "",             "", NULL },
        { ".xbel",      "text/xml",                     "",             "", NULL },
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/main.c
--- a/libexec/httpd/main.c      Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/main.c      Fri Dec 23 07:47:40 2016 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: main.c,v 1.8.4.1 2016/04/15 18:55:49 snj Exp $ */
+/*     $NetBSD: main.c,v 1.8.4.2 2016/12/23 07:47:40 snj Exp $ */
 
 /*     $eterna: main.c,v 1.6 2011/11/18 09:21:15 mrg Exp $     */
 /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp       */
 
 /*
- * Copyright (c) 1997-2014 Matthew R. Green
+ * Copyright (c) 1997-2016 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -101,6 +101,7 @@
        bozowarn(httpd,
                "   -v virtualroot\tenable virtual host support "
                "in this directory");
+       bozowarn(httpd, "   -V\t\tUnknown virtual hosts go to `slashdir'");
 #ifndef NO_DIRINDEX_SUPPORT
        bozowarn(httpd,
                "   -X\t\t\tenable automatic directory index support");
@@ -118,6 +119,7 @@
                        " and private key file\n"
                "\t\t\tin pem format and enable bozohttpd in SSL mode");
 #endif /* NO_SSL_SUPPORT */
+       bozowarn(httpd, "   -G print version number and exit");
        bozoerr(httpd, 1, "%s failed to start", progname);
 }
 
@@ -148,7 +150,7 @@
         */
 
        while ((c = getopt(argc, argv,
-           "C:EHI:L:M:P:S:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) {
+           "C:EGHI:L:M:P:S:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) {
                switch (c) {
 
                case 'L':
@@ -351,6 +353,15 @@
 
 #endif /* NO_DIRINDEX_SUPPORT */
 
+               case 'G':
+                       {
+                               char    version[128];
+
+                               bozo_get_version(version, sizeof(version));
+                               printf("bozohttpd version %s\n", version);
+                       }
+                       return 0;
+
                default:
                        usage(&httpd, progname);
                        /* NOTREACHED */
diff -r ffbdbf3efb9a -r e46953da448b libexec/httpd/testsuite/Makefile
--- a/libexec/httpd/testsuite/Makefile  Tue Dec 20 06:16:43 2016 +0000
+++ b/libexec/httpd/testsuite/Makefile  Fri Dec 23 07:47:40 2016 +0000
@@ -7,26 +7,31 @@
 BOZOHTTPD?=    ../debug/bozohttpd-debug
 WGET?=         wget
 DATA?=         $(.CURDIR)/data 
+VERBOSE?=      yes
+
+.if ${VERBOSE} != "yes"
+SILENT=                @
+.else
+SILENT=
+.endif
+
 all:
 
 clean:
-       for a in $(SIMPLETESTS); do \
-               rm -f tmp.$$a.out; \
+       for a in $(SIMPLETESTS) $(BIGFILETESTS); do \
+               rm -f tmp.$$a.out tmp.$$a.err; \
        done
 
 check: check-simple check-bigfile
 
 check-simple:
 .for a in $(SIMPLETESTS)
-       echo "Running test $a"
-       $(BOZOHTTPD) "$(DATA)" < $(.CURDIR)/$a.in > tmp.$a.out || true
-       $(.CURDIR)/html_cmp $(.CURDIR)/$a.out tmp.$a.out



Home | Main Index | Thread Index | Old Index