Trying to fix SSL issues. Seems to be a Kodi request issue for very first calls?!?

still get "[Errno 8] _ssl.c:510: EOF occurred in violation of protocol"
This commit is contained in:
tomkat83 2015-12-27 13:20:53 +01:00
parent 2d84c39be5
commit 6c40455ac6
4 changed files with 19 additions and 10 deletions

View file

@ -152,11 +152,7 @@ class PlexAPI():
url = 'https://plex.tv/api/home/users'
else:
url = url + '/clients'
self.logMsg(
"CheckConnection called for url %s with token %s"
% (url, token),
1
)
self.logMsg("CheckConnection called for url %s with a token" % url, 1)
r = downloadutils.DownloadUtils().downloadUrl(
url,

View file

@ -264,13 +264,16 @@ class DownloadUtils():
elif not authenticate:
header = self.getHeader(authenticate=False, options=headerOptions)
verifyssl = False
# If user enables ssl verification
try:
verifyssl = self.sslverify
except AttributeError:
pass
if utils.settings('sslverify') == "true":
verifyssl = True
else:
verifyssl = False
self.logMsg("Set SSL verification to: %s" % verifyssl, 2)
# Prepare request
if type == "GET":

View file

@ -114,10 +114,13 @@ class InitialSetup():
self.logMsg("Result of setting g_PMS variable: %s" % self.plx.g_PMS, 2)
isconnected = False
serverlist = self.plx.returnServerList(clientId, self.plx.g_PMS)
serverNum = len(serverlist)
# Let user pick server from a list
# Get a nicer list
dialoglist = []
# Exit if no servers found
serverNum = len(serverlist)
if serverNum == 0:
break
for server in serverlist:
dialoglist.append(str(server['name']) + ' (IP: ' + str(server['ip']) + ')')
dialog = xbmcgui.Dialog()
@ -128,6 +131,13 @@ class InitialSetup():
activeServer = server['machineIdentifier']
url = server['scheme'] + '://' + server['ip'] + ':' + \
server['port']
# Deactive SSL verification if the server is local!
if server['local'] == '1':
self.addon.setSetting('sslverify', 'false')
self.logMsg("Setting SSL verify to false, because server is local", 1)
else:
self.addon.setSetting('sslverify', 'true')
self.logMsg("Setting SSL verify to true, because server is not local", 1)
chk = self.plx.CheckConnection(url, server['accesstoken'])
# Unauthorized
if chk == 401:

View file

@ -5,14 +5,14 @@
<setting id="ipaddress" label="30000" type="text" default="" />
<setting id="port" label="30030" type="number" default="32400" />
<setting id="https" label="30243" type="bool" default="false" />
<setting id="sslverify" subsetting="true" label="Verify Host SSL Certificate" type="bool" default="false" visible="eq(-1,true)" />
<setting id="sslverify" subsetting="true" label="Verify Host SSL Certificate" type="bool" default="true" visible="eq(-1,true)" />
<setting id="sslcert" subsetting="true" label="Client SSL certificate" type="file" default="None" visible="eq(-2,true)" />
<!-- Secondary address -->
<setting id="altip" label="Use alternate address" type="bool" default="false" />
<setting id="secondipaddress" label="Secondary Server Address" type="text" default="" visible="eq(-1,true)" />
<setting id="secondport" label="30030" type="number" default="32400" visible="eq(-2,true)" />true)" />
<setting id="secondhttps" label="30243" type="bool" default="false" visible="eq(-3,true)" />
<setting id="secondsslverify" subsetting="true" label="Verify Host SSL Certificate" type="bool" default="false" visible="eq(-1,true)" />
<setting id="secondsslverify" subsetting="true" label="Verify Host SSL Certificate" type="bool" default="true" visible="eq(-1,true)" />
<setting id="secondsslcert" subsetting="true" label="Client SSL certificate" type="file" default="None" visible="eq(-2,true)" />
<!-- User settings -->
<setting id="myplexlogin" label="Log into plex.tv?" type="bool" default="true" />