From fd5c2e99fb6e7359309437f776898b0d69ca2a93 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 13 Jun 2014 13:22:18 +0200 Subject: [PATCH] fix #785: handle binary type address given to a client socket address --- gunicorn/http/wsgi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 303b890e..045c90c3 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -159,6 +159,8 @@ def create(req, sock, client, server, cfg): # http://www.ietf.org/rfc/rfc3875 if isinstance(client, string_types): environ['REMOTE_ADDR'] = client + elif isinstance(client, binary_type): + environ['REMOTE_ADDR'] = str(client) else: environ['REMOTE_ADDR'] = client[0] environ['REMOTE_PORT'] = str(client[1])