Get HTTPS working in http_client by skipping over a super. · cdent/wsgi-intercept@d70dfa9 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit d70dfa9

Get HTTPS working in http_client by skipping over a super.

The super() used in http.client.HTTPSConnection leads to a bit of recursion because of the already in place overrides. To get around this we replace the __init__. This unfortunately removes some SSL features, but on the other hand it means that SSL type requests will work. For more effective testing other libraries should be used.

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -30,7 +30,16 @@ class HTTP_WSGIInterceptor(HTTPInterceptorMixin, http_lib.HTTPConnection):
30 30
31 31 class HTTPS_WSGIInterceptor(HTTPSInterceptorMixin, http_lib.HTTPSConnection,
32 32 HTTP_WSGIInterceptor):
33 -pass
33 +
34 +def __init__(self, host, **kwargs):
35 +self.host = host
36 +try:
37 +self.port = kwargs['port']
38 +except KeyError:
39 +self.port = None
40 +HTTP_WSGIInterceptor.__init__(self, host, **kwargs)
41 +
42 +
34 43
35 44
36 45 def install():