Using Strophe.
js to initiate a connection.
Running punjab on Windows 7 64-bit, using python 2.7 64-bit and installed other dependencies (win32 api as well).
Added proxy to apache server
(in httpd.conf)
Code:
ProxyPass /bosh http://localhost:5280/http-bind
ProxyPassReverse /bosh http://localhost:5280/http-bind
Calling
http://localhost/bosh in browser returns XEP-0124 - BOSH.
When connecting to
http://bosh.metajack.im:5280/xmpp-httpbind, it works both using the url and the proxy.
Code:
ProxyPass /bosh http://bosh.metajack.im:5280/xmpp-httpbind
ProxyPassReverse /bosh http://bosh.metajack.im:5280/xmpp-httpbind
Initialization of punjab:
Code:
2013-01-08 22:35:44+0530 [-] Log opened.
2013-01-08 22:35:44+0530 [-] twistd 12.3.0 (C:\Python27\python.exe 2.7.3) starti
ng up.
2013-01-08 22:35:44+0530 [-] reactor class: twisted.internet.selectreactor.Selec
tReactor.
2013-01-08 22:35:44+0530 [-] Site starting on 5280
2013-01-08 22:35:44+0530 [-] Starting factory at 0x032306C0>
Connecting using strophe:
Code:
2013-01-08 22:36:22+0530 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [08/Jan/2013:17
:06:21 +0000] "GET /http-bind HTTP/1.1" 200 170 "-" "Mozilla/5.0 (Windows NT 6.1
; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0"
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] HEADERS 1357664790.65:
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] ctHeaders object at 0x02EADFD0>
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] HTTPB POST :
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] 'http://jabber.org/protocol/httpbind' to='jabber.org' xml:lang='en' wait='60' ho
ld='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp
='urn:xmpp:xbosh'/>
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] Session Created : 2fc05a71502
bb9b0e74d709f9dba1deaf8b3f64d 1357664790.67
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] =============================
===== 1357664790.67 connect to jabber.org:5222 =================================
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] Starting factory ion.Session object at 0x0323D310>
2013-01-08 22:36:30+0530 [HTTPChannel,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1394, i
n dataReceived
finishCallback(data[contentLength:])
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1623, i
n finishRequestBody
self.allContentReceived()
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1686, i
n allContentReceived
req.requestReceived(command, path, version)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 790, in
requestReceived
self.process()
--- (exception caught here) ---
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 192,
in process
self.render(resrc)
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 241,
in render
body = resrc.render(self)
File "C:\Python27\lib\site-packages\twisted\web\resource.py", line 250
, in render
return m(request)
File "D:\punjab-master\punjab\httpb.py", line 4
12, in render_POST
s, d = self.service.startSession(body_tag, xmpp_elements)
File "D:\punjab-master\punjab\httpb.py", line 6
70, in startSession
return self.make_session(self, body.attributes)
File "D:\punjab-master\punjab\session.py", line
79, in make_session
connector.connect()
File "C:\Python27\lib\site-packages\twisted\names\srvconnect.py", line
78, in connect
self.domain))
File "C:\Python27\lib\site-packages\twisted\names\client.py", line 795
, in lookupService
return getResolver().lookupService(name, timeout)
File "C:\Python27\lib\site-packages\twisted\names\common.py", line 171
, in lookupService
return self._lookup(name, dns.IN, dns.SRV, timeout)
File "C:\Python27\lib\site-packages\twisted\names\resolve.py", line 44
, in _lookup
q = dns.Query(name, type, cls)
File "C:\Python27\lib\site-packages\twisted\names\dns.py", line 484, i
n __init_
self.name = Name(name)
File "C:\Python27\lib\site-packages\twisted\names\dns.py", line 357, i
n init
raise TypeError("%r is not a byte string" % (name,))
exceptions.TypeError: u'_xmpp-client._tcp.jabber.org' is not a byte stri
ng
I searched on the net, and it seemed like DNS problems...I added the following line in punjab.tac
Code:
bosh.connect_srv = False
Now, the call goes on forever, and I'm stuck with connecting (Stage 1) in the chat app.
Code:
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] HEADERS 1357710733.45:
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] <twisted.web.http_headers._Di
ctHeaders object at 0x02EED970>
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] HTTPB POST :
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] <body rid='3902853888' xmlns=
'http://jabber.org/protocol/httpbind' to='jabber.org' xml:lang='en' wait='60' ho
ld='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp
='urn:xmpp:xbosh'/>
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] Session Created : 7460877cc60
8b8f46282116a86daefb19b05dd25 1357710733.46
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] =============================
===== 1357710733.46 connect to jabber.org:5222 =================================
=
2013-01-09 11:22:13+0530 [HTTPChannel,0,127.0.0.1] Starting factory <punjab.sess
ion.Session object at 0x02EFD050>
2013-01-09 11:22:13+0530 [Uninitialized] SID: 7460877cc608b8f46282116a86daefb19b
05dd25 => SEND: "<stream:stream xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client' to='jabber.org' version='1.0'>"
2013-01-09 11:22:18+0530 [XmlStream,client] SID: 7460877cc608b8f46282116a86daefb
19b05dd25 => RECV: "<?xml version='1.0'?><stream:stream xmlns='jabber:client' xm
lns:stream='http://etherx.jabber.org/streams' from='jabber.org' id='c5409da5bae0
22ef' version='1.0'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmp
p-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>CRAM-MD5
</mechanism><mechanism>LOGIN</mechanism><mechanism>PLAIN</mechanism><mechanism>D
IGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><compression
xmlns='http://jabber.org/features/compress'><method>zlib</method></compression>
<ver xmlns='urn:xmpp:features:rosterver'><optional/></ver></stream:features>"
2013-01-09 11:22:18+0530 [XmlStream,client] Wait until starttls is completed.
2013-01-09 11:22:18+0530 [XmlStream,client] [<twisted.words.protocols.jabber.xml
stream.TLSInitiatingInitializer object at 0x02EFD5D0>]
2013-01-09 11:22:43+0530 [-] ================================== 7460877cc608b8f4
6282116a86daefb19b05dd25 1357710763.34 startup timeout =========================
=========
2013-01-09 11:22:43+0530 [-]
RETURN HTTPB 1357710763.34:
2013-01-09 11:22:43+0530 [-] <body xmlns='http://jabber.org/protocol/httpbind' i
nactivity='60' secure='true' authid='c5409da5bae022ef' content='text/xml; charse
t=utf-8' window='3' polling='15' sid='7460877cc608b8f46282116a86daefb19b05dd25'
requests='2' wait='60'/>
2013-01-09 11:22:43+0530 [-] 127.0.0.1 - - [09/Jan/2013:05:52:42 +0000] "POST /h
ttp-bind HTTP/1.1" 200 235 "http://localhost/app/" "Mozilla/5.0 (Windows N
T 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0"
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] HEADERS 1357710763.37:
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] <twisted.web.http_headers._Di
ctHeaders object at 0x02EED990>
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] HTTPB POST :
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] <body rid='3902853889' xmlns=
'http://jabber.org/protocol/httpbind' sid='7460877cc608b8f46282116a86daefb19b05d
d25'/>
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] 3902853889