Commit 24de6477 by Sheng

Renamed get_client_addr to get_real_client_addr

parent f157be5b
...@@ -21,7 +21,7 @@ DELAY = 3 ...@@ -21,7 +21,7 @@ DELAY = 3
class MixinHandler(object): class MixinHandler(object):
def get_client_addr(self): def get_real_client_addr(self):
ip = self.request.headers.get('X-Real-Ip') ip = self.request.headers.get('X-Real-Ip')
port = self.request.headers.get('X-Real-Port') port = self.request.headers.get('X-Real-Port')
addr = None addr = None
...@@ -103,8 +103,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): ...@@ -103,8 +103,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
return args return args
def get_client_addr(self): def get_client_addr(self):
return super(IndexHandler, self).get_client_addr() or self.request.\ return self.get_real_client_addr() or self.request.connection.stream.\
connection.stream.socket.getpeername() socket.getpeername()
def ssh_connect(self): def ssh_connect(self):
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
...@@ -173,8 +173,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler): ...@@ -173,8 +173,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
self.worker_ref = None self.worker_ref = None
def get_client_addr(self): def get_client_addr(self):
return super(WsockHandler, self).get_client_addr() or self.stream.\ return self.get_real_client_addr() or self.stream.socket.getpeername()
socket.getpeername()
def open(self): def open(self):
self.src_addr = self.get_client_addr() self.src_addr = self.get_client_addr()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment