diff options
author | Haibo Huang <hhb@google.com> | 2020-04-16 00:18:02 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-04-16 00:18:02 +0000 |
commit | 4380a0579bed3da34371aa3b7e718aac1ddf3d90 (patch) | |
tree | fb83f12de54961dc0ee4671aa54bdb882f79ee7d | |
parent | d237fc462943e578ec593df63bdb01a99b04a0d4 (diff) | |
parent | a465f359884d1fe1f2db6f1e6e91565ec6f9705d (diff) | |
download | httplib2-4380a0579bed3da34371aa3b7e718aac1ddf3d90.tar.gz |
Upgrade python/httplib2 to v0.17.2 am: 949c3cfcea am: 85565e5f13 am: 04c5d9c2ec am: a465f35988
Change-Id: I59a7fa5d02b44f90ca59477c7f687df89ac3e8d0
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | CHANGELOG | 11 | ||||
-rw-r--r-- | METADATA | 6 | ||||
-rw-r--r-- | python2/httplib2/__init__.py | 2 | ||||
-rw-r--r-- | python3/httplib2/__init__.py | 6 | ||||
-rw-r--r-- | script/compile-py3-openssl11.sh | 6 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | tests/test_proxy.py | 64 |
8 files changed, 74 insertions, 30 deletions
diff --git a/.travis.yml b/.travis.yml index ca91b60..395c507 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,6 @@ python: - 3.5 - 3.6 - 3.7 -matrix: - fast_finish: true install: pip install $pip_install_common 'codecov>=2.0.15' -r requirements-test.txt script: script/test -sv && codecov @@ -25,6 +23,7 @@ stages: - test - release jobs: + fast_finish: true include: - stage: test python: pypy @@ -69,7 +68,7 @@ jobs: deploy: provider: pypi server: https://test.pypi.org/legacy/ - user: httplib2.release.test + username: httplib2.release.test password: secure: "XN3oxobC+26UPiS+F1MvL4c6XtytejZ13SkLXCHfgVDPSASzKqF81CnR4EhsnbfZLvSgGHgSlfY5Jve5HF2VR9GzpJMc6wzcfkkeBg6PeRHuMppIqmuoq7BTw81SZL9X62/mju/vxXs2cHpVkwNTSE7W1JH1bVXPj86oAR9xXo9waRuXcyPGNuSqmOd1NPOMbFmeuz+HeArk2Fz7wwo6H5BJuXjOrEOHWD1rzeRchH901PBUrftm54Id2TIVMARW8jm1saQY2FtPWaBv2v/DJC1fKWMJpcNQ3mmcvrrTFC1IJ00dk9XJfqx5hnsRaergc0UvzHoOGEQKSMdg0PUAkvNohAoCf+3GddPkvk8MaZ+aQlijoK6wp93A5dfTxBVZqdhmEdheolbYiJPunzS60bWvaEv6/D15/xyMiwGamUmF1Tx7UIvvm/zj6tAOBWbNEgLRyvQ0qx2RE95GLtp+RXK4pT+Kig1+cof5hrWODuEl1SSLMBySaNLWO73IN9esZu0X1JS7svnROLRJCAvRjppJYswwCPziP+B8XQDeMrhIDMHNzdbtxOPpBAXpYUE764FkzaUTMsK83Q+ugE3Dx8xtrAzT4M0fdiFv+3QEhSUtfvWsLH9zS9wXC5Px9kPKU3FO8mdUyf7A0bIasvJLNcApDJigKjBukToOIsZVFok=" distributions: "sdist bdist_wheel" @@ -84,7 +83,7 @@ jobs: script: script/release -auto deploy: provider: pypi - user: httplib2.release + username: httplib2.release password: secure: "jZAyMFnmbhYChjsb3gRYfESWlio6pgmWEWBRxtBQXYZf+tzyKVISyHuyWkJvOVTP+lOpp2MTPZ2s1UgxGwfzZ/VE034Cz5iA/C6wafmgtSW+wK+KEJFPseHBBA7Gh4ReiAPi2a+i1UXdsJpFNhv36E9tbTq2sEinbisE2lSEQ0KHadjkc+6pvCjlyhmes7QyM5GviWYlWRNj2OIkT8SUuUcWQt7ZEl6kN82MoMHCaf1YxE/i4JUP3VLomWK3RLZJP356Y4IDkzlVhFU4MJ4ubNtoQ/ECM0uQ+nsHzO0k1uGWdF6mMTna7U5gLqUi9rfCK3bLMeVSo+TUCpjI7HkWDaBgVXGTe5dUMJCDfRgqeYa0GnriI74XYJu8NGjMLv30uO58t9E7VQGo2NrFRJDzKAIHANejWnpUPY3XgoN1rlrh52seMjaU2+jO40EC8HvIqeRRwPwhkqCSV2y+IZT2bOFp2nbMWhkUMsxIX7OXt+sy8GvK/ilMleEl7r0tnudsT7lGdnMwXlttI3CIAFGE7E+0zwnxNiMzQDzo+ILVR7ezrCK9M9xVYKGa3i8gkpSn0Fblnltgg7HaEI8YC3rMZe4iu1t0D6cZZUAAp2ZUo3NCJcZ35iUFBhlFvjVDbe2upJgU6GFgtDLjyzCJiKbz8qLRgMFYgT0CGr512e1jBo0=" distributions: "sdist bdist_wheel" @@ -1,3 +1,14 @@ +0.17.2 + + python3 + debug + IPv6 disabled: https raised + "IndexError: Replacement index 1 out of range for positional args tuple" + https://github.com/httplib2/httplib2/issues/161 + +0.17.1 + + python3: no_proxy was not checked with https + https://github.com/httplib2/httplib2/issues/160 + 0.17.0 feature: Http().redirect_codes set, works after follow(_all)_redirects check @@ -9,10 +9,10 @@ third_party { type: GIT value: "https://github.com/httplib2/httplib2.git" } - version: "v0.17.0" + version: "v0.17.2" last_upgrade_date { year: 2020 - month: 2 - day: 1 + month: 4 + day: 13 } } diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index f32accf..9057d1f 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -19,7 +19,7 @@ __contributors__ = [ "Alex Yu", ] __license__ = "MIT" -__version__ = '0.17.0' +__version__ = '0.17.2' import base64 import calendar diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py index 6467c79..135c6f6 100644 --- a/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py @@ -15,7 +15,7 @@ __contributors__ = [ "Alex Yu", ] __license__ = "MIT" -__version__ = '0.17.0' +__version__ = '0.17.2' import base64 import calendar @@ -1284,7 +1284,7 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection): def connect(self): """Connect to a host on a given (SSL) port.""" - if self.proxy_info and self.proxy_info.isgood(): + if self.proxy_info and self.proxy_info.isgood() and self.proxy_info.applies_to(self.host): use_proxy = True proxy_type, proxy_host, proxy_port, proxy_rdns, proxy_user, proxy_pass, proxy_headers = ( self.proxy_info.astuple() @@ -1366,7 +1366,7 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection): except socket.error as e: socket_err = e if self.debuglevel > 0: - print("connect fail: ({0}, {1})".format((self.host, self.port))) + print("connect fail: ({0}, {1})".format(self.host, self.port)) if use_proxy: print( "proxy: {0}".format( diff --git a/script/compile-py3-openssl11.sh b/script/compile-py3-openssl11.sh index 3486043..59f5022 100644 --- a/script/compile-py3-openssl11.sh +++ b/script/compile-py3-openssl11.sh @@ -3,7 +3,7 @@ cache_dir=$HOME/.cache install_dir=$cache_dir/py3-openssl11 python_version="3.7.3" -openssl_version="1.1.1c" +openssl_version="1.1.1f" cpucount=$(nproc --all) export PYTHONDONTWRITEBYTECODE=1 @@ -14,7 +14,7 @@ if [[ $($install_dir/bin/python -V) != "Python $python_version" ]] ; then mkdir -p /tmp/source cd /tmp/source # Compile OpenSSL - wget --quiet https://www.openssl.org/source/openssl-$openssl_version.tar.gz + curl -fLOsS "https://www.openssl.org/source/openssl-$openssl_version.tar.gz" echo "Extracting OpenSSL..." tar xf openssl-$openssl_version.tar.gz cd ./openssl-$openssl_version @@ -29,7 +29,7 @@ if [[ $($install_dir/bin/python -V) != "Python $python_version" ]] ; then cd /tmp/source sudo apt install -qq --yes libffi-dev # Compile latest Python - wget --quiet https://www.python.org/ftp/python/$python_version/Python-$python_version.tar.xz + curl -fLOsS "https://www.python.org/ftp/python/$python_version/Python-$python_version.tar.xz" echo "Extracting Python..." tar xf Python-$python_version.tar.xz cd ./Python-$python_version @@ -4,7 +4,7 @@ import setuptools.command.test import sys pkgdir = {"": "python%s" % sys.version_info[0]} -VERSION = '0.17.0' +VERSION = '0.17.2' # `python setup.py test` uses existing Python environment, no virtualenv, no pip. diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 4ec8aea..edafe01 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -36,16 +36,18 @@ def test_from_url_ident(): assert pi.proxy_pass == "fish" -def test_from_env(): - os.environ["http_proxy"] = "http://myproxy.example.com:8080" +def test_from_env(monkeypatch): + assert os.environ.get("http_proxy") is None + monkeypatch.setenv("http_proxy", "http://myproxy.example.com:8080") pi = httplib2.proxy_info_from_environment() assert pi.proxy_host == "myproxy.example.com" assert pi.proxy_port == 8080 -def test_from_env_https(): - os.environ["http_proxy"] = "http://myproxy.example.com:80" - os.environ["https_proxy"] = "http://myproxy.example.com:81" +def test_from_env_https(monkeypatch): + assert os.environ.get("http_proxy") is None + monkeypatch.setenv("http_proxy", "http://myproxy.example.com:80") + monkeypatch.setenv("https_proxy", "http://myproxy.example.com:81") pi = httplib2.proxy_info_from_environment("https") assert pi.proxy_host == "myproxy.example.com" assert pi.proxy_port == 81 @@ -57,10 +59,10 @@ def test_from_env_none(): assert pi is None -def test_applies_to(): - os.environ["http_proxy"] = "http://myproxy.example.com:80" - os.environ["https_proxy"] = "http://myproxy.example.com:81" - os.environ["no_proxy"] = "localhost,example.com,.wildcard" +def test_applies_to(monkeypatch): + monkeypatch.setenv("http_proxy", "http://myproxy.example.com:80") + monkeypatch.setenv("https_proxy", "http://myproxy.example.com:81") + monkeypatch.setenv("no_proxy", "localhost,example.com,.wildcard") pi = httplib2.proxy_info_from_environment() assert not pi.applies_to("localhost") assert pi.applies_to("www.google.com") @@ -71,18 +73,18 @@ def test_applies_to(): assert not pi.applies_to("pub.sub.wildcard") -def test_noproxy_trailing_comma(): - os.environ["http_proxy"] = "http://myproxy.example.com:80" - os.environ["no_proxy"] = "localhost,other.host," +def test_noproxy_trailing_comma(monkeypatch): + monkeypatch.setenv("http_proxy", "http://myproxy.example.com:80") + monkeypatch.setenv("no_proxy", "localhost,other.host,") pi = httplib2.proxy_info_from_environment() assert not pi.applies_to("localhost") assert not pi.applies_to("other.host") assert pi.applies_to("example.domain") -def test_noproxy_star(): - os.environ["http_proxy"] = "http://myproxy.example.com:80" - os.environ["NO_PROXY"] = "*" +def test_noproxy_star(monkeypatch): + monkeypatch.setenv("http_proxy", "http://myproxy.example.com:80") + monkeypatch.setenv("NO_PROXY", "*") pi = httplib2.proxy_info_from_environment() for host in ("localhost", "169.254.38.192", "www.google.com"): assert not pi.applies_to(host) @@ -171,3 +173,35 @@ def test_socks5_auth(): http = httplib2.Http(proxy_info=proxy_info) with tests.assert_raises(httplib2.socks.Socks5AuthError): http.request(uri, "GET") + + +def test_functional_noproxy_star_http(monkeypatch): + def handler(request): + if request.method == "CONNECT": + return tests.http_response_bytes( + status="400 Expected direct", headers={"connection": "close"}, + ) + return tests.http_response_bytes() + + with tests.server_request(handler) as uri: + monkeypatch.setenv("http_proxy", uri) + monkeypatch.setenv("no_proxy", "*") + http = httplib2.Http() + response, _ = http.request(uri, "GET") + assert response.status == 200 + + +def test_functional_noproxy_star_https(monkeypatch): + def handler(request): + if request.method == "CONNECT": + return tests.http_response_bytes( + status="400 Expected direct", headers={"connection": "close"}, + ) + return tests.http_response_bytes() + + with tests.server_request(handler, tls=True) as uri: + monkeypatch.setenv("https_proxy", uri) + monkeypatch.setenv("no_proxy", "*") + http = httplib2.Http(ca_certs=tests.CA_CERTS) + response, _ = http.request(uri, "GET") + assert response.status == 200 |