Per Council feedback, modified error handling when client does not include a from address; also, clarified rules regarding which full JID to include on bind and unbind requests.
In order to properly manage the resources associated with an XML stream, a client must be able to unbind resources. This shall be completed by sending an IQ-set with a child element of <unbind/> qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace, which in turn has a child element of <resource/> whose XML character data specifies the resource to be unbound:
-
someresource
- ]]>
If the server does not understand the <unbind/> element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of ¬found;. When the client unbinds the only resource associated with the stream, the server SHOULD close the stream and terminate the TCP connection.
+ ]]> +If the server does not understand the <unbind/> element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of ¬found;. When the client unbinds the only resource associated with the stream, the server SHOULD close the stream and terminate the TCP connection. The 'from' address included in bind and unbind stanzas SHOULD be the full JID (&FULLJID;) associated with the resource in question; however, the server MUST NOT accept further stanzas from that full JID after successfully processing the unbind request.
A server SHOULD advertise its support for the 'urn:ietf:params:xml:ns:xmpp-bind' namespace and the unbind functionality by returning an appropriate stream feature as shown below:
-When a client binds multiple resources to the same stream, proper management of 'from' addresses is imperative. In particular, a client MUST specify a 'from' address on every stanza it sends over a stream to which it has bound multiple resources. If a client does not specify a 'from' address on a stanza it sends over a stream to which it has bound multiple resources (or if it specifies as the 'from' address a full JID other than one of the bound resources), the server MUST do one of the following:
-Which of these a server does is up to the implementation or deployment.
+When a client binds multiple resources to the same stream, proper management of 'from' addresses is imperative. In particular, a client MUST specify a 'from' address on every stanza it sends over a stream to which it has bound multiple resources, where the 'from' address is the full JID (&FULLJID;) associated with the relevant resource. If a client does not specify a 'from' address on a stanza it sends over a stream to which it has bound multiple resources (or if it specifies as the 'from' address a full JID other than one of the bound resources), the server MUST return the stanza to the client with an <unknown-sender/> stanza error.
Naturally, the existing rules from RFC 3920 regarding validation of asserted 'from' addresses still apply.
The following examples show a possible flow of resource binding and unbinding.
+The following examples show a possible flow of resource binding and unbinding (stanzas prefixed by "C:" are sent by the client, stanzas prefixed by "S:" are sent by the server).
First, the client binds an initial resource to the stream.
Now the client sends some stanzas, making sure to set its 'from' address:
Now the client binds a second resource to the stream.
If the server does not allow entities to bind multiple resources to the stream, it MUST return a ¬allowed; error as described in RFC 3920.
Now the client sends more stanzas.
In handling the last stanza shown above, the server will either return a <unknown-sender/> error or stamped the 'from' address <juliet@capulet.com/core> (but in no case will the server stamp the 'from' address as <juliet@capulet.com/balcony>. Here we assume that the server stamps the 'from' address.
+In handling the last stanza shown above, the server returns an <unknown-sender/> error to the sender because the sender did not include a 'from' address.
Now the client binds a third resource to the stream.
Now the client unbinds its initial resource.
Now the client sends another stanza without a 'from' address, which we assume the server stamps as from the new default resource (note that this is no longer the initial resource):
-Now the client unbinds another resource.
Now the client unbinds its last remaining resource.
The server now SHOULD close the stream and terminate the underlying TCP connection.
No interaction with &IANA; is required as a result of this document.
No interaction with the ®ISTRAR; is required as a result of this document.
+No interaction with the ®ISTRAR; is required as a result of this document, since the 'urn:ietf:params:xml:ns:xmpp-bind' namespace is already registered (see &NAMESPACES;).
Note: The following provisional schema is intended to replace the existing schema for the Resource Binding stream feature.