Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

HTTPSConnection issue with Python 3.4.3 #180

Closed
LeeTroy opened this issue Jul 24, 2019 · 0 comments · Fixed by #183
Closed

HTTPSConnection issue with Python 3.4.3 #180

LeeTroy opened this issue Jul 24, 2019 · 0 comments · Fixed by #183
Assignees

Comments

@LeeTroy
Copy link

LeeTroy commented Jul 24, 2019

According to the notes of http.client.HTTPSConnection, Python 3.4.3 can use ssl._create_unverified_context() to pass to context.

With Python 3.4.3, the code snips below will fall into the if condition (less than or equal to 3.4.3).

#if 3.4.2
if (sys.version_info.major == 3 and sys.version_info.minor == 4 and sys.version_info.micro <= 3) :
cont=ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
cont.verify_mode = ssl.CERT_NONE
try:
svr_conn = HTTPSConnection(host=host_ip_addr, context=cont)
except:
exc_str = sys.exc_info()[0]
svr_conn = 0 # failure
else:
try:
cntxt = ssl._create_unverified_context()
except:
exc_str = sys.exc_info()[0]
svr_conn = 0 # failure
try:
svr_conn = HTTPSConnection(sut_prop['DnsName'], context=cntxt)
except:
exc_str = sys.exc_info()[0]
svr_conn = 0 # failure

Should it be less than 3.4.3:

if (sys.version_info.major == 3 and sys.version_info.minor == 4 and sys.version_info.micro < 3) : 

instead of less than and equal to 3.4.3:

if (sys.version_info.major == 3 and sys.version_info.minor == 4 and sys.version_info.micro <= 3) : 

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants