summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth M. Larson <sethmichaellarson@gmail.com>2018-11-01 10:47:55 -0500
committerGitHub <noreply@github.com>2018-11-01 10:47:55 -0500
commit3e47989b55d6be25ebe78de05114175ca67325e0 (patch)
tree646673930f4250dd07ec607ff1cf5edc202d2e06
parent788cbea73e7e8c48528fb355d517f922c1b6f155 (diff)
parent0aeba3be0224a930f6ffef254ed12b41303a86d7 (diff)
downloadurllib3-SethMichaelLarson-patch-1.tar.gz
Merge branch 'master' into SethMichaelLarson-patch-1SethMichaelLarson-patch-1
-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)