[PATCH] compliance with section 9.2.3 of RFC 3920 (IQ Semantics)

Pedro Melo melo at simplicidade.org
Thu Jan 18 00:45:32 UTC 2007


Hi,

On Jan 17, 2007, at 4:32 PM, Peter Saint-Andre wrote:

> Pedro Melo wrote:
>> On Jan 16, 2007, at 8:56 PM, Peter Saint-Andre wrote:
>>> Pedro Melo wrote:
>>>> On Jan 13, 2007, at 12:50 PM, Martin Atkins wrote:
>>>>> Pedro Melo wrote:
>>>>>> See http://rfc.net/rfc3920.html#s9. for reference, search for  
>>>>>> 9.2.3.
>>>>>> Basically, to match an IQ with a semantic meaning, we must  
>>>>>> look at the namespace and not at the tag the first child is  
>>>>>> using. The relevant text of the RFC:
>>>>>>   "The data content of the request and response is defined by  
>>>>>> the namespace
>>>>>>    declaration of a direct child element of the IQ element"
>>>>>> That means for example, that as long as I use xmlns='vcard- 
>>>>>> temp' in the first child, the tag name can be vCard, query, or  
>>>>>> even sometagnobodyneedstoknow.
>>>>>> The attached patch fixes the signature method of the IQ class,  
>>>>>> and changes all the occurences of a set/get-{ns}tag I could find.
>>>>>
>>>>> Hmm.
>>>>>
>>>>> While I agree with you that the XMPP RFC section you referenced  
>>>>> gives the impression that the element's local name is to be  
>>>>> disregarded, I'm not convinced that this was the intention.
>>>> Well, when we question the intention, the better way to solve it  
>>>> is to question the author :)
>>>> Peter, can you weight in on this? When matching IQ's, should we  
>>>> just use the namespace or is the node name also relevant?
>>>
>>> The primary identifier is the namespace, by which we really mean  
>>> the schema associated with the namespace. Naturally there may be  
>>> different elements qualified by that namespace, which have  
>>> different semantics, so IMHO it is probably most accurate to say:
>>>
>>>   The data content of the request and response is defined by the
>>>   schema or other structural definition associated with the XML
>>>   namespace that qualifies the direct child element of the IQ
>>>   element.
>> Ah, ok. So if someone for example sends:
>> <iq type="get" id="1" to="melo at simplicidade.org">
>>   <query xmlns="vcard-temp" />
>> </iq>
>> the server should return not found, then? Because the vcard-temp  
>> schema would say <vCard> must be used?
>
> Well, it depends on how much you believe in Postel's Law -- be  
> conservative in what you send and liberal in what you accept. :)

So if a server does not respond to <query xmlns="vcard-temp"> they  
are respecting the spec, although being strict in what they accept.

My view was always:

  - match request using the xmlns attribute only;
  - reply using the same node name as the request used.

But I guess that the spec does not mandate this, so I'll retract my  
patch.

Thanks Peter, Martin,

PS: peter, I didn't see any of your messages in the list...
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
Jabber ID: melo at simplicidade.org
Use Jabber!




More information about the Djabberd mailing list