From bbdc0eb818eb26d5da0ec2ae6cf724332550e9a9 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 27 Dec 2018 17:58:29 +0100 Subject: fix ContentLengthMiddleware(..., maxstore=()) on Py3k On Python 2.x, any integer sorts below the empty tuple. That was exploited in the maxstore parameter, but fails on Python 3 with a TypeError. Also add a regression test. Reported-by: Dominik Brodowski --- wsgitools/middlewares.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wsgitools') diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py index b37b130..97b8092 100644 --- a/wsgitools/middlewares.py +++ b/wsgitools/middlewares.py @@ -137,6 +137,8 @@ class ContentLengthMiddleware(object): wsgi standard """ self.app = app + if maxstore == (): + maxstore = float("inf") self.maxstore = maxstore def __call__(self, environ, start_response): """wsgi interface""" -- cgit v1.2.3