Force plugin to use TLS v1.2 instead of v1.3.

This is needed due to a change on Adobe's end, breaking
Python > 3.7.16.

Fixes #105.
This commit is contained in:
Florian Bach 2024-09-17 19:15:25 +02:00
parent 6c29c42581
commit 2dcf26be18

View File

@ -294,7 +294,13 @@ def sendHTTPRequest_getSimple(URL):
# It appears as if lots of book distributors have either invalid or expired certs ... # It appears as if lots of book distributors have either invalid or expired certs ...
# No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways. # No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways.
# Not the best solution, but it works. # Not the best solution, but it works.
ctx = ssl.create_default_context() try:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
# This is needed due to an Adobe change.
# Without this, only Python <= 3.7.16 can connect, 3.7.17 and above fail.
except:
ctx = ssl.create_default_context()
ctx.check_hostname = False ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE ctx.verify_mode = ssl.CERT_NONE
@ -328,7 +334,13 @@ def sendPOSTHTTPRequest(URL, document, type, returnRC = False):
# It appears as if lots of book distributors have either invalid or expired certs ... # It appears as if lots of book distributors have either invalid or expired certs ...
# No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways. # No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways.
# Not the best solution, but it works. # Not the best solution, but it works.
ctx = ssl.create_default_context() try:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
# This is needed due to an Adobe change.
# Without this, only Python <= 3.7.16 can connect, 3.7.17 and above fail.
except:
ctx = ssl.create_default_context()
ctx.check_hostname = False ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE ctx.verify_mode = ssl.CERT_NONE