Merge pull request #147 from webtic/master
Add the client address to the request header
This commit is contained in:
commit
b51af7f4bf
|
@ -114,6 +114,10 @@ class HttpProtocol(asyncio.Protocol):
|
|||
self.headers.append((name.decode(), value.decode('utf-8')))
|
||||
|
||||
def on_headers_complete(self):
|
||||
remote_addr = self.transport.get_extra_info('peername')
|
||||
if remote_addr:
|
||||
self.headers.append(('Remote-Addr', '%s:%s' % remote_addr))
|
||||
|
||||
self.request = Request(
|
||||
url_bytes=self.url,
|
||||
headers=dict(self.headers),
|
||||
|
|
Loading…
Reference in New Issue
Block a user