Merge pull request #1409 from tuky/patch-1

remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
This commit is contained in:
Xavier Ordoquy 2014-04-30 21:38:21 +02:00
commit 5333a93126

View File

@ -157,6 +157,8 @@ class AnonRateThrottle(SimpleRateThrottle):
ident = request.META.get('HTTP_X_FORWARDED_FOR') ident = request.META.get('HTTP_X_FORWARDED_FOR')
if ident is None: if ident is None:
ident = request.META.get('REMOTE_ADDR') ident = request.META.get('REMOTE_ADDR')
else:
ident = ''.join(ident.split())
return self.cache_format % { return self.cache_format % {
'scope': self.scope, 'scope': self.scope,