commit 24de6477389d7cab87334a79e466b4c0f8fef59a
parent f157be5b6c443e0e651f2e6a6b0577a552b3ad17
Author: Sheng <webmaster0115@gmail.com>
Date: Wed, 11 Apr 2018 20:25:54 +0800
Renamed get_client_addr to get_real_client_addr
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/handler.py b/handler.py
@@ -21,7 +21,7 @@ DELAY = 3
class MixinHandler(object):
- def get_client_addr(self):
+ def get_real_client_addr(self):
ip = self.request.headers.get('X-Real-Ip')
port = self.request.headers.get('X-Real-Port')
addr = None
@@ -103,8 +103,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
return args
def get_client_addr(self):
- return super(IndexHandler, self).get_client_addr() or self.request.\
- connection.stream.socket.getpeername()
+ return self.get_real_client_addr() or self.request.connection.stream.\
+ socket.getpeername()
def ssh_connect(self):
ssh = paramiko.SSHClient()
@@ -173,8 +173,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
self.worker_ref = None
def get_client_addr(self):
- return super(WsockHandler, self).get_client_addr() or self.stream.\
- socket.getpeername()
+ return self.get_real_client_addr() or self.stream.socket.getpeername()
def open(self):
self.src_addr = self.get_client_addr()