From 43dfb8f0f7c0f3b11b8ac082a067d03230028753 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 25 Feb 2011 08:23:56 +0100 Subject: [PATCH] fix issue #165. Sometimes apache don't specify the port ipv6 address are in the form of aaaa:aaaa:... . Thanks to zauberpony for first implementation of the patch. --- gunicorn/http/wsgi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index af83509d..752d3304 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -81,13 +81,13 @@ def create(req, sock, client, server, cfg): # find host and port on ipv6 address if '[' in forward and ']' in forward: host = forward.split(']')[0][1:].lower() - elif ":" in forward: + elif ":" in forward and forward.count(":") == 1: host = forward.split(":")[0].lower() else: host = forward forward = forward.split(']')[-1] - if ":" in forward: + if ":" in forward and forward.count(":") == 1: port = forward.split(':', 1)[1] else: port = 80