diff --git a/libhttp/httpconnection.c b/libhttp/httpconnection.c index a19ac3f..521d610 100644 --- a/libhttp/httpconnection.c +++ b/libhttp/httpconnection.c @@ -568,7 +568,7 @@ void httpTransfer(struct HttpConnection *http, char *msg, int len) { // also has difficulties with SSL connections that are being proxied. int ieBug = 0; const char *userAgent = getFromHashMap(&http->header, "user-agent"); - const char *msie = userAgent ? strstr(userAgent, "MSIE ") : NULL; + const char *msie = userAgent ? strstr(userAgent, "Trident") : NULL; if (msie) { ieBug++; } diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c index 68d8862..69e29e6 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -1616,7 +1616,8 @@ static void launcherDaemon(int fd) { int status; pid_t pid; while (NOINTR(pid = waitpid(-1, &status, WNOHANG)) > 0) { - if (WIFEXITED(pid) || WIFSIGNALED(pid)) { + debug("Child %d exited with exit code %d\n", pid, WEXITSTATUS(status)); + if (WIFEXITED(status) || WIFSIGNALED(status)) { char key[32]; snprintf(&key[0], sizeof(key), "%d", pid); deleteFromHashMap(childProcesses, key); @@ -1636,7 +1637,8 @@ static void launcherDaemon(int fd) { break; } while (NOINTR(pid = waitpid(-1, &status, WNOHANG)) > 0) { - if (WIFEXITED(pid) || WIFSIGNALED(pid)) { + debug("Child %d exited with exit code %d\n", pid, WEXITSTATUS(status)); + if (WIFEXITED(status) || WIFSIGNALED(status)) { char key[32]; snprintf(&key[0], sizeof(key), "%d", pid); deleteFromHashMap(childProcesses, key); diff --git a/shellinabox/root_page.html b/shellinabox/root_page.html index 38bde27..41b6488 100644 --- a/shellinabox/root_page.html +++ b/shellinabox/root_page.html @@ -99,6 +99,16 @@ ''); } })(); + + // User warning on window close + window.onbeforeunload = function(e) { + if (typeof window.shellinabox.session != "undefined") { + return "Are you sure you want to leave this page?"; + } else { + return null; + } + } + --> @@ -107,7 +117,7 @@ correctly deal with the enclosing frameset (if any), if we do not do this --> - diff --git a/shellinabox/shell_in_a_box.jspp b/shellinabox/shell_in_a_box.jspp index 8fa2132..de7e5be 100644 --- a/shellinabox/shell_in_a_box.jspp +++ b/shellinabox/shell_in_a_box.jspp @@ -172,7 +172,6 @@ ShellInABox.prototype.sendRequest = function(request) { (this.session ? '&session=' + encodeURIComponent(this.session) : '&rooturl='+ encodeURIComponent(this.rooturl)); - request.setRequestHeader('Content-Length', content.length); request.onreadystatechange = function(shellInABox) { return function() { @@ -230,7 +229,6 @@ ShellInABox.prototype.sendKeys = function(keys) { '&height=' + this.terminalHeight + '&session=' +encodeURIComponent(this.session)+ '&keys=' + encodeURIComponent(keys); - request.setRequestHeader('Content-Length', content.length); request.onreadystatechange = function(shellInABox) { return function() { try { diff --git a/shellinabox/vt100.jspp b/shellinabox/vt100.jspp index 6ec0efa..dc97181 100755 --- a/shellinabox/vt100.jspp +++ b/shellinabox/vt100.jspp @@ -175,7 +175,7 @@ function VT100(container) { } this.getUserSettings(); this.initializeElements(container); - this.maxScrollbackLines = 500; + this.maxScrollbackLines = 2000; this.npar = 0; this.par = [ ]; this.isQuestionMark = false; @@ -1157,8 +1157,12 @@ VT100.prototype.resizer = function() { // still get confused if somebody enters a character that is wider/narrower // than normal. This can happen if the browser tries to substitute a // characters from a different font. - this.cursor.style.width = this.cursorWidth + 'px'; - this.cursor.style.height = this.cursorHeight + 'px'; + if (this.cursorWidth > 0) { + this.cursor.style.width = this.cursorWidth + 'px'; + } + if (this.cursorHeight > 0) { + this.cursor.style.height = this.cursorHeight + 'px'; + } // Adjust height for one pixel padding of the #vt100 element. // The latter is necessary to properly display the inactive cursor. @@ -1167,6 +1171,12 @@ VT100.prototype.resizer = function() { : (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight))-1; + + // Prevent ever growing consoles on iPad. + if (navigator.userAgent.match(/iPad/i) != null) { + height -= 1; + } + var partial = height % this.cursorHeight; this.scrollable.style.height = (height > 0 ? height : 0) + 'px'; this.padding.style.height = (partial > 0 ? partial : 0) + 'px'; @@ -1531,8 +1541,20 @@ VT100.prototype.insertBlankLine = function(y, color, style) { }; VT100.prototype.updateWidth = function() { - this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/ - this.cursorWidth*this.scale); + // if the cursorWidth is zero, something is wrong. Try to get it some other way. + if (this.cursorWidth <= 0) { + if (this.cursor.clientWidth <= 0) { + // Rats, this.cursor.clientWidth is zero too. Best guess? + this.terminalWidth = 80; + } else { + // update the size. + this.cursorWidth = this.cursor.clientWidth; + this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale); + } + } else { + this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale); + } + return this.terminalWidth; }; @@ -2713,6 +2735,8 @@ VT100.prototype.handleKey = function(event) { case 123: /* F12 */ ch = '\u001B[24~'; break; case 144: /* Num Lock */ return; case 145: /* Scroll Lock */ return; + case 163: /* # for FF15 */ ch = this.applyModifiers(35, event); break; + case 173: /* - for FF15 */ ch = this.applyModifiers(45, event); break; case 186: /* ; */ ch = this.applyModifiers(59, event); break; case 187: /* = */ ch = this.applyModifiers(61, event); break; case 188: /* , */ ch = this.applyModifiers(44, event); break; @@ -2857,6 +2881,9 @@ VT100.prototype.fixEvent = function(event) { case 109: /* - -> _ */ u = 45; s = 95; break; case 111: /* / -> ? */ u = 47; s = 63; break; + case 163: /* # -> ~ FF15 */ u = 96; s = 126; break; + case 173: /* - -> _ FF15 */ u = 45; s = 95; break; + case 186: /* ; -> : */ u = 59; s = 58; break; case 187: /* = -> + */ u = 61; s = 43; break; case 188: /* , -> < */ u = 44; s = 60; break;