Remove streamhost redirect
After asking around this is a dead feature. Because servers cannot be sure if clients support redirection, a server using this feature would essentially risk that his users are not able to connect at all.
This commit is contained in:
parent
af7ac9211d
commit
e918ac85fe
|
@ -593,7 +593,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.connected_hostname = None
|
self.connected_hostname = None
|
||||||
# Holds the full jid we received on the bind event
|
# Holds the full jid we received on the bind event
|
||||||
self.registered_name = None
|
self.registered_name = None
|
||||||
self.redirected = None
|
|
||||||
self.last_time_to_reconnect = None
|
self.last_time_to_reconnect = None
|
||||||
self.new_account_info = None
|
self.new_account_info = None
|
||||||
self.new_account_form = None
|
self.new_account_form = None
|
||||||
|
@ -794,12 +793,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
# show error dialog
|
# show error dialog
|
||||||
self._connection_lost()
|
self._connection_lost()
|
||||||
else:
|
else:
|
||||||
if self.redirected:
|
self.disconnect()
|
||||||
self.disconnect(on_purpose=True)
|
|
||||||
self.connect()
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
self.disconnect()
|
|
||||||
self.on_purpose = False
|
self.on_purpose = False
|
||||||
# END disconnectedReconnCB
|
# END disconnectedReconnCB
|
||||||
|
|
||||||
|
@ -988,25 +982,21 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.name, 'try_connecting_for_foo_secs')
|
self.name, 'try_connecting_for_foo_secs')
|
||||||
proxy = helpers.get_proxy_info(self.name)
|
proxy = helpers.get_proxy_info(self.name)
|
||||||
use_srv = app.config.get_per('accounts', self.name, 'use_srv')
|
use_srv = app.config.get_per('accounts', self.name, 'use_srv')
|
||||||
if self.redirected:
|
|
||||||
use_custom = True
|
use_custom = app.config.get_per('accounts', self.name,
|
||||||
custom_h = self.redirected['host']
|
'use_custom_host')
|
||||||
custom_p = self.redirected['port']
|
if use_custom:
|
||||||
else:
|
custom_h = app.config.get_per('accounts', self.name,
|
||||||
use_custom = app.config.get_per('accounts', self.name,
|
'custom_host')
|
||||||
'use_custom_host')
|
custom_p = app.config.get_per('accounts', self.name,
|
||||||
if use_custom:
|
'custom_port')
|
||||||
custom_h = app.config.get_per('accounts', self.name,
|
try:
|
||||||
'custom_host')
|
helpers.idn_to_ascii(custom_h)
|
||||||
custom_p = app.config.get_per('accounts', self.name,
|
except Exception:
|
||||||
'custom_port')
|
app.nec.push_incoming_event(InformationEvent(
|
||||||
try:
|
None, dialog_name='invalid-custom-hostname',
|
||||||
helpers.idn_to_ascii(custom_h)
|
args=custom_h))
|
||||||
except Exception:
|
use_custom = False
|
||||||
app.nec.push_incoming_event(InformationEvent(
|
|
||||||
None, dialog_name='invalid-custom-hostname',
|
|
||||||
args=custom_h))
|
|
||||||
use_custom = False
|
|
||||||
|
|
||||||
# create connection if it doesn't already exist
|
# create connection if it doesn't already exist
|
||||||
self.connected = 1
|
self.connected = 1
|
||||||
|
@ -1018,10 +1008,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
h = custom_h
|
h = custom_h
|
||||||
p = custom_p
|
p = custom_p
|
||||||
ssl_p = custom_p
|
ssl_p = custom_p
|
||||||
if not self.redirected:
|
use_srv = False
|
||||||
use_srv = False
|
|
||||||
|
|
||||||
self.redirected = None
|
|
||||||
# SRV resolver
|
# SRV resolver
|
||||||
self._proxy = proxy
|
self._proxy = proxy
|
||||||
self._hosts = [
|
self._hosts = [
|
||||||
|
@ -1148,11 +1136,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
|
|
||||||
self._current_host = host
|
self._current_host = host
|
||||||
|
|
||||||
if self.redirected:
|
|
||||||
self.disconnect(on_purpose=True)
|
|
||||||
self.connect()
|
|
||||||
return
|
|
||||||
|
|
||||||
self._current_type = self._current_host['type']
|
self._current_type = self._current_host['type']
|
||||||
|
|
||||||
port = self._current_host['port']
|
port = self._current_host['port']
|
||||||
|
|
|
@ -774,7 +774,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
self.privacy_default_list = None
|
self.privacy_default_list = None
|
||||||
|
|
||||||
app.nec.register_incoming_event(StreamConflictReceivedEvent)
|
app.nec.register_incoming_event(StreamConflictReceivedEvent)
|
||||||
app.nec.register_incoming_event(StreamOtherHostReceivedEvent)
|
|
||||||
app.nec.register_incoming_event(MessageReceivedEvent)
|
app.nec.register_incoming_event(MessageReceivedEvent)
|
||||||
app.nec.register_incoming_event(ArchivingErrorReceivedEvent)
|
app.nec.register_incoming_event(ArchivingErrorReceivedEvent)
|
||||||
app.nec.register_incoming_event(
|
app.nec.register_incoming_event(
|
||||||
|
@ -799,8 +798,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
||||||
app.ged.register_event_handler('agent-removed', ged.CORE,
|
app.ged.register_event_handler('agent-removed', ged.CORE,
|
||||||
self._nec_agent_removed)
|
self._nec_agent_removed)
|
||||||
app.ged.register_event_handler('stream-other-host-received', ged.CORE,
|
|
||||||
self._nec_stream_other_host_received)
|
|
||||||
app.ged.register_event_handler('blocking', ged.CORE,
|
app.ged.register_event_handler('blocking', ged.CORE,
|
||||||
self._nec_blocking)
|
self._nec_blocking)
|
||||||
|
|
||||||
|
@ -826,8 +823,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
||||||
app.ged.remove_event_handler('agent-removed', ged.CORE,
|
app.ged.remove_event_handler('agent-removed', ged.CORE,
|
||||||
self._nec_agent_removed)
|
self._nec_agent_removed)
|
||||||
app.ged.remove_event_handler('stream-other-host-received', ged.CORE,
|
|
||||||
self._nec_stream_other_host_received)
|
|
||||||
app.ged.remove_event_handler('blocking', ged.CORE, self._nec_blocking)
|
app.ged.remove_event_handler('blocking', ged.CORE, self._nec_blocking)
|
||||||
|
|
||||||
def add_sha(self, p, send_caps=True):
|
def add_sha(self, p, send_caps=True):
|
||||||
|
@ -1383,11 +1378,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||||
probe = nbxmpp.Presence(jid, 'probe', frm=self.get_own_jid())
|
probe = nbxmpp.Presence(jid, 'probe', frm=self.get_own_jid())
|
||||||
self.connection.send(probe)
|
self.connection.send(probe)
|
||||||
|
|
||||||
def _nec_stream_other_host_received(self, obj):
|
|
||||||
if obj.conn.name != self.name:
|
|
||||||
return
|
|
||||||
self.redirected = obj.redirected
|
|
||||||
|
|
||||||
def _StreamCB(self, con, obj):
|
def _StreamCB(self, con, obj):
|
||||||
log.debug('StreamCB')
|
log.debug('StreamCB')
|
||||||
app.nec.push_incoming_event(StreamReceivedEvent(None,
|
app.nec.push_incoming_event(StreamReceivedEvent(None,
|
||||||
|
|
|
@ -331,28 +331,6 @@ class StreamConflictReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
self.conn = self.base_event.conn
|
self.conn = self.base_event.conn
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class StreamOtherHostReceivedEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'stream-other-host-received'
|
|
||||||
base_network_events = ['stream-received']
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
self.conn = self.base_event.conn
|
|
||||||
self.stanza = self.base_event.stanza
|
|
||||||
other_host = self.stanza.getTag('see-other-host')
|
|
||||||
if other_host and self.conn._current_type in ('ssl', 'tls'):
|
|
||||||
host = other_host.getData()
|
|
||||||
if ':' in host:
|
|
||||||
host_l = host.split(':', 1)
|
|
||||||
h = host_l[0]
|
|
||||||
p = host_l[1]
|
|
||||||
else:
|
|
||||||
h = host
|
|
||||||
p = 5222
|
|
||||||
if h.startswith('[') and h.endswith(']'):
|
|
||||||
h = h[1:-1]
|
|
||||||
self.redirected = {'host': h, 'port': p}
|
|
||||||
return True
|
|
||||||
|
|
||||||
class PresenceHelperEvent:
|
class PresenceHelperEvent:
|
||||||
def _generate_show(self):
|
def _generate_show(self):
|
||||||
self.show = self.stanza.getShow()
|
self.show = self.stanza.getShow()
|
||||||
|
|
Loading…
Reference in New Issue