Skip to content

Commit 723a16a

Browse files
committed
for sharing testing
1 parent 005c859 commit 723a16a

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
'pytest>=2.4',
4141
'httplib2',
4242
'requests>=2.0.1',
43-
'urllib3<2.0.0',
43+
'urllib3>=2.0.0',
4444
],
4545
'docs': [
4646
'sphinx',

wsgi_intercept/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ class WSGI_HTTPSConnection(HTTPSConnection, WSGI_HTTPConnection):
578578
Intercept all traffic to certain hosts & redirect into a WSGI
579579
application object.
580580
"""
581+
582+
def __init__(self, *args, **kwargs):
583+
print("getting %s ::: %s" % (args, kwargs))
584+
super().__init__(*args, **kwargs)
585+
581586
def get_app(self, host, port):
582587
"""
583588
Return the app object for the given (host, port).

wsgi_intercept/_urllib3.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def make_urllib3_override(HTTPConnectionPool, HTTPSConnectionPool,
3232

3333
class HTTP_WSGIInterceptor(WSGI_HTTPConnection, HTTPConnection):
3434
def __init__(self, *args, **kwargs):
35+
print(f"http pre: {args} ::: {kwargs}")
3536
for kw in HTTP_KEYWORD_POPS:
3637
kwargs.pop(kw, None)
3738
WSGI_HTTPConnection.__init__(self, *args, **kwargs)
@@ -41,15 +42,19 @@ class HTTPS_WSGIInterceptor(WSGI_HTTPSConnection, HTTPSConnection):
4142
is_verified = True
4243

4344
def __init__(self, *args, **kwargs):
44-
print(f"pre: {args} ::: {kwargs}")
45+
print(f"https pre: {args} ::: {kwargs}")
4546
for kw in HTTPS_KEYWORD_POPS:
4647
kwargs.pop(kw, None)
4748
if sys.version_info > (3, 12):
4849
kwargs.pop('key_file', None)
4950
kwargs.pop('cert_file', None)
50-
print(f"post: {args} ::: {kwargs}")
51-
WSGI_HTTPSConnection.__init__(self, *args, **kwargs)
51+
print(f"https post: {args} ::: {kwargs}")
52+
host = kwargs.pop('host')
53+
port = kwargs.pop('port')
54+
WSGI_HTTPSConnection.__init__(self, host, port, *args, **kwargs)
55+
print("after wsgi")
5256
HTTPSConnection.__init__(self, *args, **kwargs)
57+
print("after https")
5358

5459
def install():
5560
if 'http_proxy' in os.environ or 'https_proxy' in os.environ:

wsgi_intercept/tests/test_urllib3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_proxy_handling():
5454
del os.environ['http_proxy']
5555

5656

57-
def test_https():
57+
def test_https_meo():
5858
with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:
5959
resp = http.request(
6060
'GET', 'https://some_hopefully_nonexistant_domain:443/')

0 commit comments

Comments
 (0)