Skip to content

Commit

Permalink
Merging new release version: 1.24.1
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Nov 2, 2018
2 parents ef0c745 + 0cedb3b commit a6ec68a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,14 @@
Changes
=======

1.24.1 (2018-11-02)
-------------------

* Remove quadratic behavior within ``GzipDecoder.decompress()`` (Issue #1467)

* Restored functionality of `ciphers` parameter for `create_urllib3_context()`. (Issue #1462)


1.24 (2018-10-16)
-----------------

Expand Down
3 changes: 3 additions & 0 deletions _travis/install.sh
Expand Up @@ -7,6 +7,9 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
sw_vers
brew update || brew update

# https://github.com/travis-ci/travis-ci/issues/8826
brew cask uninstall oclint

brew outdated openssl || brew upgrade openssl
brew install openssl@1.1

Expand Down
3 changes: 2 additions & 1 deletion dev-requirements.txt
Expand Up @@ -7,7 +7,8 @@ tornado==5.0.2
PySocks==1.6.8
pkginfo==1.4.2
pytest-timeout==1.3.1
pytest==3.6.4
pytest==3.8.2
# https://github.com/GoogleCloudPlatform/python-repo-tools/issues/23
pylint<2.0;python_version<="2.7"
gcp-devrel-py-tools==0.0.15
pluggy==0.8.0
2 changes: 1 addition & 1 deletion src/urllib3/__init__.py
Expand Up @@ -27,7 +27,7 @@

__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
__version__ = '1.24'
__version__ = '1.24.1'

__all__ = (
'HTTPConnectionPool',
Expand Down
8 changes: 4 additions & 4 deletions src/urllib3/response.py
Expand Up @@ -69,9 +69,9 @@ def __getattr__(self, name):
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)
Expand All @@ -81,11 +81,11 @@ def decompress(self, data):
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)

Expand Down
2 changes: 2 additions & 0 deletions src/urllib3/util/ssl_.py
Expand Up @@ -263,6 +263,8 @@ def create_urllib3_context(ssl_version=None, cert_reqs=None,
"""
context = SSLContext(ssl_version or ssl.PROTOCOL_SSLv23)

context.set_ciphers(ciphers or DEFAULT_CIPHERS)

# Setting the default here, as we may have no ssl module on import
cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs

Expand Down
18 changes: 18 additions & 0 deletions test/test_ssl.py
Expand Up @@ -70,3 +70,21 @@ def test_sni_missing_warning_with_ip_addresses(monkeypatch, has_sni, server_host
assert SNIMissingWarning in warnings
else:
assert warn.call_count == 0


@pytest.mark.parametrize(
["ciphers", "expected_ciphers"],
[(None, ssl_.DEFAULT_CIPHERS),
("ECDH+AESGCM:ECDH+CHACHA20", "ECDH+AESGCM:ECDH+CHACHA20")]
)
def test_create_urllib3_context_set_ciphers(monkeypatch, ciphers, expected_ciphers):

context = mock.create_autospec(ssl_.SSLContext)
context.set_ciphers = mock.Mock()
context.options = 0
monkeypatch.setattr(ssl_, "SSLContext", lambda *_, **__: context)

assert ssl_.create_urllib3_context(ciphers=ciphers) is context

assert context.set_ciphers.call_count == 1
assert context.set_ciphers.call_args == mock.call(expected_ciphers)

0 comments on commit a6ec68a

Please sign in to comment.