From 39a7e191233826c32ac20c94d6d04b0d16693872 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Tue, 14 Dec 2021 14:27:59 +0530 Subject: [PATCH] https://github.com/docker/buildx/issues/850 --- .dockerignore | 2 +- Makefile | 4 ++-- requirements-testing.txt | 1 + tests/http/test_http2.py | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tests/http/test_http2.py diff --git a/.dockerignore b/.dockerignore index 3bd432ac85..d847851b40 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ # Ignore everything ** -!dist/*.whl +!dist !README.md diff --git a/Makefile b/Makefile index 88e0e74437..3d0c604e7e 100644 --- a/Makefile +++ b/Makefile @@ -126,11 +126,11 @@ lib-release: lib-package lib-doc: python -m tox -e build-docs && \ - $(OPEN) .tox/build-docs/docs_out/index.html + $(OPEN) .tox/build-docs/docs_out/index.html || true lib-coverage: pytest --cov=proxy --cov=tests --cov-report=html tests/ && \ - $(OPEN) htmlcov/index.html + $(OPEN) htmlcov/index.html || true lib-profile: ulimit -n 65536 && \ diff --git a/requirements-testing.txt b/requirements-testing.txt index 9c12cea479..d226feb8b7 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -15,3 +15,4 @@ tox==3.24.4 mccabe==0.6.1 pylint==2.12.2 rope==0.22.0 +httpx[http2] diff --git a/tests/http/test_http2.py b/tests/http/test_http2.py new file mode 100644 index 0000000000..2e37aad63f --- /dev/null +++ b/tests/http/test_http2.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +""" + proxy.py + ~~~~~~~~ + ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on + Network monitoring, controls & Application development, testing, debugging. + + :copyright: (c) 2013-present by Abhinav Singh and contributors. + :license: BSD, see LICENSE for more details. +""" +import httpx + +from proxy import TestCase + + +class TestHttp2WithProxy(TestCase): + + def test_http2_via_proxy(self) -> None: + assert self.PROXY + response = httpx.get( + 'https://httpbin.org/get', + headers={'accept': 'application/json'}, + verify=httpx.create_ssl_context(http2=True), + timeout=httpx.Timeout(timeout=5.0), + proxies={ + 'all://': 'http://localhost:%d' % self.PROXY.flags.port, + }, + ) + self.assertEqual(response.status_code, 200) + + # def test_http2_streams_over_proxy_keep_alive_connection(self) -> None: + # pass