Ignore SSL errors during ACS Notify

Apparently some distributors aren't using SSL correctly (or it somehow gets
messed up along the way) and the notification fails. There's nothing that
needs to be kept secret in these notifications so we can ignore SSL errors
to ensure that fulfillment works even when SSL isn't.
This commit is contained in:
Florian Bach 2021-10-26 08:03:33 +02:00
parent 2aecbabce4
commit 977b6951a3

View File

@ -168,8 +168,17 @@ def sendHTTPRequest_getSimple(URL: str):
"Accept": "*/*",
"User-Agent": "book2png",
}
# Ignore SSL:
# 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.
# Not the best solution, but it works.
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
req = urllib.request.Request(url=URL, headers=headers)
handler = urllib.request.urlopen(req)
handler = urllib.request.urlopen(req, context=ctx)
content = handler.read()
@ -193,6 +202,9 @@ def sendPOSTHTTPRequest(URL: str, document: bytes, type: str, returnRC = False):
}
# Ignore SSL:
# 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.
# Not the best solution, but it works.
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE