Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Punjab fails on localhost (500 Internal Server Error), using Strophe.js #26

Closed
HyprGeek opened this issue Jan 8, 2013 · 8 comments
Closed

Comments

@HyprGeek
Copy link

HyprGeek commented Jan 8, 2013

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)
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.
ProxyPass /bosh http://bosh.metajack.im:5280/xmpp-httpbind
ProxyPassReverse /bosh http://bosh.metajack.im:5280/xmpp-httpbind

Initialization of punjab:

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 <twisted.web.server.Site instance
at 0x032306C0>

Connecting using strophe:

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] <twisted.web.http_headers._Di
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]
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 <punjab.sess
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

@twonds
Copy link
Owner

twonds commented Jan 9, 2013

What version of python? It may be a recent bug in twisted with python 3.

http://twistedmatrix.com/trac/ticket/6245

@HyprGeek
Copy link
Author

HyprGeek commented Jan 9, 2013

Hi,

I've mentioned it in the previous post,
"Running punjab on Windows 7 64-bit, using python 2.7 64-bit and installed other dependencies (win32 api as well)."

I uninstalled python and related stuff, and reinstalled python 2.7 32-bit and the dependencies (32-bit). Still does not work.

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 in the app.

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]
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: "<stream:stream xmlns='jabber:client' xm
lns:stream='http://etherx.jabber.org/streams' from='jabber.org' id='c5409da5bae0
22ef' version='1.0'>stream:featuresCRAM-MD5
LOGINPLAIND
IGEST-MD5SCRAM-SHA-1zlib
/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 [-]
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]
2013-01-09 11:22:43+0530 [HTTPChannel,0,127.0.0.1] 3902853889

@ralphm
Copy link
Contributor

ralphm commented Jan 9, 2013

The bug mentioned by @twonds is indeed the cause here, as the SRV lookup fails, for Twisted 12.3.0. The fix is now in review, and hopefully we can get a bugfix release 12.3.1 for it.

@HyprGeek
Copy link
Author

Oh, then I'll use an older version of Twisted while the bugfix is underway. Thanks a lot @twonds @ralphm.

@HyprGeek
Copy link
Author

Just wanted to post an update. I used Twisted 12.2.0, and punjab is working fine now.

@ralphm
Copy link
Contributor

ralphm commented Jan 18, 2013

@HyprGeek you might want to check this workaround. Obviously it doesn't work with IDN domain names, but it never did before. As it is really an application issue how to work with IDN domain names, I did resolve that in Wokkel.

@Sunkari16
Copy link

Hi Im seeing a similar issue,
My reuest will be received by punjab, it will get the response stream from openfire , but the same stream is not sent to the client and this doesnt let the user login complete.

Im using punjab with twisted 14.02 version.

Below is the log
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] HEADERS 1415697770.06:
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] <twisted.web.http_headers._DictHeaders object at 0x03297110>
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] HTTPB POST :
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1]
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] Session Created : ab0462834ad5048de65ea01a9d3db1d7c91013df 1415697770.07
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] ================================== 1415697770.07 connect to itw.com:5222 ==================================
2014-11-11 14:52:50+0530 [HTTPChannel,0,127.0.0.1] Starting factory <punjab.session.Session object at 0x03297390>
2014-11-11 14:52:50+0530 [Uninitialized] SID: ab0462834ad5048de65ea01a9d3db1d7c91013df => SEND: "<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='itw.com' version='1.0'>"
2014-11-11 14:52:50+0530 [XmlStream,client] SID: ab0462834ad5048de65ea01a9d3db1d7c91013df => RECV: '<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="itw.com" id="3eed6d65" xml:lang="en" version="1.0">stream:featuresDIGEST-MD5PLAINANONYMOUSCRAM-MD5zlib/stream:features'
2014-11-11 14:52:50+0530 [XmlStream,client] Wait until starttls is completed.
2014-11-11 14:52:50+0530 [XmlStream,client] [<twisted.words.protocols.jabber.xmlstream.TLSInitiatingInitializer object at 0x03297D90>]
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1] HEADERS 1415697772.89:
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1] <twisted.web.http_headers._DictHeaders object at 0x032B17F0>
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1] HTTPB POST :
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1]
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1] Session Created : 90336199acba3c069784aa7a79b53559f9300b5d 1415697772.9
2014-11-11 14:52:52+0530 [HTTPChannel,1,127.0.0.1] ================================== 1415697772.9 connect to itw.com:5222 ==================================

Any help would be of great favour

@twonds
Copy link
Owner

twonds commented Nov 11, 2014

I do not see an error in the log provided. Can you include the error? Also, it looks like this may be a separate issue than the issue here because Punjab is making an attempt to connect. Do you mind creating a new issue or sending an email?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants