aboutsummaryrefslogtreecommitdiff
path: root/dummyserver
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:32 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:32 -0700
commite5b66555b54a9854b340975471e8cdfa64e311f7 (patch)
tree21c6529cbca37472e7d77b1b55014a9f6f27687b /dummyserver
parent77245469d4fbd400c6702cde35f9d9002540663e (diff)
downloadpython-urllib3-e5b66555b54a9854b340975471e8cdfa64e311f7.tar
python-urllib3-e5b66555b54a9854b340975471e8cdfa64e311f7.tar.gz
Imported Upstream version 1.5
Diffstat (limited to 'dummyserver')
-rw-r--r--dummyserver/handlers.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/dummyserver/handlers.py b/dummyserver/handlers.py
index 3e32881..ca809ad 100644
--- a/dummyserver/handlers.py
+++ b/dummyserver/handlers.py
@@ -145,14 +145,20 @@ class TestingApp(WSGIHandler):
data = b"hello, world!"
encoding = request.headers.get('Accept-Encoding', '')
headers = None
- if 'gzip' in encoding:
+ if encoding == 'gzip':
headers = [('Content-Encoding', 'gzip')]
file_ = BytesIO()
gzip.GzipFile('', mode='w', fileobj=file_).write(data)
data = file_.getvalue()
- elif 'deflate' in encoding:
+ elif encoding == 'deflate':
headers = [('Content-Encoding', 'deflate')]
data = zlib.compress(data)
+ elif encoding == 'garbage-gzip':
+ headers = [('Content-Encoding', 'gzip')]
+ data = 'garbage'
+ elif encoding == 'garbage-deflate':
+ headers = [('Content-Encoding', 'deflate')]
+ data = 'garbage'
return Response(data, headers=headers)
def shutdown(self, request):