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
|
@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
|
||||||
|
|
|
@ -201,7 +201,7 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
netlog.info('', extra={
|
netlog.info('', extra={
|
||||||
'status': response.status,
|
'status': response.status,
|
||||||
'byte': len(response.body),
|
'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,
|
'request': '%s %s' % (self.request.method,
|
||||||
self.request.url)
|
self.request.url)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user