propagate proxy_protocol_info to keep-alive requests correctly, fix #923

This commit is contained in:
wong2 2014-11-06 14:48:16 +08:00
parent 4c601ce447
commit f8902a6837

View File

@ -38,14 +38,17 @@ class AsyncWorker(base.Worker):
self.handle_request(listener_name, req, client, addr) self.handle_request(listener_name, req, client, addr)
else: else:
# keepalive loop # keepalive loop
proxy_protocol_info = req.proxy_protocol_info proxy_protocol_info = {}
while True: while True:
req = None req = None
with self.timeout_ctx(): with self.timeout_ctx():
req = six.next(parser) req = six.next(parser)
if not req: if not req:
break break
req.proxy_protocol_info = proxy_protocol_info if req.proxy_protocol_info:
proxy_protocol_info = req.proxy_protocol_info
else:
req.proxy_protocol_info = proxy_protocol_info
self.handle_request(listener_name, req, client, addr) self.handle_request(listener_name, req, client, addr)
except http.errors.NoMoreData as e: except http.errors.NoMoreData as e:
self.log.debug("Ignored premature client disconnection. %s", e) self.log.debug("Ignored premature client disconnection. %s", e)