diff --git a/config.h b/config.h index 5f836df..951299d 100644 --- a/config.h +++ b/config.h @@ -138,7 +138,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "168" +#define VCS_REVISION "169" /* Version number of package */ #define VERSION "2.9" diff --git a/configure b/configure index 86ab553..1f353a4 100755 --- a/configure +++ b/configure @@ -2317,7 +2317,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VCS_REVISION=168 +VCS_REVISION=169 cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index b94a5e7..9e54461 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.57) dnl This is the one location where the authoritative version number is stored AC_INIT(shellinabox, 2.9, markus@shellinabox.com) -VCS_REVISION=168 +VCS_REVISION=169 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) diff --git a/demo/vt100.js b/demo/vt100.js index 64dd2c1..9dccb5e 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -1829,7 +1829,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.9 (revision 168)" + + alert("VT100 Terminal Emulator " + "2.9 (revision 169)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index 3468695..6807414 100644 --- a/shellinabox/shell_in_a_box.js +++ b/shellinabox/shell_in_a_box.js @@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) { }; ShellInABox.prototype.about = function() { - alert("Shell In A Box version " + "2.9 (revision 168)" + + alert("Shell In A Box version " + "2.9 (revision 169)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com" + (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index b89669a..e2d6034 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -350,12 +350,17 @@ static int dataHandler(HttpConnection *http, struct Service *service, // Create a new session, if the client did not provide an existing one if (isNew) { - if (cgiServer && cgiSessions++) { - serverExitLoop(cgiServer, 1); + if (keys) { + bad_new_session: abandonSession(session); httpSendReply(http, 400, "Bad Request", NO_MSG); return HTTP_DONE; } + + if (cgiServer && cgiSessions++) { + serverExitLoop(cgiServer, 1); + goto bad_new_session; + } session->http = http; if (launchChild(service->id, session) < 0) { abandonSession(session); diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 64dd2c1..9dccb5e 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -1829,7 +1829,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.9 (revision 168)" + + alert("VT100 Terminal Emulator " + "2.9 (revision 169)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/stresstest.sh b/stresstest.sh new file mode 100755 index 0000000..88f5cf6 --- /dev/null +++ b/stresstest.sh @@ -0,0 +1,44 @@ +#!/bin/bash -e + +PORT=4201 +PIDFILE=stresstest.pid + +rm -f "${PIDFILE}" +trap '[ -r "${PIDFILE}" ] && kill "$(cat "${PIDFILE}")"; rm -f "${PIDFILE}"' \ + EXIT INT TERM QUIT HUP + +./shellinaboxd -p "${PORT}" -s "/:$(id -u):$(id -g):${PWD}:/bin/bash -c \ + 'while read i; do [ -z "${i}" ] && break; echo \" $i\"; done'" \ + --background="${PIDFILE}" + +session() { + local data="$(wget -O- --post-data='' --quiet "http://localhost:${PORT}/")" + local session="${data##*\"session\":\"}" + session="${session%%\"*}" + while read -r i; do + local keys="$(echo -n "${i}" | od -tx1 -An -w1000)" + wget -O/dev/null --post-data="session=${session}&keys=${keys// /}" \ + --quiet "http://localhost:${PORT}/" + kill -0 "$(cat "${PIDFILE}")" || break + [ -z "$i" ] && break + data="$(wget -O- --post-data="session=${session}" \ + --quiet "http://localhost:${PORT}/")" + data=${data##*\"data\":\"} + data=${data%%\"*} + echo "${data}" + done <<'EOF' +Hello world +This is a test +OK, that's it for now + +EOF +} + +pids="" +for i in `seq 100`; do + session & + pids="${pids} $!" + sleep 0.02 + kill -0 "$(cat "${PIDFILE}")" || break +done +wait $pids >&/dev/null