Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: urllib3/urllib3
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.25
Choose a base ref
...
head repository: urllib3/urllib3
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.25.1
Choose a head ref
  • 7 commits
  • 8 files changed
  • 2 contributors

Commits on Apr 22, 2019

  1. Copy the full SHA
    0144514 View commit details
  2. Copy the full SHA
    ecb1c7a View commit details

Commits on Apr 23, 2019

  1. Copy the full SHA
    1e46888 View commit details
  2. Copy the full SHA
    d7ece60 View commit details

Commits on Apr 24, 2019

  1. Copy the full SHA
    ff8f721 View commit details
  2. Copy the full SHA
    64e413f View commit details
  3. Release 1.25.1 (#1581)

    sethmlarson authored Apr 24, 2019
    Copy the full SHA
    85e7798 View commit details
Showing with 65 additions and 53 deletions.
  1. +17 −38 .travis.yml
  2. +8 −0 CHANGES.rst
  3. +5 −3 _travis/upload_coverage.sh
  4. +1 −1 src/urllib3/__init__.py
  5. +1 −1 src/urllib3/packages/rfc3986/__init__.py
  6. +8 −4 src/urllib3/packages/rfc3986/iri.py
  7. +12 −5 src/urllib3/response.py
  8. +13 −1 tox.ini
55 changes: 17 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: python
sudo: false
stage: test
dist: xenial

before_install:
- env
@@ -42,6 +43,8 @@ matrix:
env: TOXENV=py27
- python: 2.7
env: TOXENV=py27-nobrotli
- python: 2.7
env: TOXENV=py27-google-brotli
- python: 3.4
env: TOXENV=py34
- python: 3.5
@@ -50,16 +53,12 @@ matrix:
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
dist: xenial
sudo: required
- python: 3.7
env: TOXENV=py37-nobrotli
dist: xenial
sudo: required
- python: 3.7
env: TOXENV=py37-google-brotli
- python: 3.8-dev
env: TOXENV=py38
dist: xenial
sudo: required

- python: pypy-5.4
env: TOXENV=pypy
@@ -89,8 +88,6 @@ matrix:

- python: 3.7
env: DOWNSTREAM=requests
dist: xenial
sudo: required
stage: integration

- python: 2.7
@@ -99,42 +96,24 @@ matrix:

- python: 3.7
env: DOWNSTREAM=botocore
dist: xenial
sudo: required
stage: integration

- python: 3.7
stage: deploy
script:
- ./_travis/deploy.sh

allow_failures:
- python: pypy-5.4

stages:
- test
- name: test
if: tag IS blank

# Run integration tests for release candidates
- name: integration
if: type = pull_request AND head_branch =~ ^release-[\d.]+$

deploy:
- provider: script
script: bash _travis/deploy.sh
skip_cleanup: true
on:
branch: master
repo: urllib3/urllib3
tags: true
python: 3.7

- provider: releases
api_key:
secure: ... # GitHub access token
name: "$TRAVIS_TAG"
body: "Release $TRAVIS_TAG"
draft: true
skip_cleanup: true
file_glob: true
file: dist/*
overwrite: true
on:
branch: master
repo: urllib3/urllib3
tags: true
python: 3.7
if: type = pull_request AND head_branch =~ ^release-[\d.]+$ AND tag IS blank

# Deploy on any tags
- name: deploy
if: branch = master AND tag IS present
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changes
=======

1.25.1 (2019-04-24)
-------------------

* Add support for Google's ``Brotli`` package. (Pull #1572, Pull #1579)

* Upgrade bundled rfc3986 to v1.3.1 (Pull #1578)


1.25 (2019-04-22)
-----------------

8 changes: 5 additions & 3 deletions _travis/upload_coverage.sh
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

set -exo pipefail

source .tox/${TOXENV}/bin/activate
pip install codecov
codecov --env TRAVIS_OS_NAME,TOXENV
if [[ -e .coverage ]]; then
source .tox/${TOXENV}/bin/activate
pip install codecov
codecov --env TRAVIS_OS_NAME,TOXENV
fi
2 changes: 1 addition & 1 deletion src/urllib3/__init__.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@

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

__all__ = (
'HTTPConnectionPool',
2 changes: 1 addition & 1 deletion src/urllib3/packages/rfc3986/__init__.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
__author_email__ = 'graffatcolmingov@gmail.com'
__license__ = 'Apache v2.0'
__copyright__ = 'Copyright 2014 Rackspace'
__version__ = '1.3.0'
__version__ = '1.3.1'

__all__ = (
'ParseResult',
12 changes: 8 additions & 4 deletions src/urllib3/packages/rfc3986/iri.py
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ def from_string(cls, iri_string, encoding='utf-8'):
encoding,
)

def encode(self, idna_encoder=None):
def encode(self, idna_encoder=None): # noqa: C901
"""Encode an IRIReference into a URIReference instance.
If the ``idna`` module is installed or the ``rfc3986[idna]``
@@ -116,12 +116,16 @@ def encode(self, idna_encoder=None):
"Could not import the 'idna' module "
"and the IRI hostname requires encoding"
)
else:
def idna_encoder(x):

def idna_encoder(name):
if any(ord(c) > 128 for c in name):
try:
return idna.encode(x, strict=True, std3_rules=True).lower()
return idna.encode(name.lower(),
strict=True,
std3_rules=True)
except idna.IDNAError:
raise exceptions.InvalidAuthority(self.authority)
return name

authority = ""
if self.host:
17 changes: 12 additions & 5 deletions src/urllib3/response.py
Original file line number Diff line number Diff line change
@@ -97,14 +97,21 @@ def decompress(self, data):

if brotli is not None:
class BrotliDecoder(object):
# Supports both 'brotlipy' and 'Brotli' packages
# since they share an import name. The top branches
# are for 'brotlipy' and bottom branches for 'Brotli'
def __init__(self):
self._obj = brotli.Decompressor()

def __getattr__(self, name):
return getattr(self._obj, name)

def decompress(self, data):
return self._obj.decompress(data)
if hasattr(self._obj, 'decompress'):
return self._obj.decompress(data)
return self._obj.process(data)

def flush(self):
if hasattr(self._obj, 'flush'):
return self._obj.flush()
return b''


class MultiDecoder(object):
@@ -341,7 +348,7 @@ def _init_decoder(self):

DECODER_ERROR_CLASSES = (IOError, zlib.error)
if brotli is not None:
DECODER_ERROR_CLASSES += (brotli.Error,)
DECODER_ERROR_CLASSES += (brotli.error,)

def _decode(self, data, decode_content, flush_decoder):
"""
14 changes: 13 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = flake8-py3, py27, py34, py35, py36, py37, py38, pypy, py{27,37}-nobrotli
envlist = flake8-py3, py27, py34, py35, py36, py37, py38, pypy, py{27,37}-nobrotli, py{27,37}-google-brotli

[testenv]
deps= -r{toxinidir}/dev-requirements.txt
@@ -21,6 +21,18 @@ setenv =
PYTHONWARNINGS=always::DeprecationWarning
passenv = CFLAGS LDFLAGS TRAVIS APPVEYOR CRYPTOGRAPHY_OSX_NO_LINK_FLAGS TRAVIS_INFRA

[testenv:py37-google-brotli]
extras = socks,secure
deps =
{[testenv]deps}
Brotli

[testenv:py27-google-brotli]
extras = socks,secure
deps =
{[testenv]deps}
Brotli

[testenv:py27-nobrotli]
extras = socks,secure