Updated test_app.py

This commit is contained in:
Sheng
2018-11-15 20:23:42 +08:00
parent 646621279b
commit 32f303474e
4 changed files with 50 additions and 7 deletions
+3 -3
View File
@@ -158,9 +158,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
self.result = dict(id=None, status=None, encoding=None)
def write_error(self, status_code, **kwargs):
if self.request.method != 'POST' or not swallow_http_errors:
super(IndexHandler, self).write_error(status_code, **kwargs)
else:
if swallow_http_errors and self.request.method == 'POST':
exc_info = kwargs.get('exc_info')
if exc_info:
reason = getattr(exc_info[1], 'log_message', None)
@@ -169,6 +167,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
self.result.update(status=self._reason)
self.set_status(200)
self.finish(self.result)
else:
super(IndexHandler, self).write_error(status_code, **kwargs)
def get_ssh_client(self):
ssh = paramiko.SSHClient()
+2 -1
View File
@@ -33,6 +33,7 @@ define('redirect', type=bool, default=True, help='Redirecting http to https')
define('fbidhttp', type=bool, default=True,
help='Forbid public plain http incoming requests')
define('xheaders', type=bool, default=True, help='Support xheaders')
define('xsrf', type=bool, default=True, help='CSRF protection')
define('wpintvl', type=int, default=0, help='Websocket ping interval')
define('version', type=bool, help='Show version information',
callback=print_version)
@@ -48,7 +49,7 @@ def get_app_settings(options):
static_path=os.path.join(base_dir, 'webssh', 'static'),
websocket_ping_interval=options.wpintvl,
debug=options.debug,
xsrf_cookies=True
xsrf_cookies=options.xsrf
)
return settings