fixed issue 1331, unkown http_x_forwarded_for, thanks Tyrone

This commit is contained in:
mdipierro
2013-02-13 09:29:47 -06:00
parent ae803727e9
commit b39788f883
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -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
+2 -3
View File
@@ -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()