diff options
| -rw-r--r-- | README.md | 24 | ||||
| -rw-r--r-- | rest_framework/throttling.py | 10 | 
2 files changed, 14 insertions, 20 deletions
@@ -190,18 +190,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  [sandbox]: http://restframework.herokuapp.com/  [index]: http://www.django-rest-framework.org/ -[oauth1-section]: http://www.django-rest-framework.org/api-guide/authentication.html#oauthauthentication -[oauth2-section]: http://www.django-rest-framework.org/api-guide/authentication.html#oauth2authentication -[serializer-section]: http://www.django-rest-framework.org/api-guide/serializers.html#serializers -[modelserializer-section]: http://www.django-rest-framework.org/api-guide/serializers.html#modelserializer -[functionview-section]: http://www.django-rest-framework.org/api-guide/views.html#function-based-views -[generic-views]: http://www.django-rest-framework.org/api-guide/generic-views.html -[viewsets]: http://www.django-rest-framework.org/api-guide/viewsets.html -[routers]: http://www.django-rest-framework.org/api-guide/routers.html -[serializers]: http://www.django-rest-framework.org/api-guide/serializers.html -[authentication]: http://www.django-rest-framework.org/api-guide/authentication.html - -[rest-framework-2-announcement]: http://www.django-rest-framework.org/topics/rest-framework-2-announcement.html +[oauth1-section]: http://www.django-rest-framework.org/api-guide/authentication/#oauthauthentication +[oauth2-section]: http://www.django-rest-framework.org/api-guide/authentication/#oauth2authentication +[serializer-section]: http://www.django-rest-framework.org/api-guide/serializers/#serializers +[modelserializer-section]: http://www.django-rest-framework.org/api-guide/serializers/#modelserializer +[functionview-section]: http://www.django-rest-framework.org/api-guide/views/#function-based-views +[generic-views]: http://www.django-rest-framework.org/api-guide/generic-views/ +[viewsets]: http://www.django-rest-framework.org/api-guide/viewsets/ +[routers]: http://www.django-rest-framework.org/api-guide/routers/ +[serializers]: http://www.django-rest-framework.org/api-guide/serializers/ +[authentication]: http://www.django-rest-framework.org/api-guide/authentication/ + +[rest-framework-2-announcement]: http://www.django-rest-framework.org/topics/rest-framework-2-announcement  [2.1.0-notes]: https://groups.google.com/d/topic/django-rest-framework/Vv2M0CMY9bg/discussion  [image]: http://www.django-rest-framework.org/img/quickstart.png diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index 361dbddf..0f10136d 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -32,10 +32,10 @@ class BaseThrottle(object):              if num_proxies == 0 or xff is None:                  return remote_addr              addrs = xff.split(',') -            client_addr = addrs[-min(num_proxies, len(xff))] +            client_addr = addrs[-min(num_proxies, len(addrs))]              return client_addr.strip() -        return xff if xff else remote_addr +        return ''.join(xff.split()) if xff else remote_addr      def wait(self):          """ @@ -173,12 +173,6 @@ class AnonRateThrottle(SimpleRateThrottle):          if request.user.is_authenticated():              return None  # Only throttle unauthenticated requests. -        ident = request.META.get('HTTP_X_FORWARDED_FOR') -        if ident is None: -            ident = request.META.get('REMOTE_ADDR') -        else: -            ident = ''.join(ident.split()) -          return self.cache_format % {              'scope': self.scope,              'ident': self.get_ident(request)  | 
