aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/throttling.py
diff options
context:
space:
mode:
authortuky2014-02-12 18:11:18 +0100
committertuky2014-02-12 18:11:18 +0100
commitd18d32669ac47178f26409f149160dc2c0c5359c (patch)
tree4a2eb3ad75ef41715a31d2c52d04b15906762e8d /rest_framework/throttling.py
parente56ba33d1b855fea9699afcd932318b9b6edb465 (diff)
downloaddjango-rest-framework-d18d32669ac47178f26409f149160dc2c0c5359c.tar.bz2
remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
memcached cannot handle spaces in keys
Diffstat (limited to 'rest_framework/throttling.py')
-rw-r--r--rest_framework/throttling.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py
index a946d837..56023bda 100644
--- a/rest_framework/throttling.py
+++ b/rest_framework/throttling.py
@@ -155,6 +155,8 @@ class AnonRateThrottle(SimpleRateThrottle):
ident = request.META.get('HTTP_X_FORWARDED_FOR')
if ident is None:
ident = request.META.get('REMOTE_ADDR')
+ else:
+ ident = u''.join(ident.split())
return self.cache_format % {
'scope': self.scope,