Merge pull request #717 from jrocketfingers/fix/ipv6-access-log
Fix "TypeError: not all arguments converted during string formatting"
This commit is contained in:
commit
be93d670a3
|
@ -143,7 +143,8 @@ 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
|
||||
|
|
|
@ -201,7 +201,7 @@ class HttpProtocol(asyncio.Protocol):
|
|||
netlog.info('', extra={
|
||||
'status': response.status,
|
||||
'byte': len(response.body),
|
||||
'host': '%s:%d' % self.request.ip,
|
||||
'host': '%s:%d' % (self.request.ip[0], self.request.ip[1]),
|
||||
'request': '%s %s' % (self.request.method,
|
||||
self.request.url)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user