Skip to content

Commit a6ec68a

Browse files
committed
Merging new release version: 1.24.1
2 parents ef0c745 + 0cedb3b commit a6ec68a

7 files changed

Lines changed: 38 additions & 6 deletions

File tree

‎CHANGES.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changes
22
=======
33

4+
1.24.1 (2018-11-02)
5+
-------------------
6+
7+
* Remove quadratic behavior within ``GzipDecoder.decompress()`` (Issue #1467)
8+
9+
* Restored functionality of `ciphers` parameter for `create_urllib3_context()`. (Issue #1462)
10+
11+
412
1.24 (2018-10-16)
513
-----------------
614

‎_travis/install.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
77
sw_vers
88
brew update || brew update
99

10+
# https://github.com/travis-ci/travis-ci/issues/8826
11+
brew cask uninstall oclint
12+
1013
brew outdated openssl || brew upgrade openssl
1114
brew install openssl@1.1
1215

‎dev-requirements.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ tornado==5.0.2
77
PySocks==1.6.8
88
pkginfo==1.4.2
99
pytest-timeout==1.3.1
10-
pytest==3.6.4
10+
pytest==3.8.2
1111
# https://github.com/GoogleCloudPlatform/python-repo-tools/issues/23
1212
pylint<2.0;python_version<="2.7"
1313
gcp-devrel-py-tools==0.0.15
14+
pluggy==0.8.0

‎src/urllib3/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
2929
__license__ = 'MIT'
30-
__version__ = '1.24'
30+
__version__ = '1.24.1'
3131

3232
__all__ = (
3333
'HTTPConnectionPool',

‎src/urllib3/response.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def __getattr__(self, name):
6969
return getattr(self._obj, name)
7070

7171
def decompress(self, data):
72-
ret = b''
72+
ret = bytearray()
7373
if self._state == GzipDecoderState.SWALLOW_DATA or not data:
74-
return ret
74+
return bytes(ret)
7575
while True:
7676
try:
7777
ret += self._obj.decompress(data)
@@ -81,11 +81,11 @@ def decompress(self, data):
8181
self._state = GzipDecoderState.SWALLOW_DATA
8282
if previous_state == GzipDecoderState.OTHER_MEMBERS:
8383
# Allow trailing garbage acceptable in other gzip clients
84-
return ret
84+
return bytes(ret)
8585
raise
8686
data = self._obj.unused_data
8787
if not data:
88-
return ret
88+
return bytes(ret)
8989
self._state = GzipDecoderState.OTHER_MEMBERS
9090
self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS)
9191

‎src/urllib3/util/ssl_.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ def create_urllib3_context(ssl_version=None, cert_reqs=None,
263263
"""
264264
context = SSLContext(ssl_version or ssl.PROTOCOL_SSLv23)
265265

266+
context.set_ciphers(ciphers or DEFAULT_CIPHERS)
267+
266268
# Setting the default here, as we may have no ssl module on import
267269
cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs
268270

‎test/test_ssl.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,21 @@ def test_sni_missing_warning_with_ip_addresses(monkeypatch, has_sni, server_host
7070
assert SNIMissingWarning in warnings
7171
else:
7272
assert warn.call_count == 0
73+
74+
75+
@pytest.mark.parametrize(
76+
["ciphers", "expected_ciphers"],
77+
[(None, ssl_.DEFAULT_CIPHERS),
78+
("ECDH+AESGCM:ECDH+CHACHA20", "ECDH+AESGCM:ECDH+CHACHA20")]
79+
)
80+
def test_create_urllib3_context_set_ciphers(monkeypatch, ciphers, expected_ciphers):
81+
82+
context = mock.create_autospec(ssl_.SSLContext)
83+
context.set_ciphers = mock.Mock()
84+
context.options = 0
85+
monkeypatch.setattr(ssl_, "SSLContext", lambda *_, **__: context)
86+
87+
assert ssl_.create_urllib3_context(ciphers=ciphers) is context
88+
89+
assert context.set_ciphers.call_count == 1
90+
assert context.set_ciphers.call_args == mock.call(expected_ciphers)

0 commit comments

Comments
 (0)