Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Possible bad implementation of XEP protocol
Avatar
mph11 #1
Member since Nov 2011 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: BOSH Connection and OpenFire problem
Hi, I am using agsXMPP for connecting to an OpenFire XMPP server using its HTTP bind feature. I had to do some trial and error with XmppClientConnection constructor and properties but finally I was able to have things work together. My application works flawlessly using BOSH just like when it is using standard TCP connection but there is a problem.

After exchanging some messages, I get WebException of 404. The exception is thrown in totally random occasion. Using a proxy server I managed to capture what is causing this.

After connection is completely established, at some point OpenFire responds with this body:
<body xmlns="http://jabber.org/protocol/httpbind" type="terminate" condition="policy-violation" />


First Bug is that agsXMPP does not interpret (actually ignores) this respond and continues to send remaining requests, and because of this OpenFire returns a 404 HTTP with the following header as soon as the next request is sent:
Responce Code: 404 Invalid SID.

which obviously indicates that BOSH session was terminated after that "policy-violation" was sent and that current SID is no longer valid. I could try to add the code for interpreting the "policy-violation" body but this will not solve my problem.


Maybe 'bug reports' section is not the right place but I wonder if it is a known issue with OpenFire, Is HTTP bind really supposed to work with BOSH connection or not?

I checked "XEP-0124: Bidirectional-streams Over Synchronous HTTP (BOSH)" here:
http://xmpp.org/extensions/xep-0124.html
My guess is that "policy-violation" errors I get is due to 'overactivity' condition stated in XEP but I don't see more than two simultaneous requests and OpenFire always returns '2' as "requests" attribute in response to BOSH Session request.



Is this a XEP implementation error in agsXMPP side? Or OpenFire is to be blamed?

P.S: I'm using BoshClientConnection.cs code from SVN.
P.S 2: Sorry for my bad english.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by mph11 on 2011-11-12, 11:38:
1321097923

this is a missing feature in agsXMPP. It does not evaluate the HTTP status codes. MatriX supports this feature and has a much better BOSH implementation.

Alex
Avatar
mph11 #3
Member since Nov 2011 · 2 posts
Group memberships: Members
Show profile · Link to this post
Hi, Alex.
Thank you very much for the reply.

What about that 'terminate' body which is sent in a OK response right before the response with 404 code?

If BoshClientSocket could parse it, it would detect that BOSH session is terminated. Then calling TerminateBoshSession function for example would notify XmppConnection to change connection status, and so avoid sending more requests with invalid SID.

And for the main problem, any idea why OpenFire sends that 'policy-violation' error in the first place?

I tried to find a temporary solution by putting a Thread.Sleep call here in the code of BoshClientSocket.cs:
        private void Request()
        {
            if (activeRequests < 2)
            {
                if (activeRequests == 1)
                    Thread.Sleep(200);
                StartWebRequest();
            }
        }
This will reduce the probability of receiving that 'policy-violation' error. That is why I am guessing the problem is somehow related to BOSH protocol and over-activity.

But this is not a good solution and I don't think it will completely solve the problem. Do you think if there is a better solution?
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have committed a patch to BoshClientSocket.cs which should check if the server terminates the session now and then calls TerminateBoshSession().

Can you check if the patch helps you? But I think this does not solve the root of your problem. The question is why Openfire terminates the session and which policy is violated.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS