From 4f9b5e202908640b68cc42a5a262078639f8a403 Mon Sep 17 00:00:00 2001 From: Sheng Date: Thu, 19 Sep 2019 09:29:24 +0800 Subject: [PATCH] Added get_context_addr method --- webssh/handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webssh/handler.py b/webssh/handler.py index 51935d3..7eade72 100644 --- a/webssh/handler.py +++ b/webssh/handler.py @@ -255,11 +255,14 @@ class MixinHandler(object): raise InvalidValueError('Missing value {}'.format(name)) return value + def get_context_addr(self): + return self.context.address[:2] + def get_client_addr(self): if options.xheaders: - return self.get_real_client_addr() or self.context.address[:2] + return self.get_real_client_addr() or self.get_context_addr() else: - return self.context.address[:2] + return self.get_context_addr() def get_real_client_addr(self): ip = self.request.remote_ip