git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@317 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2007-01-10 03:39:25 +00:00
parent 486cf73e70
commit 8fc5fedf05
1 changed files with 93 additions and 96 deletions

View File

@ -20,6 +20,12 @@
<supersededby>None</supersededby>
<shortname>N/A</shortname>
&stpeter;
<revision>
<version>0.3</version>
<date>2007-01-09</date>
<initials>psa</initials>
<remark><p>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.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2007-01-02</date>
@ -52,32 +58,27 @@
</section1>
<section1 topic='Unbinding a Resource' anchor='unbind'>
<p>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 &lt;unbind/&gt; qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace, which in turn has a child element of &lt;resource/&gt; whose XML character data specifies the resource to be unbound:</p>
<example caption='Unbind'><![CDATA[
<iq type='set' id='bind_2'>
<code><![CDATA[
<iq from='someid@domain.tld/someresource' type='set' id='bind_2'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>someresource</resource>
</unbind>
</iq>
]]></example>
<p>If the server does not understand the &lt;unbind/&gt; element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of &notfound;. When the client unbinds the only resource associated with the stream, the server SHOULD close the stream and terminate the TCP connection.</p>
]]></code>
<p>If the server does not understand the &lt;unbind/&gt; element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of &notfound;. 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.</p>
<p>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:</p>
<example caption='Unbind Stream Feature'><![CDATA[
<code><![CDATA[
<stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<required/>
</bind>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</stream:features>
]]></example>
]]></code>
</section1>
<section1 topic='Business Rules' anchor='bizrules'>
<section2 topic='From Addresses' anchor='from'>
<p>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:</p>
<ol>
<li>Stamp the stanza with the resource that the server considers to be the "default resource" for the stream. <note>The default resource SHOULD be the oldest resource bound to the stream, which typically will be the initial resource but which might be a resource bound later if subsequently the initial resource has been unbound.</note></li>
<li>Return the stanza to the client with an &lt;unknown-sender/&gt; stanza error. <note>Currently there is no &lt;unknown-sender/&gt; stanza defined in <cite>RFC 3920</cite>; the author will work to add such an error condition to <cite>rfc3920bis</cite>.</note></li>
</ol>
<p>Which of these a server does is up to the implementation or deployment.</p>
<p>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 &lt;unknown-sender/&gt; stanza error. <note>Currently there is no &lt;unknown-sender/&gt; stanza defined in <cite>RFC 3920</cite>. The author will work to add such an error condition (with a type of "modify") to <cite>rfc3920bis</cite>.</note></p>
<p>Naturally, the existing rules from <cite>RFC 3920</cite> regarding validation of asserted 'from' addresses still apply.</p>
</section2>
<section2 topic='Server Sessions' anchor='sessions'>
@ -89,127 +90,123 @@
</section2>
</section1>
<section1 topic='Examples' anchor='examples'>
<p>The following examples show a possible flow of resource binding and unbinding.</p>
<p>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).</p>
<p>First, the client binds an initial resource to the stream.</p>
<example caption='Binding an Initial Resource'><![CDATA[
<iq type='set' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</bind>
</iq>
C: <iq from='juliet@capulet.com/core' type='set' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</bind>
</iq>
<iq type='result' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/core</jid>
</bind>
</iq>
S: <iq to='juliet@capulet.com/core' type='result' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/core</jid>
</bind>
</iq>
]]></example>
<p>Now the client sends some stanzas, making sure to set its 'from' address:</p>
<example caption='Sending Some Stanzas'><![CDATA[
<iq from='juliet@capulet.com/core' type='get' id='roster-1'>
<query xmlns='jabber:iq:roster'/>
</iq>
C: <iq from='juliet@capulet.com/core' type='get' id='roster-1'>
<query xmlns='jabber:iq:roster'/>
</iq>
<iq to='juliet@capulet.com/core' type='result' id='roster-1'>
<query xmlns='jabber:iq:roster'>
<item jid='romeo@montague.net'/>
</query>
</iq>
C: <iq to='juliet@capulet.com/core' type='result' id='roster-1'>
<query xmlns='jabber:iq:roster'>
<item jid='romeo@montague.net'/>
</query>
</iq>
<presence from='juliet@capulet.com/core'/>
C: <presence from='juliet@capulet.com/core'/>
]]></example>
<p>Now the client binds a second resource to the stream.</p>
<example caption='Binding a Second Resource'><![CDATA[
<iq type='set' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
C: <iq from='juliet@capulet.com/balcony' type='set' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
<iq type='result' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/balcony</jid>
</bind>
</iq>
S: <iq to='juliet@capulet.com/balcony' type='result' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/balcony</jid>
</bind>
</iq>
]]></example>
<p>If the server does not allow entities to bind multiple resources to the stream, it MUST return a &notallowed; error as described in <cite>RFC 3920</cite>.</p>
<p>Now the client sends more stanzas.</p>
<example caption='Sending More Stanzas'><![CDATA[
<iq from='juliet@capulet.com/balcony' type='get' id='roster-2'>
<query xmlns='jabber:iq:roster'/>
</iq>
C: <iq from='juliet@capulet.com/balcony' type='get' id='roster-2'>
<query xmlns='jabber:iq:roster'/>
</iq>
<iq to='juliet@capulet.com/balcony' type='result' id='roster-2'>
<query xmlns='jabber:iq:roster'>
<item jid='romeo@montague.net'/>
</query>
</iq>
C: <iq to='juliet@capulet.com/balcony' type='result' id='roster-2'>
<query xmlns='jabber:iq:roster'>
<item jid='romeo@montague.net'/>
</query>
</iq>
<presence from='juliet@capulet.com/balcony'/>
C: <presence from='juliet@capulet.com/balcony'/>
<message to='romeo@montague.net'>
<body>Wherefore art thou?</body>
</message>
C: <message to='romeo@montague.net'>
<body>Wherefore art thou?</body>
</message>
S: <message type='error'>
<body>Wherefore art thou?</body>
<error type='modify'>
<unknown-sender xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
]]></example>
<p>In handling the last stanza shown above, the server will either return a &lt;unknown-sender/&gt; error or stamped the 'from' address &lt;juliet@capulet.com/core&gt; (but in no case will the server stamp the 'from' address as &lt;juliet@capulet.com/balcony&gt;. Here we assume that the server stamps the 'from' address.</p>
<p>In handling the last stanza shown above, the server returns an &lt;unknown-sender/&gt; error to the sender because the sender did not include a 'from' address.</p>
<p>Now the client binds a third resource to the stream.</p>
<example caption='Binding a Third Resource'><![CDATA[
<iq type='set' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</bind>
</iq>
C: <iq from='juliet@capulet.com/softphone' type='set' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</bind>
</iq>
<iq type='result' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/softphone</jid>
</bind>
</iq>
S: <iq to='juliet@capulet.com/softphone' type='result' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>juliet@capulet.com/softphone</jid>
</bind>
</iq>
]]></example>
<p>Now the client unbinds its initial resource.</p>
<example caption='Unbinding a Resource'><![CDATA[
<iq type='set' id='unbind-1'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</unbind>
</iq>
C: <iq from='juliet@capulet.com/core' type='set' id='unbind-1'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</unbind>
</iq>
<iq type='result' id='unbind-1'/>
]]></example>
<p>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):</p>
<example caption='Client Generates Another Stanza'><![CDATA[
<message to='romeo@montague.net'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
]]></example>
<example caption='Server Stamps Stanza As From (New) Default Resource'><![CDATA[
<message from='juliet@capulet.com/balcony' to='romeo@montague.net'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
S: <iq from='juliet@capulet.com/core' type='result' id='unbind-1'/>
]]></example>
<p>Now the client unbinds another resource.</p>
<example caption='Unbinding a Resource'><![CDATA[
<iq type='set' id='unbind-2'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</unbind>
</iq>
C: <iq from='juliet@capulet.com/softphone' type='set' id='unbind-2'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</unbind>
</iq>
<iq type='result' id='unbind-2'/>
S: <iq to='juliet@capulet.com/softphone' type='result' id='unbind-2'/>
]]></example>
<p>Now the client unbinds its last remaining resource.</p>
<example caption='Unbinding the Final Resource'><![CDATA[
<iq type='set' id='unbind-3'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</unbind>
</iq>
C: <iq from='juliet@capulet.com/balcony' type='set' id='unbind-3'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</unbind>
</iq>
<iq type='result' id='unbind-3'/>
S: <iq to='juliet@capulet.com/balcony' type='result' id='unbind-3'/>
]]></example>
<p>The server now SHOULD close the stream and terminate the underlying TCP connection.</p>
<example caption='Server Closes the Stream'><![CDATA[
</stream:stream>
S: </stream:stream>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
@ -219,7 +216,7 @@
<p>No interaction with &IANA; is required as a result of this document.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>No interaction with the &REGISTRAR; is required as a result of this document.</p>
<p>No interaction with the &REGISTRAR; is required as a result of this document, since the 'urn:ietf:params:xml:ns:xmpp-bind' namespace is already registered (see &NAMESPACES;).</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>Note: The following provisional schema is intended to replace the existing schema for the Resource Binding stream feature.</p>