From 052a47aa08fabc9c0eed755fbe3123d520139a11 Mon Sep 17 00:00:00 2001 From: "zodiac@gmail.com" Date: Mon, 27 Jul 2009 18:31:05 +0000 Subject: [PATCH] Use JavaScript redirection for attaching the missing slash to the URL. This should make it easier to use reverse proxies. It was already possible to run shellinaboxd behind a proxy, but a lot of users got the configuration wrong. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@152 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- ChangeLog | 7 +++++ config.h | 2 +- configure | 2 +- configure.ac | 2 +- demo/vt100.js | 2 +- shellinabox/root_page.html | 26 ++++++++++++++++++ shellinabox/shell_in_a_box.js | 4 +-- shellinabox/shell_in_a_box.jspp | 2 +- shellinabox/shellinaboxd.c | 47 ++++++++++----------------------- shellinabox/vt100.js | 2 +- 10 files changed, 55 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5ff00c..bb06a9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-07-27 Markus Gutschke + + * Use JavaScript redirection for attaching the missing slash to + the URL. This should make it easier to use reverse proxies. It was + already possible to run shellinaboxd behind a proxy, but a lot of + users got the configuration wrong. + 2009-07-08 Markus Gutschke * Optionally compress large responses, if the browser accepts diff --git a/config.h b/config.h index 6670764..b70ebf6 100644 --- a/config.h +++ b/config.h @@ -135,7 +135,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "149" +#define VCS_REVISION "152" /* Version number of package */ #define VERSION "2.9" diff --git a/configure b/configure index b917151..b95d2e8 100755 --- a/configure +++ b/configure @@ -2037,7 +2037,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VCS_REVISION=149 +VCS_REVISION=152 cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index 84d420e..4c85c7c 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=149 +VCS_REVISION=152 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 6013cef..1884e8b 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -1693,7 +1693,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.9 (revision 149)" + + alert("VT100 Terminal Emulator " + "2.9 (revision 152)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/shellinabox/root_page.html b/shellinabox/root_page.html index 75ceb11..adb3342 100644 --- a/shellinabox/root_page.html +++ b/shellinabox/root_page.html @@ -50,6 +50,32 @@ Shell In A Box \n" - ""); - } else { - extern char rootPageStart[]; - extern char rootPageEnd[]; - serveStaticFile(http, "text/html; charset=utf-8", - rootPageStart, rootPageEnd); - } + extern char rootPageStart[]; + extern char rootPageEnd[]; + char *rootPage; + check(rootPage = malloc(rootPageEnd - rootPageStart + 1)); + memcpy(rootPage, rootPageStart, rootPageEnd - rootPageStart); + rootPage[rootPageEnd - rootPageStart] = '\000'; + char *html = stringPrintf(NULL, rootPage, + enableSSL ? "true" : "false"); + httpSendReply(http, 200, "OK", html); + free(rootPage); } else if (pathInfoLength == 8 && !memcmp(pathInfo, "beep.wav", 8)) { // Serve the audio sample for the console bell. extern char beepStart[]; diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 6013cef..1884e8b 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -1693,7 +1693,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.9 (revision 149)" + + alert("VT100 Terminal Emulator " + "2.9 (revision 152)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); };