diff options
author | Jonas Schäfer <j.wielicki@sotecware.net> | 2019-08-05 18:23:41 +0200 |
---|---|---|
committer | Jonas Schäfer <j.wielicki@sotecware.net> | 2019-08-20 21:42:43 +0200 |
commit | b68f36056dab9f7cd8f6b9fcda4db445df1b5ada (patch) | |
tree | fde671310cf165cb50d10f2c78800fe73fd3adc7 /tests | |
parent | a8cd24148522473caba5ba46b06c9b7b5f6633a9 (diff) | |
download | biboumi-b68f36056dab9f7cd8f6b9fcda4db445df1b5ada.tar.gz biboumi-b68f36056dab9f7cd8f6b9fcda4db445df1b5ada.tar.bz2 biboumi-b68f36056dab9f7cd8f6b9fcda4db445df1b5ada.tar.xz biboumi-b68f36056dab9f7cd8f6b9fcda4db445df1b5ada.zip |
XEP-0410: implement server-side optimisation for self-pings
This prevents the ping from round-tripping through IRC and
possibly a random other client of the user. Please see XEP-0410
for the rationale.
Fixes #3385.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/end_to_end/__main__.py | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 70ee376..67dffc9 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -1515,24 +1515,12 @@ if __name__ == '__main__': # Send a ping to ourself partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), - # We receive our own ping request, - partial(expect_stanza, - "/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"), - # Respond to the request with an error - partial(send_stanza, - "<iq from='{jid_one}/{resource_one}' id='gnip_tsrif' to='{lower_nick_one}%{irc_server_one}' type='error'><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>"), partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"), # Send a ping to ourself partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), - # We receive our own ping request, - partial(expect_stanza, - "/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"), - # Respond to the request with an error - partial(send_stanza, - "<iq from='{jid_one}/{resource_one}' id='gnip_tsrif' to='{lower_nick_one}%{irc_server_one}' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>"), partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"), ]), @@ -1581,12 +1569,6 @@ if __name__ == '__main__': # Send a ping to ourself partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), - # We receive our own ping request, - partial(expect_stanza, - "/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"), - # Respond to the request - partial(send_stanza, - "<iq type='result' to='{lower_nick_one}%{irc_server_one}' id='gnip_tsrif' from='{jid_one}/{resource_one}'/>"), partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"), @@ -1602,24 +1584,12 @@ if __name__ == '__main__': # And re-send a self ping partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_one}' id='second_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), - # We receive our own ping request. Note that we don't know the to value, it could be one of our two resources. - partial(expect_stanza, - "/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to][@id='gnip_dnoces']", - after = partial(save_value, "to", partial(extract_attribute, "/iq", "to"))), - # Respond to the request, using the extracted 'to' value as our 'from' - partial(send_stanza, - "<iq type='result' to='{lower_nick_one}%{irc_server_one}' id='gnip_dnoces' from='{to}'/>"), partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='second_ping']"), ## And re-do exactly the same thing, just change the resource initiating the self ping partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_two}' id='third_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), partial(expect_stanza, - "/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to][@id='gnip_driht']", - after = partial(save_value, "to", partial(extract_attribute, "/iq", "to"))), - partial(send_stanza, - "<iq type='result' to='{lower_nick_one}%{irc_server_one}' id='gnip_driht' from='{to}'/>"), - partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_two}'][@id='third_ping']"), ]), @@ -1639,12 +1609,6 @@ if __name__ == '__main__': # Send a ping to ourself partial(send_stanza, "<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo@{biboumi_host}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"), - # We receive our own ping request, - partial(expect_stanza, - "/iq[@from='{lower_nick_one}@{biboumi_host}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"), - # Respond to the request - partial(send_stanza, - "<iq type='result' to='{lower_nick_one}@{biboumi_host}' id='gnip_tsrif' from='{jid_one}/{resource_one}'/>"), partial(expect_stanza, "/iq[@from='#foo@{biboumi_host}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"), ], conf="fixed_server"), |