diff options
author | Seth M. Larson <sethmichaellarson@gmail.com> | 2018-11-01 10:47:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 10:47:55 -0500 |
commit | 3e47989b55d6be25ebe78de05114175ca67325e0 (patch) | |
tree | 646673930f4250dd07ec607ff1cf5edc202d2e06 | |
parent | 788cbea73e7e8c48528fb355d517f922c1b6f155 (diff) | |
parent | 0aeba3be0224a930f6ffef254ed12b41303a86d7 (diff) | |
download | urllib3-SethMichaelLarson-patch-1.tar.gz |
Merge branch 'master' into SethMichaelLarson-patch-1SethMichaelLarson-patch-1
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | src/urllib3/response.py | 8 |
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) |