mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
Fix ssl verification
This commit is contained in:
parent
c3d78c871e
commit
7ab8e3e231
1 changed files with 10 additions and 10 deletions
|
@ -145,31 +145,32 @@ class DownloadUtils():
|
||||||
|
|
||||||
def startSession(self):
|
def startSession(self):
|
||||||
|
|
||||||
|
log = self.logMsg
|
||||||
|
|
||||||
self.deviceId = self.clientInfo.getDeviceId()
|
self.deviceId = self.clientInfo.getDeviceId()
|
||||||
|
|
||||||
# User is identified from this point
|
# User is identified from this point
|
||||||
# Attach authenticated header to the session
|
# Attach authenticated header to the session
|
||||||
verify = None
|
verify = False
|
||||||
cert = None
|
|
||||||
header = self.getHeader()
|
header = self.getHeader()
|
||||||
|
|
||||||
# If user enabled host certificate verification
|
# If user enabled host certificate verification
|
||||||
try:
|
try:
|
||||||
verify = self.sslverify
|
verify = self.sslverify
|
||||||
cert = self.sslclient
|
if self.sslclient is not None:
|
||||||
|
verify = self.sslclient
|
||||||
except:
|
except:
|
||||||
self.logMsg("Could not load SSL settings.", 1)
|
log("Could not load SSL settings.", 1)
|
||||||
|
|
||||||
# Start session
|
# Start session
|
||||||
self.s = requests.Session()
|
self.s = requests.Session()
|
||||||
self.s.headers = header
|
self.s.headers = header
|
||||||
self.s.verify = verify
|
self.s.verify = verify
|
||||||
self.s.cert = cert
|
|
||||||
# Retry connections to the server
|
# Retry connections to the server
|
||||||
self.s.mount("http://", requests.adapters.HTTPAdapter(max_retries=1))
|
self.s.mount("http://", requests.adapters.HTTPAdapter(max_retries=1))
|
||||||
self.s.mount("https://", requests.adapters.HTTPAdapter(max_retries=1))
|
self.s.mount("https://", requests.adapters.HTTPAdapter(max_retries=1))
|
||||||
|
|
||||||
self.logMsg("Requests session started on: %s" % self.server, 1)
|
log("Requests session started on: %s" % self.server, 1)
|
||||||
|
|
||||||
def stopSession(self):
|
def stopSession(self):
|
||||||
try:
|
try:
|
||||||
|
@ -258,7 +259,7 @@ class DownloadUtils():
|
||||||
if utils.settings('sslverify') == "true":
|
if utils.settings('sslverify') == "true":
|
||||||
verifyssl = True
|
verifyssl = True
|
||||||
if utils.settings('sslcert') != "None":
|
if utils.settings('sslcert') != "None":
|
||||||
cert = utils.settings('sslcert')
|
verifyssl = utils.settings('sslcert')
|
||||||
|
|
||||||
# Replace for the real values
|
# Replace for the real values
|
||||||
url = url.replace("{server}", self.server)
|
url = url.replace("{server}", self.server)
|
||||||
|
@ -271,7 +272,6 @@ class DownloadUtils():
|
||||||
params=parameters,
|
params=parameters,
|
||||||
headers=header,
|
headers=header,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
cert=cert,
|
|
||||||
verify=verifyssl)
|
verify=verifyssl)
|
||||||
|
|
||||||
elif type == "POST":
|
elif type == "POST":
|
||||||
|
@ -279,7 +279,6 @@ class DownloadUtils():
|
||||||
json=postBody,
|
json=postBody,
|
||||||
headers=header,
|
headers=header,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
cert=cert,
|
|
||||||
verify=verifyssl)
|
verify=verifyssl)
|
||||||
|
|
||||||
elif type == "DELETE":
|
elif type == "DELETE":
|
||||||
|
@ -287,7 +286,6 @@ class DownloadUtils():
|
||||||
json=postBody,
|
json=postBody,
|
||||||
headers=header,
|
headers=header,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
cert=cert,
|
|
||||||
verify=verifyssl)
|
verify=verifyssl)
|
||||||
|
|
||||||
# If user is not authenticated
|
# If user is not authenticated
|
||||||
|
@ -299,6 +297,8 @@ class DownloadUtils():
|
||||||
# If user enables ssl verification
|
# If user enables ssl verification
|
||||||
try:
|
try:
|
||||||
verifyssl = self.sslverify
|
verifyssl = self.sslverify
|
||||||
|
if self.sslclient is not None:
|
||||||
|
verifyssl = self.sslclient
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue