summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.rst2
-rw-r--r--src/urllib3/response.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 1461154f..186099d3 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,8 @@ Changes
dev (master)
------------
+* Remove quadratic behavior within ``GzipDecoder.decompress()`` (Issue #1467)
+
* Restored functionality of `ciphers` parameter for `create_urllib3_context()`. (Issue #1462)
* ... [Short description of non-trivial change.] (Issue #)
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index f0cfbb54..c112690b 100644
--- a/src/urllib3/response.py
+++ b/src/urllib3/response.py
@@ -69,9 +69,9 @@ class GzipDecoder(object):
return getattr(self._obj, name)
def decompress(self, data):
- ret = b''
+ ret = bytearray()
if self._state == GzipDecoderState.SWALLOW_DATA or not data:
- return ret
+ return bytes(ret)
while True:
try:
ret += self._obj.decompress(data)
@@ -81,11 +81,11 @@ class GzipDecoder(object):
self._state = GzipDecoderState.SWALLOW_DATA
if previous_state == GzipDecoderState.OTHER_MEMBERS:
# Allow trailing garbage acceptable in other gzip clients
- return ret
+ return bytes(ret)
raise
data = self._obj.unused_data
if not data:
- return ret
+ return bytes(ret)
self._state = GzipDecoderState.OTHER_MEMBERS
self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS)