summaryrefslogtreecommitdiff
path: root/dummyserver/testcase.py
diff options
context:
space:
mode:
authorJorge <JALopezSilva@gmail.com>2020-03-12 01:39:39 -0700
committerGitHub <noreply@github.com>2020-03-12 12:39:39 +0400
commit8c7a43b4a4ca0c8d36d55f132daa2a43d06fe3c4 (patch)
tree1dd43f9f6c688fbcb774abd323a86c57ef784f3f /dummyserver/testcase.py
parent33a29c5e34ee3375cde07addeb979aba56f2ca5a (diff)
downloadurllib3-8c7a43b4a4ca0c8d36d55f132daa2a43d06fe3c4.tar.gz
Add support for HTTPS connections to proxies. (#1679)
* Add support to talk HTTPS to proxies. Currently there's no way to validate identify for the proxy you might be connecting. Proxies supporting HTTPS endpoints are becoming more common and we need to extend the support for them. When an HTTPS proxy is provided, instead of doing the HTTP CONNECT, we'll forward any requests directly to the proxy and ultimately to the destination. * Fix proxy_headers missing on HTTPS proxy connections. * blackfmt missing files. * Prevent usage of HTTPS proxies when fetching HTTPS resources. - Will be supported by default when we can do TLS within TLS. * Update proxy documentation with more information. * Renamed flag for HTTPS websites through HTTPS proxies. * Added myself to contributors. * Documentation and contributors fixes. * Removed mention that TLS in TLS is being developed as requested. * Space in between my name and the github page. * Add flag to enable HTTPS proxy support. Now that we're adding support for HTTPS proxies we want to avoid a breaking change with clients that had an improper proxy configuration. For now, we're adding a warning an defaulting to the previous behavior. In the future we'll change the behavior to enable HTTPS proxies by default. * Remove guard flag, error out on HTTPS/HTTPS. As requested in the last revision for the PR: - Removed the _enable_https_proxies flag. Instead the feature will be enabled and will error out on invalid configurations. (HTTPS + HTTPS) - Other comments: rename a method, parentheses to clarify order of operations.
Diffstat (limited to 'dummyserver/testcase.py')
-rw-r--r--dummyserver/testcase.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py
index 90c6b224..4e3cf593 100644
--- a/dummyserver/testcase.py
+++ b/dummyserver/testcase.py
@@ -180,6 +180,14 @@ class HTTPDummyProxyTestCase(object):
app, cls.io_loop, None, "http", cls.proxy_host
)
+ upstream_ca_certs = cls.https_certs.get("ca_certs", None)
+ app = web.Application(
+ [(r".*", ProxyHandler)], upstream_ca_certs=upstream_ca_certs
+ )
+ cls.https_proxy_server, cls.https_proxy_port = run_tornado_app(
+ app, cls.io_loop, cls.https_certs, "https", cls.proxy_host
+ )
+
cls.server_thread = run_loop_in_thread(cls.io_loop)
@classmethod
@@ -187,6 +195,7 @@ class HTTPDummyProxyTestCase(object):
cls.io_loop.add_callback(cls.http_server.stop)
cls.io_loop.add_callback(cls.https_server.stop)
cls.io_loop.add_callback(cls.proxy_server.stop)
+ cls.io_loop.add_callback(cls.https_proxy_server.stop)
cls.io_loop.add_callback(cls.io_loop.stop)
cls.server_thread.join()