mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
memcached cannot handle spaces in keys
This commit is contained in:
parent
e56ba33d1b
commit
d18d32669a
|
@ -155,6 +155,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 = u''.join(ident.split())
|
||||||
|
|
||||||
return self.cache_format % {
|
return self.cache_format % {
|
||||||
'scope': self.scope,
|
'scope': self.scope,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user