Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XEP-0060 (Publish-Subscribe) incorrect error response if requested item does not exist #2288

Closed
horazont opened this issue Feb 18, 2018 · 1 comment
Assignees

Comments

@horazont
Copy link

What version of ejabberd are you using?

18.01, 17.12 (docker images)

What operating system (version) are you using?

Linux.

How did you install ejabberd (source, package, distribution)?

Docker image from https://hub.docker.com/r/ejabberd/ecs/

What did not work as expected? Are there error messages in the log? What
was the unexpected behavior? What was the expected result?

I am doing a simple publish-purge-fetch test to ensure that my client implements it correctly. However, the response from ejabberd when I request the deleted item is incorrect. The item is created like this (XML pretty-printed for readability; C->S means client-to-server, S->C means server-to-client):

C->S: <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id="xMyBJuczLpKPJC7uy20oN" type="set">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <publish node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7">
      <item>
        <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test"/>
      </item>
    </publish>
  </pubsub>
</iq>
S->C: <iq xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" to="60507180122299296582535@localhost/58924481883205941432567" from="pubsub.localhost" type="result" id="xMyBJuczLpKPJC7uy20oN">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <publish node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7">
      <item id="5EEE93D7CFF78"/>
    </publish>
  </pubsub>
</iq>

Then the node is purged:

C->S: <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id="ximZnOPv6mSDMUwKaBOpm" type="set">
  <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
    <purge node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7"/>
  </pubsub>
</iq>
S->C: <iq xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" to="60507180122299296582535@localhost/58924481883205941432567" from="pubsub.localhost" type="result" id="ximZnOPv6mSDMUwKaBOpm"/>

And the item is requested to check that the purge has worked:

<iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id="xK9ZwK/GgGrYdy5LYV7no" type="get">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <items node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7">
      <item id="5EEE93D7CFF78"/>
    </items>
  </pubsub>
</iq>

Now ejabberd unexpectedly replies with an error:

S->C: <iq xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" to="60507180122299296582535@localhost/58924481883205941432567" from="pubsub.localhost" type="error" id="xK9ZwK/GgGrYdy5LYV7no">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <items node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7">
      <item id="5EEE93D7CFF78"/>
    </items>
  </pubsub>
  <error code="404" type="cancel">
    <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</iq>

Which is incorrect according to XEP-0060 §6.5.9.12:

If there are no items at the node or the requested items do not exist, the service SHOULD return an IQ stanza of type "result" with an empty <items/> element.

I would expect ejabberd to reply with an empty <items/> element as it does for a generic items query:

S->C: <iq xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" to="60507180122299296582535@localhost/58924481883205941432567" from="pubsub.localhost" type="result" id="xK9ZwK/GgGrYdy5LYV7no">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <items node="e66f63f6-6f28-4e11-bfb5-a82d628d80c7"/>
  </pubsub>
</iq>
@cromain cromain added this to the ejabberd 18.03 milestone Feb 19, 2018
cromain pushed a commit that referenced this issue Mar 16, 2018
@cromain cromain closed this as completed Mar 16, 2018
cromain pushed a commit that referenced this issue Mar 17, 2018
Moving get_item result control to keep item-not-found on transaction
error when node does not exists
@lock
Copy link

lock bot commented Jun 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants