twonds / punjab

BOSH connection manager
MIT License
183 stars 49 forks source link

Punjab behind a proxy #34

Closed thynquest closed 11 years ago

thynquest commented 11 years ago

Hello,

I'm a web developer, and I my company wants me to develop a chat client. since they have google accounts (like john.doe@mycompany.com), I wanted to set up a bosh connector using punjab, in order to connect to google talk services.

The problem is, I'm behind a proxy (like 192.5.6.7 on port 1234) and when I run punjab, I can see in its logs that he tries to make a srv lookup but with no success (remote-connection-failed). I tried also to disable the lookup by adding the line "connect_srv = false" in the punjab.tac file, so he can make a direct connection to the google talk service but with no success. but when I use the Google talk instant messaging client, it is possible to indicate the proxy so it can connect to the google talk services throught the proxy.

So I would like to know if there is a way to tell punjab that it needs to go throught the company proxy in order to connect to the google talk services.

Thank you for your help

twonds commented 11 years ago

You can use the route attribute when creating the BOSH session.

http://xmpp.org/extensions/xep-0124.html#session-request

thynquest commented 11 years ago

Thank you for your answer

I did and this is what I Have in the body

(192.5.6.7:8080 is the company server proxy I need to pass through to access to google talk services)

and I still receive a "remote-connection-failed .. 400 bad request .. Request could not be handled" message from punjab.. however we need to be authenticated on the server proxy, so I'm wondering if I have to give my login and password .. if so How can I do that ? .. Thank you.

thynquest commented 11 years ago

Sorry .. my bad

I did and this is what I Have in the body

body rid='3810471748' xmlns='http://jabber.org/protocol/httpbind' to='gmail.com' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh' route='xmpp:192.5.6.7:8080' (this is the server proxy I need to pass through to access to the google talk services)

I still receive a "remote-connection-failed" message from punjab. However, we need to be authenticated on the server proxy to pass through, so I'm wondering if I need to tell punjab to use my login and password.. if so how can I do that

Thank you for your help

thynquest commented 11 years ago

I would like to add a precision .. after reading the xep-0124 specifications, I don't think that the route attribute is designed to indicate a server proxy when we initiate a session. the route attibute is recommended if we have to enable sessions with different xmpp servers. in this case, from the client view, the bosh connection manager is the proxy to which we have to precise which xmpp server (and not the proxy server) we want to connect to using the route attribute.

twonds commented 11 years ago

Sorry, I confused this issue with something else. I mentioned using the route attribute so you can by pass the failed srv lookup for the xmpp server. What kind of proxy is your company proxy? You will need to be able to make a direct xmpp connection from punjab. Or the proxy will have to know how to send the xmpp to google. Punjab is usually the proxy.

thynquest commented 11 years ago

Ok .. actually my company has a web proxy so when we want to go to the web using a browser our connection passes throught that server proxy. concerning a direct xmpp connexion, I've already tried that with the "connect_srv = false" line in the punjab.tac with no success. Or may be a solution would be to configure the proxy when I create the xmpp client and send that information to punjab, hoping that it will understand. that remains to be done ..may be using Strophe.js

Any Idea ?

thynquest commented 11 years ago

Ok .. I've found a Xmpp library called "agsXmpp" which support http proxy support.. however, when I set the proxy server on my xmpp client , punjab doesn't seem to take it into account when it tries to make a direct xmpp connection to google talk