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