GNOME Bugzilla – Bug 128358
Unknown iq's are silently ignored
Last modified: 2005-07-11 16:25:57 UTC
When gossip receives iq's with a child that it doesn't recognise, it silently drops them. Instead gossip should always reply to iq's. In this case return an iq of type error to let the other party know that it doesn't support the feature.
More precisely, XMPP IM says : 2.4. Extended Namespaces [...] Support for any given extended namespace is OPTIONAL on the part of any implementation (aside from the extended namespaces defined herein). If an entity does not understand such a namespace, the entity's expected behavior depends on whether the entity is (1) the recipient or (2) an entity that is routing the stanza to the recipient: Recipient: If a recipient receives a stanza that contains a child element it does not understand, it SHOULD ignore that specific XML data, i.e., it SHOULD not process it or present it to a user or associated application (if any). In particular: * If an entity receives a message or presence stanza that contains XML data qualified by a namespace it does not understand, the portion of the stanza that is in the unknown namespace SHOULD be ignored. * If an entity receives a message stanza whose only child element is qualified by a namespace it does not understand, it MUST ignore the entire stanza. * If an entity receives an IQ stanza of type "get" or "set" containing a child element qualified by a namespace it does not understand, the entity SHOULD return an IQ stanza of type "error" with an error condition of <service-unavailable/>.
I think I am reading the spec right, but now if the jabber:iq:something namespace is unrecognised, it will return: <iq type="error" to="someone@jabber.org" id="msg_16"> <query xmlns="jabber:iq:last"></query> <error type="cancel"> <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></service-unavailable> </error> </iq> Correct me if this is wrong.
For completeness, an <iq type="get"/> or <iq type="set"/> can only have one child element. If the namespace of that element is unknown, than you must return the service-unavailable error. I would recommend that you also send along the legacy error code 503. I don't know why you don't use empty elements, but a resulting packet would look like: <iq type="error" to="client@example.org/resource" id="msg_16"> <query xmlns="jabber:iq:last"/> <error type="cancel" code="503"> <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> </error> </iq> Note that it is forbidden to return anything when receiving result or error type iq's, even if the namespace is unknown.
OK, I will add the 503 code in for legacy support. As for the empty elements, this is down to Loudmouth. Currently this is ONLY sent in response to a GET or SET IQ as per the spec ;)