Add the client address to the request header
This commit is contained in:
parent
5efe51b661
commit
be5588d5d8
|
@ -114,6 +114,11 @@ class HttpProtocol(asyncio.Protocol):
|
|||
self.headers.append((name.decode(), value.decode('utf-8')))
|
||||
|
||||
def on_headers_complete(self):
|
||||
|
||||
ra = self.transport.get_extra_info('peername')
|
||||
if ra:
|
||||
self.headers.append(('Remote-Addr','%s:%s' % ra))
|
||||
|
||||
self.request = Request(
|
||||
url_bytes=self.url,
|
||||
headers=dict(self.headers),
|
||||
|
|
Loading…
Reference in New Issue
Block a user