From f8902a683752f8e6c7a3086f577a57c7d5eaa949 Mon Sep 17 00:00:00 2001 From: wong2 Date: Thu, 6 Nov 2014 14:48:16 +0800 Subject: [PATCH] propagate proxy_protocol_info to keep-alive requests correctly, fix #923 --- gunicorn/workers/async.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gunicorn/workers/async.py b/gunicorn/workers/async.py index feba3b08..479e6e87 100644 --- a/gunicorn/workers/async.py +++ b/gunicorn/workers/async.py @@ -38,14 +38,17 @@ class AsyncWorker(base.Worker): self.handle_request(listener_name, req, client, addr) else: # keepalive loop - proxy_protocol_info = req.proxy_protocol_info + proxy_protocol_info = {} while True: req = None with self.timeout_ctx(): req = six.next(parser) if not req: 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) except http.errors.NoMoreData as e: self.log.debug("Ignored premature client disconnection. %s", e)