Closed artyomb closed 10 years ago
I solve this problem. It's because Vines send 2 responses for one request
[2014-04-08T15:42:19Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38713
<iq id="k0305-5263" type="result">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>alice@local.lit/fc6bdcbc-5748-49bb-aa44-77a813030ca0</jid>
</bind>
</iq>
[2014-04-08T15:42:19Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38713
<stream:features/>
And android capture only last <stream:features/>
and start thinking i am not authorized ...
https://github.com/negativecode/vines/blob/master/lib/vines/stream/client/bind.rb#L30
The final, empty <stream:features/>
is sent to the client to signal that stream negotiation is complete and the client is allowed to send messages to the server. Section 4.3.5 of RFC 6120 specifies this behavior. There's also a flow chart describing the negotiation steps.
I'm closing this because it looks like the client is missing this piece of the XMPP protocol implementation.
Hmm, is it necessary? ChatSecure works with ejabberd along with google&facebook. So I guess there is a way to behave the same way?
Ok. I just have tested to comment #send_empty_features https://github.com/negativecode/vines/blob/master/lib/vines/stream/client/bind.rb#L30. But it still unable to connect. ChatSecure waits after receiving
[2014-04-08T19:57:57Z] DEBUG -- vines: Received stanza: 192.168.1.2:38916 -> 192.168.1.6:5222
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" to="local.lit" version="1.0"/>
[2014-04-08T19:57:57Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38916
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' id='401a245b-21e5-4ef9-999b-bc485fc1134d' from='local.lit' version='1.0'>
[2014-04-08T19:57:57Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38916
<stream:features>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
</stream:features>
[2014-04-08T19:57:57Z] DEBUG -- vines: Received stanza: 192.168.1.2:38916 -> 192.168.1.6:5222
<iq id="k0305-5795" type="set">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>ChatSecure</resource>
</bind>
</iq>
[2014-04-08T19:57:57Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38916
<iq id="k0305-5795" type="result">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>alice@local.lit/ChatSecure</jid>
</bind>
</iq>
I found the reason. ChatSecure connects only if the bind reply features include session.
<stream:features> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
while Pidgin connects anyway. The Vines server doen't send 'session'.
Link ChatSecure issue https://dev.guardianproject.info/issues/3229 Link Pidgin issue https://developer.pidgin.im/ticket/12926
The session feature is a deprecated part of the original RFC 3921 Section 3. That section, and corresponding session establishment behavior, was removed from RFC 6121 that superseded 3921.
It used to read:
If a server supports sessions, it MUST include a
element qualified by the 'urn:ietf:params:xml:ns:xmpp-session' namespace in the stream features it advertises to a client after the completion of stream authentication as defined in [XMPP-CORE]:
Vines doesn't advertise the old session stream feature. However, the server will reply to the following session establishment stanza sent by a client.
<iq id="42" type="set">
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>
Some old clients–Adium, I think–always send this stanza without checking for the session establishment stream feature. So, the server just sends a reply stanza without doing anything to the state of the stream on the server side.
Sending stream features after resource binding? That's wrong. You only send stream features after a stream restart, which there isn't after resource binding.
But ejabberd sends. And it allows some clients to work (e.g. ChatCecure ). So I guess it's better send that don't.
ejabberd sends what?
<stream:features> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
I wasn't talking about the session feature, I was talking about
[2014-04-08T15:42:19Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38713
<iq id="k0305-5263" type="result">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>alice@local.lit/fc6bdcbc-5748-49bb-aa44-77a813030ca0</jid>
</bind>
</iq>
[2014-04-08T15:42:19Z] DEBUG -- vines: Sent stanza: 192.168.1.6:5222 -> 192.168.1.2:38713
<stream:features/>
I have never seen anything do that before. The RFC doesn't seem to explicitly forbid that, but it only ever says that you send stream features directly after a restart.
Vines server running with default config. Pidgin connects normaly. But SecureChat shows "Signing in ..." and doesnt connect