Add insecure fix - still needs correct hostname
This commit is contained in:
parent
ced597b6d2
commit
469681bf5e
|
@ -47,14 +47,14 @@ class HTTPSConnectionChain(http_client.HTTPSConnection):
|
||||||
def connect(self):
|
def connect(self):
|
||||||
sock = self._create_sock()
|
sock = self._create_sock()
|
||||||
try:
|
try:
|
||||||
self.sock = ssl.create_default_context().wrap_socket(sock,
|
self.sock = self._context.wrap_socket(sock,
|
||||||
server_hostname=self.host)
|
server_hostname=self.host)
|
||||||
except:
|
except:
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
class HTTPSHandlerChain(urllib.request.HTTPSHandler):
|
class HTTPSHandlerChain(urllib.request.HTTPSHandler):
|
||||||
def https_open(self, req):
|
def https_open(self, req):
|
||||||
return self.do_open(HTTPSConnectionChain, req)
|
return self.do_open(HTTPSConnectionChain, req, context=self._context)
|
||||||
|
|
||||||
# install opener
|
# install opener
|
||||||
urllib.request.install_opener(urllib.request.build_opener(HTTPSHandlerChain()))
|
urllib.request.install_opener(urllib.request.build_opener(HTTPSHandlerChain()))
|
||||||
|
@ -894,11 +894,12 @@ class Connection(object):
|
||||||
'converted': converted})
|
'converted': converted})
|
||||||
|
|
||||||
req = self._getRequest(viewName, q)
|
req = self._getRequest(viewName, q)
|
||||||
xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
||||||
#res = self._doBinReq(req)
|
return_url = req.full_url
|
||||||
#if isinstance(res, dict):
|
if self._insecure:
|
||||||
# self._checkStatus(res)
|
return_url += '|verifypeer=false'
|
||||||
return req.full_url
|
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
||||||
|
return return_url
|
||||||
|
|
||||||
|
|
||||||
def getCoverArt(self, aid, size=None):
|
def getCoverArt(self, aid, size=None):
|
||||||
|
@ -942,11 +943,12 @@ class Connection(object):
|
||||||
q = self._getQueryDict({'id': aid, 'size': size})
|
q = self._getQueryDict({'id': aid, 'size': size})
|
||||||
|
|
||||||
req = self._getRequest(viewName, q)
|
req = self._getRequest(viewName, q)
|
||||||
xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
||||||
#res = self._doBinReq(req)
|
return_url = req.full_url
|
||||||
#if isinstance(res, dict):
|
if self._insecure:
|
||||||
# self._checkStatus(res)
|
return_url += '|verifypeer=false'
|
||||||
return req.full_url
|
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
||||||
|
return return_url
|
||||||
|
|
||||||
|
|
||||||
def scrobble(self, sid, submission=True, listenTime=None):
|
def scrobble(self, sid, submission=True, listenTime=None):
|
||||||
|
|
Loading…
Reference in New Issue