Fixed #3872, which turns out to not have been a bug in the first place, by reverting [6364].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6397 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2007-09-20 17:03:14 +00:00
parent 484189ff9c
commit 5ae6fafad7
1 changed files with 3 additions and 4 deletions

View File

@ -54,8 +54,7 @@ class SetRemoteAddrFromForwardedFor(object):
except KeyError:
return None
else:
# HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs.
# Take just the last one.
# See http://bob.pythonmac.org/archives/2005/09/23/apache-x-forwarded-for-caveat/
real_ip = real_ip.split(",")[-1].strip()
# HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs. The
# client's IP will be the first one.
real_ip = real_ip.split(",")[0].strip()
request.META['REMOTE_ADDR'] = real_ip