mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-22 17:29:56 +06:00
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:
parent
2aecbabce4
commit
977b6951a3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user