commit 9aebb6e4e30b92bfbaf2111e50f5b849c222bb5c
parent daa24021672da804d45499837adf8dc743e68e49
Author: Sheng <webmaster0115@gmail.com>
Date: Sat, 13 Oct 2018 08:52:32 +0800
Updated write_error
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/webssh/handler.py b/webssh/handler.py
@@ -78,14 +78,14 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
if not swallow_http_errors:
super(MixinHandler, self).write_error(status_code, **kwargs)
else:
- if status_code == 500:
- self._reason = 'Internal Server Error'
- else:
- exc_info = kwargs.get('exc_info')
- if exc_info:
- self._reason = exc_info[1].log_message
+ exc_info = kwargs.get('exc_info')
+ if exc_info:
+ reason = getattr(exc_info[1], 'log_message', None)
+ if reason:
+ self._reason = reason
self.result.update(status=self._reason)
self.set_status(200)
+ self.set_header('Server', 'TornadoServer')
self.finish(self.result)
def get_ssh_client(self):
diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js
@@ -189,7 +189,7 @@ jQuery(function($){
}
var msg = resp.responseJSON;
- if (msg.status) {
+ if (!msg.id) {
log_status(msg.status);
state = DISCONNECTED;
return;