From b44c707e94d567994d3bad541a46333e90fa7ed8 Mon Sep 17 00:00:00 2001 From: Johnny Rocketfingers Date: Sun, 14 May 2017 09:56:56 +0200 Subject: [PATCH] Prevent incorrect tuple size on get_extra_info errors According to https://docs.python.org/3/library/asyncio-protocol.html#asyncio.BaseTransport.get_extra_info, get_extra_info fails by returning None. This is an attempt in normalization of the response in cases of AF_INET, AF_INET6 and erroneous return values. --- sanic/request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanic/request.py b/sanic/request.py index 57b4773c..45a38c41 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -143,7 +143,7 @@ class Request(dict): @property def ip(self): if not hasattr(self, '_ip'): - self._ip = self.transport.get_extra_info('peername') + self._ip = self.transport.get_extra_info('peername') or (None, None) return self._ip @property