From b39788f88382cf3eb35626b3fccb047f14014373 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 13 Feb 2013 09:29:47 -0600 Subject: [PATCH] fixed issue 1331, unkown http_x_forwarded_for, thanks Tyrone --- VERSION | 2 +- gluon/main.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 3d407fd7..4a54ac51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.1-alpha.2+timestamp.2013.02.13.08.40.47 +Version 2.4.1-alpha.2+timestamp.2013.02.13.08.47.47 diff --git a/gluon/main.py b/gluon/main.py index 5d1c1081..5a9814ef 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -132,9 +132,8 @@ def get_client(env): if all fails, assume '127.0.0.1' or '::1' (running locally) """ g = regex_client.search(env.get('http_x_forwarded_for', '')) - if g: - client = (g.group() or '').split(',')[0] - else: + client = (g.group() or '').split(',')[0] if g else None + if client in (None, '', 'unkown'): g = regex_client.search(env.get('remote_addr', '')) if g: client = g.group()