Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/httpd - fix a bug in cgi processing. from Dennis Li...
details: https://anonhg.NetBSD.org/src/rev/18efe4d5a47b
branches: trunk
changeset: 351028:18efe4d5a47b
user: mrg <mrg%NetBSD.org@localhost>
date: Tue Jan 31 14:33:54 2017 +0000
description:
- fix a bug in cgi processing. from Dennis Lindroos.
- add a testcase for this, and expand test-simple to handle additional
args to bozohttpd for eg, cgi-bin setting.
- fix objdir bugs in the testsuite.
diffstat:
libexec/httpd/CHANGES | 9 +++++++--
libexec/httpd/cgi-bozo.c | 5 +++--
libexec/httpd/testsuite/Makefile | 10 ++++++++--
libexec/httpd/testsuite/t11.in | 3 +++
libexec/httpd/testsuite/t11.out | 1 +
libexec/httpd/testsuite/test-bigfile | 19 ++++++++++++-------
libexec/httpd/testsuite/test-simple | 28 +++++++++++++++++++---------
7 files changed, 53 insertions(+), 22 deletions(-)
diffs (177 lines):
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/CHANGES
--- a/libexec/httpd/CHANGES Tue Jan 31 09:17:53 2017 +0000
+++ b/libexec/httpd/CHANGES Tue Jan 31 14:33:54 2017 +0000
@@ -1,7 +1,12 @@
-$NetBSD: CHANGES,v 1.24 2016/08/20 00:36:41 mrg Exp $
+$NetBSD: CHANGES,v 1.25 2017/01/31 14:33:54 mrg Exp $
+
+changes in bozohttpd 20170201:
+ o fix an infinite loop in cgi processing
+ o fixes and clean up for the testsuite
+ o no longer sends encoding header for compressed formats
changes in bozohttpd 20160517:
- o add a bozo_get_version() function which returns the version number
+ 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 e612c21aa719 -r 18efe4d5a47b libexec/httpd/cgi-bozo.c
--- a/libexec/httpd/cgi-bozo.c Tue Jan 31 09:17:53 2017 +0000
+++ b/libexec/httpd/cgi-bozo.c Tue Jan 31 14:33:54 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgi-bozo.c,v 1.35 2016/04/24 18:24:47 christos Exp $ */
+/* $NetBSD: cgi-bozo.c,v 1.36 2017/01/31 14:33:54 mrg Exp $ */
/* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */
@@ -235,7 +235,8 @@
*/
*args_len = 1;
/* count '+' in str */
- for (s = str; (s = strchr(s, '+')); (*args_len)++);
+ for (s = str; (s = strchr(s, '+')); (*args_len)++)
+ s++;
args = bozomalloc(httpd, sizeof(*args) * (*args_len + 1));
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/testsuite/Makefile
--- a/libexec/httpd/testsuite/Makefile Tue Jan 31 09:17:53 2017 +0000
+++ b/libexec/httpd/testsuite/Makefile Tue Jan 31 14:33:54 2017 +0000
@@ -1,6 +1,7 @@
# $eterna: Makefile,v 1.14 2009/05/22 21:51:39 mrg Exp $
SIMPLETESTS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
+CGITESTS= t11
BIGFILETESTS= partial4000 partial8000
BOZOHTTPD?= ../bozohttpd
@@ -22,11 +23,16 @@
rm -f tmp.$$a.out tmp.$$a.err; \
done
-check: check-simple check-bigfile
+check: check-simple check-cgi check-bigfile
check-simple:
.for a in $(SIMPLETESTS)
- ${SILENT}$(.CURDIR)/test-simple "$a" "${BOZOHTTPD}" "${DATA}" "${VERBOSE}"
+ ${SILENT}$(.CURDIR)/test-simple "$a" "${BOZOHTTPD}" "${DATA}" "${.CURDIR}" "${VERBOSE}"
+.endfor
+
+check-cgi:
+.for a in $(CGITESTS)
+ ${SILENT}$(.CURDIR)/test-simple "$a" "${BOZOHTTPD}" "${DATA}" "${.CURDIR}" "${VERBOSE}" -c "${.CURDIR}/cgi-bin"
.endfor
check-bigfile:
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/testsuite/t11.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libexec/httpd/testsuite/t11.in Tue Jan 31 14:33:54 2017 +0000
@@ -0,0 +1,3 @@
+GET /cgi-bin/echo.bat?&dir+c:\\ HTTP/1.1
+Host:
+
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/testsuite/t11.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libexec/httpd/testsuite/t11.out Tue Jan 31 14:33:54 2017 +0000
@@ -0,0 +1,1 @@
+HTTP/1.1 200 OK
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/testsuite/test-bigfile
--- a/libexec/httpd/testsuite/test-bigfile Tue Jan 31 09:17:53 2017 +0000
+++ b/libexec/httpd/testsuite/test-bigfile Tue Jan 31 14:33:54 2017 +0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: test-bigfile,v 1.3 2016/09/23 16:55:56 schmonz Exp $
+# $NetBSD: test-bigfile,v 1.4 2017/01/31 14:33:54 mrg Exp $
test="$1" # partial4000 or partial8000
bozohttpd="$2"
@@ -7,30 +7,35 @@
datadir="$4"
verbose="$5"
+tmperr="tmp.$test.err"
+
if [ "yes" = "$verbose" ]; then
echo "Running test $test"
else
- exec 2>tmp.$test.err
+ exec 2>"$tmperr"
fi
bozotestport=11111
# copy beginning file
-cp ${datadir}/bigfile.${test} ./bigfile
+cp "${datadir}/bigfile.${test}" ./bigfile
# fire up bozohttpd
-${bozohttpd} -b -b -I ${bozotestport} -n -s -f ${datadir} &
+${bozohttpd} -b -b -I ${bozotestport} -n -s -f "${datadir}" &
bozopid=$!
-${wget} -c http://localhost:${bozotestport}/bigfile
+"${wget}" -c http://localhost:${bozotestport}/bigfile
kill -9 $bozopid
-if cmp ./bigfile ${datadir}/bigfile; then
+if cmp ./bigfile "${datadir}/bigfile"; then
rm -f ./bigfile
exit 0
else
rm -f ./bigfile
- [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err`"
+ if [ "yes" = "$verbose" ]; then
+ echo "Failed test $test:"
+ cat "$tmperr"
+ fi
exit 1
fi
diff -r e612c21aa719 -r 18efe4d5a47b libexec/httpd/testsuite/test-simple
--- a/libexec/httpd/testsuite/test-simple Tue Jan 31 09:17:53 2017 +0000
+++ b/libexec/httpd/testsuite/test-simple Tue Jan 31 14:33:54 2017 +0000
@@ -1,23 +1,33 @@
#! /bin/sh
-# $NetBSD: test-simple,v 1.3 2016/12/27 12:09:19 schmonz Exp $
+# $NetBSD: test-simple,v 1.4 2017/01/31 14:33:54 mrg Exp $
-test="$1"
-bozohttpd="$2"
-datadir="$3"
-verbose="$4"
+test="$1"; shift
+bozohttpd="$1"; shift
+datadir="$1"; shift
+curdir="$1"; shift
+verbose="$1"; shift
+
+in="$curdir/$test.in"
+out="$curdir/$test.out"
+tmpout="tmp.$test.out"
+tmperr="tmp.$test.err"
if [ "yes" = "$verbose" ]; then
echo "Running test $test"
else
- exec 2>tmp.$test.err
+ exec 2>"$tmperr"
fi
bozotestport=11111
-${bozohttpd} ${datadir} < $test.in > tmp.$test.out
-if ./html_cmp cmp $test.out tmp.$test.out; then
+${bozohttpd} "$@" "${datadir}" < "$in" > "$tmpout"
+if "$curdir/html_cmp" cmp "$out" "$tmpout"; then
exit 0
else
- [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err; echo; ./html_cmp diff $test.out tmp.$test.out`"
+ if [ "yes" = "$verbose" ]; then
+ echo "Failed test $test:"
+ cat "$tmperr"
+ $curdir/html_cmp diff "$out" "$tmpout"
+ fi
exit 1
fi
Home |
Main Index |
Thread Index |
Old Index