From: Jaroslav Kysela Date: Mon, 1 Oct 2018 12:29:46 +0000 (+0200) Subject: htsp.py: do not send authorization for each request X-Git-Tag: v4.2.7~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4d0a42e7cf3a76dfd38ec52fea7cb5855430be8;p=thirdparty%2Ftvheadend.git htsp.py: do not send authorization for each request --- diff --git a/lib/py/tvh/htsp.py b/lib/py/tvh/htsp.py index 49669ad16..23fb2e58a 100644 --- a/lib/py/tvh/htsp.py +++ b/lib/py/tvh/htsp.py @@ -50,13 +50,14 @@ class HTSPClient(object): self._name = name self._auth = None self._user = None - self._pass = None + self._auser = None + self._apass = None # Send def send(self, func, args={}): args['method'] = func - if self._user: args['username'] = self._user - if self._pass: args['digest'] = htsmsg.HMFBin(self._pass) + if self._auser: args['username'] = self._auser + if self._apass: args['digest'] = htsmsg.HMFBin(self._apass) log.debug('htsp tx:') log.debug(args, pretty=True) self._sock.send(htsmsg.serialize(args)) @@ -86,13 +87,16 @@ class HTSPClient(object): # Authenticate def authenticate(self, user, passwd=None): - self._user = user + self._auser = user if passwd: - self._pass = htsp_digest(user, passwd, self._auth) + self._apass = htsp_digest(user, passwd, self._auth) self.send('authenticate') + self._auser = None + self._apass = None resp = self.recv() if 'noaccess' in resp: raise Exception('Authentication failed') + self._user = user # Enable async receive def enableAsyncMetadata(self, args={}):