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.
This commit is contained in:
Johnny Rocketfingers 2017-05-14 09:56:56 +02:00
parent 4c7675939a
commit b44c707e94

View File

@ -143,7 +143,7 @@ class Request(dict):
@property @property
def ip(self): def ip(self):
if not hasattr(self, '_ip'): 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 return self._ip
@property @property