diff --git a/xep-0305.xml b/xep-0305.xml index f72d4189..44682723 100644 --- a/xep-0305.xml +++ b/xep-0305.xml @@ -9,8 +9,8 @@
Initial published version, incorporating improvements based on list discussion and removing the concept of stream management tickets.
Note: Various parts of this document might be moved to separate documents at some point.
In accordance with &rfc6120;, before attempting to establish a stream the initiating entity needs to determine the IP address and port at which to connect. Implementations SHOULD cache the results of DNS lookups in order to avoid this step whenever possible.
-XMPP clients SHOULD also cache whatever information they can, especially the roster (see &xep0237;) and &xep0030; information. Servers SHOULD support &xep0237; and SHOULD include &xep0115; data in stream features to facilitate such caching. (Caching of service discovery data also applies to server-to-server connections.)
+In accordance with &rfc6120;, before attempting to establish a stream the initiating entity needs to determine the IP address and port at which to connect, usually by means of DNS lookups as described in Section 3.2 of RFC 6120. Implementations SHOULD cache the results of DNS lookups in order to avoid this step whenever possible.
+XMPP applications SHOULD cache whatever information they can about the peer, especially stream features data and &xep0030; information. To facilitate such caching, servers SHOULD include &xep0115; data in stream features as shown in Section 6.3 of XEP-0115. Note that for maximum benefit the server MUST include all of the stream features it supports in its replies to "disco#info" queries (i.e., not advertise such features only during stream establishment).
+XMPP clients SHOULD cache roster information, and servers SHOULD make such caching possible, using &xep0237; as subsequently included in Section 2.1.1 of &rfc6121;.
One method of speeding the connection process is pipelining of requests, as in &rfc2920; and the QUICKSTART extension proposed for SMTP &smtpquickstart;. The application of similar principles to XMPP was originally suggested by Tony Finch in February 2008 <http://mail.jabber.org/pipermail/standards/2008-February/017966.html>..
-In essence, pipelining lets an initiating entity assume that the receiving entity supports the same (or almost the same) features it did on the previous connection attempt. As a result, the initiating entity can proactively send multiple XMPP-related "commands" in a single TCP packet, thus reducing the number of round trips.
-If an XMPP server supports pipelining, then it MUST advertise a stream feature of <pipelining xmlns='urn:xmpp:pipelining:0'/>.
-If both parties support pipelining, they can proceed as follows (the examples use the XML from the client-server stream establishment section of RFC 6120, although the same principles apply to server-to-server streams).
-One method of speeding the connection process is pipelining of requests, as in &rfc2920; and the QUICKSTART extension proposed for SMTP (&smtpquickstart;). The application of similar principles to XMPP was originally suggested by Tony Finch in February 2008 <http://mail.jabber.org/pipermail/standards/2008-February/017966.html>.
+In essence, pipelining relies on two assumptions:
+Together, these assumptions enable the parties to reduce the number of round trips needed to complete the stream negotiation process.
+If an XMPP server supports pipelining, it MUST advertise a stream feature of <pipelining xmlns='urn:xmpp:features:pipelining'/>.
+If both parties support pipelining, they can proceed as follows (the examples use the XML from Section 9.1 of RFC 6120 for the client-server stream establishment, but the same principles apply to server-to-server streams).
+In Step 1, the client assumes that the server supports the XMPP STARTTLS extension so it pipelines its initial stream header, the <starttls/> command, and the TLS ClientHello message.
+As can be seen, pipelining needs 10 steps to complete session establishment, as opposed to 16 steps for the non-pipelined process described in RFC 6120.
-Naturally, additional round trips are needed for XMPP clients to gather service discovery information, retrieve the roster, etc.
+In Step 2, the server pipelines its response stream header, stream features advertisement, STARTTLS <proceed/> response, and TLS ServerHello messages (which might include ServerHello, Certificate, ServerKeyExchange, CertificateRequest, and ServerHelloDone -- see &rfc5246; for details).
+In Step 3, the parties complete the TLS negotiation.
+In Step 4, the server knows that the client will need to restart the stream so it proactively attaches its response stream header and stream features after the TLS Finished message.
+In Step 5, the client pipelines its initial stream header with the command for initiating the SASL authentication process (including SASL "initial response" data as explained in Section 6.3.10 of RFC 6120 to reduce the number of round trips).
+At this point the client and server might exchange multiple SASL-related messages, depending on the SASL mechanism in use. This specification does not attempt to reduce the number of round trips involved in the challenge-response sequence.
+When the client suspects that it is sending its final SASL response, it SHOULD append an initial stream header and resource binding request.
+In Step 8, the server informs the client of SASL success (including "additional data with success" as explained in Section 6.3.10 of RFC 6120 to reduce the number of round trips), sends a response stream header and stream features, and informs the client of successful resource binding.
+The XMPP stream negotiation process in RFC 6120 required at least 19 round trips (including 4 for TLS negotiation). With pipelining, the number of round trips is reduced to 8.
+Naturally, for typical client-to-server sessions, additional round trips are needed so that the client can gather service discovery information, retrieve the roster, etc. As noted, these steps can be reduced or eliminated by using entity capabilities and roster versioning.
The pain of multiple round trips is magnified if the initiating entity needs to reconnect frequently (e.g., because of intermittent network outages). Although &xep0124; can be used to mitigate the pain, BOSH is not appropriate for all scenarios and is not currently used in others (e.g., server-to-server streams).
The minimize the speed of reconnection, implementations are strongly encouraged to support TLS Session Resumption (&rfc5077;) in addition to the technologies already mentioned.
-If &xep0198; is used, including support for stream resumption, the server can treat the stream management identifier as a "ticket" for stream resumption (similar to the use of a ticket for TLS session resumption). Here's how.
-First, if an XMPP server allows stream management IDs as stream resumption tickets, then it MUST advertise a stream feature of <tickets xmlns='urn:xmpp:sm:tickets:0'/>.
-During the stream management negotiation, the server will deliver a stream management ID for stream resumption.
-The server SHOULD do send an ID if TLS has already been negotiated, since the SM-ID might be used as a session resumption ticket.
-Now, when the client reconnects it includes the SM-ID in its opening stream header.
-If the server accepts the SM-ID as a ticket, it MUST echo the identifier in its response stream header.
-After the client and server negotiate TLS to protect the stream (preferably using TLS session resumption to reduce the number of round trip), the server SHOULD immediately allow the client to start sending stanzas and SHOULD also immediately send a new SM-ID to the client.
-Reconnection can be further enhanced by using the stream resumption feature described in &xep0198;. XEP-0198 does not legislate exactly when it is safe for the server to allow the client to send the <resume/> request. Clearly, sending it before the stream is encrypted would increase the possibility of replay attacks. However, sending it after TLS negotiation (Step 4 above) but before SASL authentication and resource binding (Steps 5 through 8) would enable the client to begin sending stanzas more quickly. It is a matter of server policy whether to advertise the SM feature after TLS negotiation or only after SASL negotiation.
A server MUST NOT treat a stream management identifier as a stream resumption ticket unless the original stream was protected by means of TLS.
-A server MUST time out a stream management identifier after a configurable amount of time (typically no more than a few minutes).
+To follow.
This document requires no interaction with &IANA;.
To follow.
+This specification defines the following XML namespace:
+Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespace to the registry located at &STREAMFEATURES;, as described in Section 4 of &xep0053;.
Special thanks to Tony Finch for suggesting this work and providing the initial outline of how pipelining would work. Thanks also to Kevin Smith for his early feedback.
+Special thanks to Tony Finch for suggesting this work and for providing the initial outline of how pipelining would work. Thanks also to Waqas Hussain, Jehan Pagès, and Kevin Smith for their feedback.