Fixed JEP-70 (HTTP auth) error protocol. (#2124)
This commit is contained in:
parent
87fa2c0a5d
commit
1b0f153e42
|
@ -1121,11 +1121,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
|||
|
||||
def build_http_auth_answer(self, iq_obj, answer):
|
||||
if answer == 'yes':
|
||||
iq = iq_obj.buildReply('result')
|
||||
self.connection.send(iq_obj.buildReply('result'))
|
||||
elif answer == 'no':
|
||||
iq = iq_obj.buildReply('error')
|
||||
iq.setError('not-authorized', 401)
|
||||
self.connection.send(iq)
|
||||
from common.xmpp.protocol import ERR_NOT_AUTHORIZED
|
||||
err = common.xmpp.Error(iq_obj, ERR_NOT_AUTHORIZED)
|
||||
self.connection.send(err)
|
||||
|
||||
def _HttpAuthCB(self, con, iq_obj):
|
||||
gajim.log.debug('HttpAuthCB')
|
||||
|
|
|
@ -357,10 +357,10 @@ class Protocol(Node):
|
|||
if tag.getName()=='text': return tag.getData()
|
||||
return self.getError()
|
||||
def getErrorCode(self):
|
||||
""" Return the error code. Obsolette. """
|
||||
""" Return the error code. Obsolete. """
|
||||
return self.getTagAttr('error','code')
|
||||
def setError(self,error,code=None):
|
||||
""" Set the error code. Obsolette. Use error-conditions instead. """
|
||||
""" Set the error code. Obsolete. Use error-conditions instead. """
|
||||
if code:
|
||||
if str(code) in _errorcodes.keys(): error=ErrorNode(_errorcodes[str(code)],text=error)
|
||||
else: error=ErrorNode(ERR_UNDEFINED_CONDITION,code=code,typ='cancel',text=error)
|
||||
|
|
Loading…
Reference in New Issue