summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsiaoming Yang <me@lepture.com>2018-11-28 22:50:02 +0900
committerHsiaoming Yang <me@lepture.com>2018-11-28 22:50:02 +0900
commit7bcbbf632466ca3679e4cdea169cb130f06a01a9 (patch)
tree86a6677ae0d8725637924db2b8b694a869a3c488
parente5cb9bcff3911da6672521949345baaa5a6d8235 (diff)
downloadwerkzeug-issue-4.tar.gz
Remove limiter.issue-4
-rw-r--r--werkzeug/contrib/limiter.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/werkzeug/contrib/limiter.py b/werkzeug/contrib/limiter.py
deleted file mode 100644
index b15ec50a..00000000
--- a/werkzeug/contrib/limiter.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
- werkzeug.contrib.limiter
- ~~~~~~~~~~~~~~~~~~~~~~~~
-
- A middleware that limits incoming data. This works around problems with
- Trac_ or Django_ because those directly stream into the memory.
-
- .. _Trac: https://trac.edgewall.org/
- .. _Django: https://www.djangoproject.com/
-
- :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
- :license: BSD, see LICENSE for more details.
-"""
-import warnings
-from werkzeug.wsgi import LimitedStream
-from werkzeug.contrib import WerkzeugContribDeprecationWarning
-
-
-class StreamLimitMiddleware(object):
-
- """Limits the input stream to a given number of bytes. This is useful if
- you have a WSGI application that reads form data into memory (django for
- example) and you don't want users to harm the server by uploading tons of
- data.
-
- Default is 10MB
-
- .. versionchanged:: 0.9
- Deprecated middleware.
- """
-
- def __init__(self, app, maximum_size=1024 * 1024 * 10):
- warnings.warn(
- 'werkzeug.contrib.limiter is deprecated as of version 0.15 and'
- ' will be removed in version 1.0.',
- WerkzeugContribDeprecationWarning,
- stacklevel=3
- )
- self.app = app
- self.maximum_size = maximum_size
-
- def __call__(self, environ, start_response):
- limit = min(self.maximum_size, int(environ.get('CONTENT_LENGTH') or 0))
- environ['wsgi.input'] = LimitedStream(environ['wsgi.input'], limit)
- return self.app(environ, start_response)