webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit deef92fe6656181fd600501cc842683454efd38f
parent e66e5f204588bbd65d29fe436d1fa9c9e6f0de78
Author: Sheng <webmaster0115@gmail.com>
Date:   Sat, 13 Oct 2018 22:16:16 +0800

Move get_client_addr to MixinHandler

Diffstat:
Mwebssh/handler.py | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/webssh/handler.py b/webssh/handler.py @@ -48,6 +48,10 @@ class MixinHandler(object): raise InvalidValueError('Missing value {}'.format(name)) return value + def get_client_addr(self): + return self.get_real_client_addr() or self.request.connection.context.\ + address + def get_real_client_addr(self): ip = self.request.remote_ip @@ -194,10 +198,6 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): logging.debug(args) return args - def get_client_addr(self): - return self.get_real_client_addr() or self.request.connection.stream.\ - socket.getpeername() - def get_default_encoding(self, ssh): try: _, stdout, _ = ssh.exec_command('locale charmap') @@ -277,9 +277,6 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler): self.loop = loop self.worker_ref = None - def get_client_addr(self): - return self.get_real_client_addr() or self.stream.socket.getpeername() - def open(self): self.src_addr = self.get_client_addr() logging.info('Connected from {}:{}'.format(*self.src_addr))