Problems with xmpp over port 80

Hi,

i’'ve set up a server running over port 80 to get around some whacky cable modems using factory default settings. Some are blocking all but the regular ports(80/443 and so on) and using some kind of packet inspection to determine the application (or maybe use upnp for that) that opens the client socket.

So my solution was to configuere the content switch here to forward all requests on port 80 to port 5222 on the jabber server and connect with port 80. Works great but… there are some proxy’‘s messing up the connection. they are waiting (blocking) till they see a valid http header( the method part and at least the host header), so i’'ve added a fix to BlockingReadingMode.java.

Is this the way to go or does anyone havbe a better solution?

thnx

Bram

public void run() {

try {

InputStreamReader is = new InputStreamReader(ServerTrafficCounter.wrapInputStream(

socket.getInputStream()), CHARSET);

PushbackReader pbr = new PushbackReader(is, 3);

char[] buff = new char[3];

int i = pbr.read(buff);

if (i > -1 && “GET”.equals(new String(buff, 0, i))) {

//skip the stream until we get to “\n\n”

int c = pbr.read();

boolean first = false;

while (c > -1 && !(first && c == ‘’\n’’)) {

first = c == ‘’\n’’;

c = pbr.read();

}

} else {

//push the buffer back on the reader

pbr.unread(buff);

}

socketReader.reader.getXPPParser().setInput(pbr);

/code

Bram,

HTTP Binding sounds like it would be a good solution. JWChat ships with an HTTP Binding servlet that should work with Wildfire (we hope to test this more ourselves in the near future). What client are your users using? Does it support HTTP Binding?

Regards,

Matt

Hi,

xmpp supports HTTP-Binding so the clients could use it. I don’'t like the idea to parse every packet for “GET …\r\n\r\n” - actually “\r\n” is the right linefeed in a HTTP header.

which client does send a “GET…” if I may ask?

Anyhow this looks like a very simple xmpp/HTTP solution. Maybe you could set a flag for every connection which indicates whether it’‘s new, a normal one or GET is expected, so you don’'t need to check this every time.

If you do also define that the header has to have a fixed size (eg. 40 bytes) and must be sent in one packet you could make this even simpler by dropping the first 40 bytes for every “GET…”-connection.

LG

well, its a client/server fix to get around all kinds of weird asdl modems/cable modems and what not. after some testing today the peeps that could not connect earlier can connect now.

im using xiff with a little tweak to send out the http header on the client side, but what ive noticed the problem is basicly gateway’‘s proxy’'s firewalls that dont let out anything but http on port 80 and block most of the other ports.

HTTP binding could be nice for some web based “temp” clients, but on the long run i am more interrested in a tech that can scale and have minimal latency, the polling basicly kills the server. xmpp over udp would be nice and im thinking of writing an AMF (for flash) gateway.

Ill look into it to see if i can get it out of the run loop and in a kind of header parser.

Hello

Let me clear my problem path.

I am using JBother 0.8.9.

I am in LAN and Proxy type is HTTP.

My server is very far from my LAN and there is no any proxy at my server side. It is alone.

So my problem is to cross the proxy of my LAN. So I doesn’'t need proxy at my server wildfire side.

JBother 0.8.9 has proxy settings and according to that I fill all settings in JBotrher 0.8.9 BUT I think JBother 0.8.9 has coding only for SOCKS protocol at proxy side.

I try to understand JWChat concept but I find it very different from my problem because it is web based. So I think JWChat will not help me.

I repeate this things again because may be someone has solution of my problem.

Thanks

Pathik

Hi Pathik,

you may want to read JEP-0124 - it may be much more easy to understand than JWChat. You can use together with Wildfire (on the server side) JHB.

On the client side you need to code the HTTP POST requests, so this work will be very similar to the work you currently want to do.

LG

PS: Example 1. Requesting an HTTP session

POST /webclient HTTP/1.1
Host: httpcm.jabber.org
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
Content-Length: 104 <body content=''text/xml; charset=utf-8''
      hold=''1''
      rid=''1573741820''
      to=''jabber.org''
      route=''xmpp:jabber.org:9999''
      secure=''true''
      wait=''60''
      xml:lang=''en''
      xmlns=''http://jabber.org/protocol/httpbind''/>