twonds / punjab Goto Github PK
View Code? Open in Web Editor NEWBOSH connection manager
License: MIT License
BOSH connection manager
License: MIT License
GENERAL INFORMATION PunJab is a HTTP jabber client interface. It is a BOSH connection manager that allows persistent client connections to a XMPP server. INSTALL See INSTALL.txt for setup and installation instructions. CONTRIBUTORS https://github.com/twonds/punjab/graphs/contributors COPYRIGHT AND WARRANTY Copyright (C) 2001-2019 Christopher Zorn , [email protected] The code in this distribution is made available under the MIT License. See LICENSE.txt for more details.
I see in the options I can set hostname and port. But what about path? Can I set that? If not, what is the value of path?
Hello!
I'm interested in using punjab to connect my javascript application to xmpp services, and I'm hoping to use punjab for this.
The issue I'm running into is that my javascript application is not allowed to connect to the punjab server, because it's not emitting the appropriate CORS headers.
Are you guys planning on adding a way to configure this or add a good default set of options? It would be tremendously helpful =)
I have Python 2.6 and Twisted 11 installed on CentOS5. It stats just fine, but whenever I attempt to hit the the proxy (apache) "/http-bind/" it gives me an error. Is this known? Are there issues with running this on CentOS5?
/usr/lib/python2.6/site-packages/twisted/web/server.py, line 160 in process
158 try:
159 resrc = self.site.getResourceFor(self)
160 self.render(resrc)
161 except:
Self
site
twisted.web.server.Site instance @ 0x89ef78c
<twisted.web.server.Site instance at 0x89ef78c>
Locals
resrc
punjab.httpb.Httpb instance @ 0x89ef74c
<punjab.httpb.Httpb instance at 0x89ef74c>
self
twisted.web.server.Request instance @ 0x8b0e12c
<POST /http-bind/ HTTP/1.1>
/usr/lib/python2.6/site-packages/twisted/web/server.py, line 167 in render
165 def render(self, resrc):
166 try:
167 body = resrc.render(self)
168 except UnsupportedMethod, e:
Locals
resrc
punjab.httpb.Httpb instance @ 0x89ef74c
<punjab.httpb.Httpb instance at 0x89ef74c>
self
twisted.web.server.Request instance @ 0x8b0e12c
<POST /http-bind/ HTTP/1.1>
Globals
UnsupportedMethod <class 'twisted.web.server.UnsupportedMethod'>
/usr/lib/python2.6/site-packages/twisted/web/resource.py, line 189 in render
187 from twisted.web.server import UnsupportedMethod
188 raise UnsupportedMethod(getattr(self, 'allowedMethods', ()))
189 return m(request)
190
Locals
m <bound method Httpb.render_POST of <punjab.httpb.Httpb instance at 0x89ef74c>>
self
punjab.httpb.Httpb instance @ 0x89ef74c
<punjab.httpb.Httpb instance at 0x89ef74c>
request
twisted.web.server.Request instance @ 0x8b0e12c
<POST /http-bind/ HTTP/1.1>
/usr/lib/python2.6/site-packages/punjab/httpb.py, line 412 in render_POST
410 else:
411 # start session
412 s, d = self.service.startSession(body_tag, xmpp_elements)
413 d.addCallback(self.return_session, s, request)
Self
service
punjab.httpb.HttpbService instance @ 0x89ef6ac
<punjab.httpb.HttpbService instance at 0x89ef6ac>
Locals
self
punjab.httpb.Httpb instance @ 0x89ef74c
<punjab.httpb.Httpb instance at 0x89ef74c>
request
twisted.web.server.Request instance @ 0x8b0e12c
<POST /http-bind/ HTTP/1.1>
body_tag <twisted.words.xish.domish.Element object at 0x8b0e42c>
xmpp_elements List instance @ 0x89d9eec
/usr/lib/python2.6/site-packages/punjab/httpb.py, line 670 in startSession
668 if not body.hasAttribute('inactivity'):
669 body['inactivity'] = 60
670 return self.make_session(self, body.attributes)
671
Self
make_session function make_session in file /usr/lib/python2.6/site-packages/punjab/session.py at line 59
Locals
body <twisted.words.xish.domish.Element object at 0x8b0e42c>
self
punjab.httpb.HttpbService instance @ 0x89ef6ac
<punjab.httpb.HttpbService instance at 0x89ef6ac>
Globals
make_session function make_session in file /usr/lib/python2.6/site-packages/punjab/session.py at line 59
Hello,
I'm a web developer, and I my company wants me to develop a chat client. since they have google accounts (like [email protected]), 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
Hello,
Are you planning to do tags and pypi releases? I'm using Punjab and installing it from github isnt't that good.
I would appreciate very much if you could do that!
If you like to I could be the package manager for pypi releases. In that case just notify me when you get a new tag.
Thank you very much!
Cheers!
That command line option is missing a description in --help
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] =============================
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
Under reasonable load (120 connections or so) I see punjab start block new incoming http connections, holding them for a period of time before accepting. (Presumably until a resource is freed.)
Is this expected behaviour? Is there a resource setting that I should be providing to punjab (or twisted) to increase whatever resource it may be blocking on?
Thanks
Neil
Punjab does not appear to support IPv6. I assume this is a limitation of twistd, largely.
i want to configure punjab to ejabbered server.for start punjab server twistd punjab is not working it gives following error
C:\Documents and Settings\admin>twistd.py punjab.tac
Traceback (most recent call last):
File "C:\Python27\Scripts\twistd.py", line 13, in
from twisted.scripts.twistd import run
File "C:\Python27\lib\site-packages\twisted\scripts\twistd.py", line 11, in
from twisted.application import app
File "C:\Python27\lib\site-packages\twisted\application\app.py", line 8, in
from twisted.python import runtime, log, usage, failure, util, logfile
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 17, in
from zope.interface import Interface
ImportError: No module named zope.interface
exceptions.KeyError: 'Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.'
Tell me please this bug is fixed already?
I'm using http://candy-chat.github.com/candy/ with punjab connecting to an OpenFire XMPP server. My client is getting disconnected approx 2 - 10 minutes after signing in, when idle. The following is what I see in my twistd.log:
2013-03-04 16:28:08-0600 [XmlStream,client] connect ERROR: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion: Connection lost.
]
2013-03-04 16:28:08-0600 [XmlStream,client] Punjab Error:
2013-03-04 16:28:08-0600 [XmlStream,client] Traceback (failure with no frames): <class 'punjab.error.Error'>: remote-connection-failed
2013-03-04 16:28:08-0600 [XmlStream,client] None
2013-03-04 16:28:08-0600 [XmlStream,client] None
2013-03-04 16:28:08-0600 [XmlStream,client] HTTPB Error 200
2013-03-04 16:28:08-0600 [XmlStream,client] HTTPB Return Error: 200 ->
2013-03-04 16:28:08-0600 [XmlStream,client] 192.168.116.125 - - [04/Mar/2013:22:28:07 +0000] "POST /http-bind HTTP/1.1" 200 105 "http://domain.com/chat/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.32 (KHTML, like Gecko) Chrome/27.0.1425.0 Safari/537.32"
2013-03-04 16:28:08-0600 [XmlStream,client] expire (edd8dd8b7762f3ac7a3fae3a5faeed890f5e5569)
2013-03-04 16:28:08-0600 [XmlStream,client] 0
2013-03-04 16:28:08-0600 [XmlStream,client] SESSION -> We have expired edd8dd8b7762f3ac7a3fae3a5faeed890f5e5569 4837379716 []
2013-03-04 16:28:08-0600 [XmlStream,client] SID: edd8dd8b7762f3ac7a3fae3a5faeed890f5e5569 => SEND: '/stream:stream'
2013-03-04 16:28:08-0600 [XmlStream,client] Stopping factory <punjab.session.Session object at 0x1a1be10>
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] HEADERS 1362436089.41:
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] {'origin': 'http://domain.com', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': 'domain.com', 'dnt': '1', 'x-forwarded-for': '127.0.0.1', 'host': 'pkc-infxmppbosh01.ak-networks.com:5280', 'accept': '/', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.32 (KHTML, like Gecko) Chrome/27.0.1425.0 Safari/537.32', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://domain.com/chat/', 'cookie': 'Auth=5snj469krongb7vqe84ud68cc2; Default=0a7dgufvlca2rhfsfcpip9eo63; PHPSESSID=03l0nbrvthdcm116bvu4319lf1', 'x-forwarded-server': 'domain.com', 'content-type': 'application/xml'}
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] HTTPB POST :
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125]
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] no sid is found but the body element has a 'sid' attribute
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] HTTPB Error 404
2013-03-04 16:28:09-0600 [HTTPChannel,1465,192.168.116.125] 192.168.116.125 - - [04/Mar/2013:22:28:08 +0000] "POST /http-bind HTTP/1.1" 404 - "http://domain.com/chat/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.32 (KHTML, like Gecko) Chrome/27.0.1425.0 Safari/537.32"
This is related to #37
I read this page: https://pypi.python.org/pypi/stdeb and installed python-stdeb on my machine. Then I clone
d the punjab github repo on my machine, and did the following:
dpkg -L python-stdeb
python setup.py sdist
py2dsc dist/punjab-0.15.tar.gz
and I get this error
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
running the following command in directory: deb_dist/tmp_py2dsc/punjab-0.15
/usr/bin/python setup.py --command-packages stdeb.command sdist_dsc --dist-dir=/home/user/fromGit/punjab/deb_dist --use-premade-distfile=/home/user/fromGit/punjab/dist/punjab-0.15.tar.gz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
running sdist_dsc
running egg_info
writing punjab.egg-info/PKG-INFO
writing top-level names to punjab.egg-info/top_level.txt
writing dependency_links to punjab.egg-info/dependency_links.txt
package init file 'twisted/plugins/__init__.py' not found (or not a regular file)
reading manifest file 'punjab.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'TODO.txt'
warning: no files found matching 'MANIFEST'
warning: no files found matching '*' under directory 'html/js'
warning: no files found matching '*' under directory 'html/css'
warning: no files found matching '*' under directory 'html/images'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '.cvs*' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn*' found anywhere in distribution
writing manifest file 'punjab.egg-info/SOURCES.txt'
CALLING dpkg-source -b punjab-0.15 (in dir /home/user/fromGit/punjab/deb_dist)
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building punjab using existing ./punjab_0.15.orig.tar.gz
dpkg-source: info: local changes detected, the modified files are:
punjab-0.15/punjab.egg-info/SOURCES.txt
dpkg-source: info: you can integrate the local changes with dpkg-source --commit
dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/punjab_0.15-1.diff.JGLEI7
Traceback (most recent call last):
File "setup.py", line 35, in <module>
package_data={'twisted.plugins': ['twisted/plugins/punjab.py']}
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/stdeb/command/sdist_dsc.py", line 139, in run
remove_expanded_source_dir=self.remove_expanded_source_dir,
File "/usr/lib/python2.7/dist-packages/stdeb/util.py", line 1207, in build_dsc
cwd=dist_dir)
File "/usr/lib/python2.7/dist-packages/stdeb/util.py", line 478, in dpkg_source
process_command(args, cwd=cwd)
File "/usr/lib/python2.7/dist-packages/stdeb/util.py", line 142, in process_command
check_call(args, cwd=cwd)
File "/usr/lib/python2.7/dist-packages/stdeb/util.py", line 35, in check_call
raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 2
ERROR running: /usr/bin/python setup.py --command-packages stdeb.command sdist_dsc --dist-dir=/home/user/fromGit/punjab/deb_dist --use-premade-distfile=/home/user/fromGit/punjab/dist/punjab-0.15.tar.gz
ERROR in deb_dist/tmp_py2dsc/punjab-0.15
I don't know what to do after it. What do you suggest?
It is possible to have informations about XEPs (BOSH...) and RFCs support on a page with version (XEP-XXXX v1.2)?
Examples:
Just rolled out an update to our Openfire, twistd, the server OS and SSL. Something started causing Punjab's connection to fail with the following:
============
2016-07-21T00:32:48+0000 [-] HTTPB Error 200
2016-07-21T00:32:48+0000 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2016-07-21T00:32:48+0000 [twisted.python.log#info] "172.16.13.33" - - [21/Jul/2016:00:32:48 +0000] "POST /http-bind// HTTP/1.0" 200 105 "https://mywebsite.mywebsite.info/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
2016-07-21T00:34:19+0000 [-] SESSION -> Terminate
2016-07-21T00:34:19+0000 [-] expire (54de99ac3a3b8db84605e2503841a908916f56b1)
2016-07-21T00:34:19+0000 [-] 0
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] HEADERS 1469061673.66:
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] Headers({'origin': ['https://mywebsite.mywebsite.info'], 'content-length': ['215'], 'accept-language': ['en-US,en;q=0.8,ru;q=0.6'], 'accept-encoding': ['gzip, deflate, br'], 'connection': ['close'], 'accept': ['*/*'], 'user-agent': ['Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'], 'host': ['mywebsite.mywebsite.info'], 'referer': ['https://mywebsite.mywebsite.info/'], 'pragma': ['no-cache'], 'cache-control': ['no-cache'], 'cookie': ['SESSID=dufegu51j5o7gv9lad4t74vi41; lang=en_US; candy-nostatusmessages=1'], 'content-type': ['text/plain;charset=UTF-8']})
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] HTTPB POST :
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] <body rid='752667662' xmlns='http://jabber.org/protocol/httpbind' to='chat.mywebsite.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'/>
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] Session Created : cc208b2119ca9560b96a1a85165ca45d9a8e3797 1469061673.66
2016-07-21T00:41:13+0000 [_GenericHTTPChannelProtocol,1462,172.16.13.33] ================================== 1469061673.66 connect to chat.mywebsite.com:0 ==================================
2016-07-21T00:41:13+0000 [punjab.session.Session#info] Starting factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:13+0000 [Uninitialized] <twisted.internet.tcp.Connector instance at 0x7f754e3a3a28> will retry in 2 seconds
2016-07-21T00:41:13+0000 [punjab.session.Session#info] Stopping factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:16+0000 [punjab.session.Session#info] Starting factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:16+0000 [Uninitialized] <twisted.internet.tcp.Connector instance at 0x7f754e3a3a28> will retry in 6 seconds
2016-07-21T00:41:16+0000 [punjab.session.Session#info] Stopping factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:22+0000 [punjab.session.Session#info] Starting factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:22+0000 [Uninitialized] Abandoning <twisted.internet.tcp.Connector instance at 0x7f754e3a3a28> after 3 retries.
2016-07-21T00:41:22+0000 [punjab.session.Session#info] Stopping factory <punjab.session.Session object at 0x7f754e399390>
2016-07-21T00:41:42+0000 [-] ================================== cc208b2119ca9560b96a1a85165ca45d9a8e3797 1469061702.88 startup timeout ==================================
It looks like a closed port, but not sure where. Openfire is located on localhost, the host name is present in /etc/hosts, and client connections are allowed on the Openfire server.
Could you please point me in the right direction?
I am installing the bosh on CentOS 6.Facing the follwoing error.
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/twisted/application/app.py", line 647, in run
config.parseOptions()
File "/usr/lib/python2.6/site-packages/twisted/application/app.py", line 614, in parseOptions
usage.Options.parseOptions(self, options)
File "/usr/lib/python2.6/site-packages/twisted/python/usage.py", line 261, in parseOptions
for (cmd, short, parser, doc) in self.subCommands:
File "/usr/lib/python2.6/site-packages/twisted/application/app.py", line 631, in subCommands
for plug in sorted(plugins, key=attrgetter('tapname')):
--- ---
File "/usr/lib/python2.6/site-packages/twisted/plugin.py", line 213, in getPlugins
adapted = interface(plugin, None)
File "/usr/lib/python2.6/site-packages/zope/interface/interface.py", line 625, in _call_conform
return conform(self)
File "/usr/lib/python2.6/site-packages/twisted/plugin.py", line 68, in conform
return self.load()
File "/usr/lib/python2.6/site-packages/twisted/plugin.py", line 63, in load
return namedAny(self.dropin.moduleName + '.' + self.name)
File "/usr/lib/python2.6/site-packages/twisted/python/reflect.py", line 517, in namedAny
obj = getattr(obj, n)
exceptions.AttributeError: 'module' object has no attribute 'TwistedTOC'
It must return bad-request instead of internal-server-error on old format route attribute.
Add support for xmpp over websocket
Iโve been studying the Punjab logs further today and found what appears to be the problem.
The acknowledgement that strophe is looking for is actually an XMPP stanza returned from Punjab - . This is required since we are working over the BOSH connection. Punjab sees the messages coming from strophe, as evidenced by them showing up in the logs, and forwards them onto the server. However, SOMETIMES, Punjab fails to send the acknowledgement back to strophe. Thus, strophe resends the stanza. Example from StillNotWorkingFormatted.txt:
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410643.66: Punjab gets a message from the HTTP Bind (this is why we are observing activity in HTTPChannel)
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '/', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/Tempo/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .tempoUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.devorion.gsidev.com', 'content-type': 'application/xml'}
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST : This is the POST message coming from the BOSH connection
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] You can see that it is in an httpbind protocol body
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] 1211827046
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] Here, Punjab strips the httpbind body and sends the root message directly to OpenFire
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => using the direct session connection Punjab has set up for this user (evidenced by the SID).
SEND: "
"
HOWEVER, HERE WE ARE MISSING THE HTTPBIND CONFIRMATION THAT SHOULD BE SENT BACK TO STROPHE, LETTING IT KNOW THAT THE MESSAGE WAS FORWARDED
THUS, STROPHE SENDS THE SAME MESSAGE AGAIN WITH THE SAME RID, THINKING THAT PUNJAB NEVER GOT THE FIRST ONE.
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410708.95: Punjab gets a message from the HTTP Bind (this is strophes second attempt at sending the message)
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '/', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/Tempo/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .tempoUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.devorion.gsidev.com', 'content-type': 'application/xml'}
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => PUNJAB SENDS THIS TO OPENFIRE AS WELL, EVIDENCE THAT PUNJAB FAILS TO DETECT THAT THIS IS A DUPLICATE MESSAGE
SEND: " It seems that Openfire must disregard this, considering that we havenโt seen issues with openfire receiving these messages.
" and havenโt seen duplicate messages through chat or anything.
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] RETURN HTTPB 1340410708.95:
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] PUNJAB SENDS OUT THE HTTPBIND ACKNOWLEDGEMENT, AS IT SHOULD HAVE THE FIRST TIME.
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:18:28 +0000] "POST /bosh HTTP/1.1" 200 51 "http://172.16.160.246/Tempo/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
Since Punjab sees the duplicate request as a new request, it has incremented its internal RID counter for both, meaning we are now off by 1 RID (each message sent from strophe is supposed to increment the RID value by 1). The first few times this happens, the connection remains because Punjab has a tolerance window of about 5. Eventually, we get out of this window, and Punjab closes the connection.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '/', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/Tempo/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .tempoUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.devorion.gsidev.com', 'content-type': 'application/xml'}
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1]
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052 ITS INTERNAL RID COUNTER HAS INCREASED TO 52 WHILE WE ARE AT 48.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404 The tolerance has been exceeded and the connection is closed.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/Tempo/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
I was going to try changing Punjab.tac to use bosh = HttpbService(1, use_raw=True), but this was honestly a shot in the dark. The comment says that Punjab does no XML parsing with this setting, so I thought it might make it more responsive.
I'm trying to setup a webclient at home. The webclient is jwchat, who suggests punjab for the HTTP/XMMP bridge. The error I get is:
2013-04-12 19:28:21+0200 [HTTPChannel,5,127.0.0.1] 127.0.0.1 - - [12/Apr/2013:17:28:21 +0000] "POST /http-bind/ HTTP/1.1" 200 68 "http://grulicueva.homelinux.net/~mdione/jwchat/jwchat.html" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20100101 Firefox/10.0.12 Iceweasel/10.0.12"
2013-04-12 19:28:21+0200 [XmlStream,client] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
return callWithContext({"system": lp}, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
return context.call({ILogContext: newCtx}, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(args,*kw)
--- ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 586, in _doReadOrWrite
why = selectable.doRead()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 199, in doRead
rval = self.protocol.dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 413, in dataReceived
self._flushReceiveBIO()
File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 383, in _flushReceiveBIO
ProtocolWrapper.dataReceived(self, bytes)
File "/usr/lib/python2.7/dist-packages/twisted/protocols/policies.py", line 118, in dataReceived
self.wrappedProtocol.dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/words/xish/xmlstream.py", line 74, in dataReceived
self.rawDataInFn(data)
File "/home/mdione/src/system/punjab/punjab/session.py", line 242, in rawDataIn
if self.pint.v:
exceptions.AttributeError: 'NoneType' object has no attribute 'v'
I'm pretty sure you will need more info, so just let me know what exactly. I checked out the code via git this morning.
Is it possible in punjab to detect that backend xmpp service is down and give some kind of error to the web application ?
It causes a data loss when using web chat with jabberd2 and the sm module of jabberd2 crashes, then the webapp cannot detect that the backend service is down. So end users continue to send messages without knowing that the messages are not being delivered.
However when we test the same scenario with a desktop client like psi, it immediately gives an error that the service is unavailable.
If the functionality is currently not available can anybody give a pointer for implementing it. I'll try to implement it.
It doesn't say anywhere.
For example: how do I choose whether to make it completely open or only serve a particular jabber server?
Hi,
I update my macbook to El Capitan 10.11 and started facing this weird OpenSSL issue.
It was working before on Yosemite 10.5 properly.
When I try and start the punjab connection manager I get the error as shown in the stacktrace below.
Starting punjab connection manager now
Unhandled Error
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/application/app.py", line 617, in run
runApp(config)
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/scripts/twistd.py", line 25, in runApp
_SomeApplicationRunner(config).run()
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/application/app.py", line 348, in run
self.application = self.createOrGetApplication()
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/application/app.py", line 413, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- ---
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/application/app.py", line 424, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/application/service.py", line 411, in loadApplication
passphrase)
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/persisted/sob.py", line 207, in loadValueFromFile
eval(codeObj, d, d)
File "punjab.tac", line 4, in
from twisted.web import server, resource, static
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/web/server.py", line 36, in
from twisted.web import iweb, http, util
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/web/http.py", line 92, in
from twisted.internet import interfaces, reactor, protocol, address
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/reactor.py", line 38, in
from twisted.internet import default
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/default.py", line 56, in
install = _getInstallFunction(platform)
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/default.py", line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/selectreactor.py", line 18, in
from twisted.internet import posixbase
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/posixbase.py", line 18, in
from twisted.internet import error, udp, tcp
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/tcp.py", line 29, in
from twisted.internet._newtls import (
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/internet/_newtls.py", line 21, in
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "/Library/Python/2.7/site-packages/Twisted-15.4.0-py2.7-macosx-10.10-intel.egg/twisted/protocols/tls.py", line 41, in
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "/Users/vaibhavr/environment/pyOpenSSL-0.15.1/OpenSSL/init.py", line 8, in
from OpenSSL import rand, crypto, SSL
File "/Users/vaibhavr/environment/pyOpenSSL-0.15.1/OpenSSL/rand.py", line 11, in
from OpenSSL._util import (
File "/Users/vaibhavr/environment/pyOpenSSL-0.15.1/OpenSSL/_util.py", line 6, in
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/Library/Python/2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 182, in
Binding.init_static_locks()
File "/Library/Python/2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 139, in init_static_locks
cls._ensure_ffi_initialized()
File "/Library/Python/2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 134, in _ensure_ffi_initialized
cls._register_osrandom_engine()
File "/Library/Python/2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 99, in _register_osrandom_engine
_openssl_assert(cls.lib, cls.lib.ERR_peek_error() == 0)
File "/Library/Python/2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 43, in _openssl_assert
errors
cryptography.exceptions.InternalError: Unknown OpenSSL error. Please file an issue at https://github.com/pyca/cryptography/issues with information on how to reproduce this.
Failed to load application: Unknown OpenSSL error. Please file an issue at https://github.com/pyca/cryptography/issues with information on how to reproduce this.
Has somebody else faced this issue?
When disconnecting from a secure connection to Punjab with my Pidgin, I always get this uncaught exception:
2013-08-16 00:59:20+0300 [HTTPChannel (TLSMemoryBIOProtocol),1,172.16.160.1] 172.16.160.1 - - [15/Aug/2013:21:59:20 +0000] "POST /http-bind HTTP/1.1" 200 68 "-" "Pidgin 2.10.7 (libpurple 2.10.7)"
2013-08-16 00:59:20+0300 [XmlStream,client] connect ERROR: [Failure instance: Traceback: <class 'OpenSSL.SSL.Error'>: [('SSL routines', 'SSL3_GET_RECORD', 'wrong version number')]
/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py:215:doRead
/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py:221:_dataReceived
/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py:419:dataReceived
--- <exception caught here> ---
/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py:358:_flushReceiveBIO
]
2013-08-16 00:59:20+0300 [XmlStream,client] Stopping factory <punjab.session.Session object at 0x328f8d0>
Hi,
I am running facebook chat chrome extension, and I am having several connection issues after upgrading strophe, (with version 1.1.1 everything is working fine)
The server configuration:
1 X nginx+twisted+panjub
nginx is configured to proxy pass 80 to 5280, with /xmpp-httpbind (returns XEP-0124 - BOSH)
** The reason I want to upgrade strophe is because I created bosh client(I want to save all the user credentials on the server for security reason) to set the session and pass it back to the client to attach. And I couldn't make the attach work with strophe version 1.1.1 . With version 1.1.3 I can make the attach work but, I have different errors that I get after 4-6 interactions with the server, errors 400, 404 (also after making the wait to 300 on both sides), I didn't try to debug it so match, but, the first thing I saw (on fiddler) is the the content-length is growing fast on each request, the first request length was 51~ and the third was 1980~, and after that it's got stacked like time out issue, and then I got the 404 / 400 error code, and strophe started the onDisconnect workflow.
But, my current problem when I am using the Strophe connect with all the credentials on the client is:
post:
<body rid='2642193213' xmlns='http://jabber.org/protocol/httpbind' to='website' 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'/>
response:
<body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
** I saw the issue:
#49
And his solution is not working for me.
This is the error log I am getting:
2014-04-25 08:02:23+0000 [XmlStream,client] <body xmlns='http://jabber.org/protocol/httpbind'><failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure></body>
2014-04-25 08:02:23+0000 [XmlStream,client] 4036512817
2014-04-25 08:02:23+0000 [XmlStream,client] 84.111.129.229 - - [25/Apr/2014:08:02:23 +0000] "POST /xmpp-httpbind HTTP/1.1" 200 134 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 U/1.6.3240.39 Safari/537.36"
2014-04-25 08:02:23+0000 [XmlStream,client] connect ERROR: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
]
2014-04-25 08:02:23+0000 [XmlStream,client] Stopping factory <punjab.session.Session object at 0x7f8134912610>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HEADERS 1398412943.89:
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] <twisted.web.http_headers._DictHeaders object at 0x7f8134912ed0>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB POST :
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] <body rid='4036512818' xmlns='http://jabber.org/protocol/httpbind' sid='869337c444e4f9e1729589b445b62268e3aca91e' type='terminate'/>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 4036512818
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] SESSION -> Terminate
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] expire (869337c444e4f9e1729589b445b62268e3aca91e)
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 1
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] SID: 869337c444e4f9e1729589b445b62268e3aca91e => SEND: '</stream:stream>'
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB Error 200
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 84.111.129.229 - - [25/Apr/2014:08:02:23 +0000] "POST /xmpp-httpbind HTTP/1.1" 200 105 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 U/1.6.3240.39 Safari/537.36"
2014-04-25 08:04:06+0000 [XmlStream,client] SID: 3166094157ff8f45a7ecb6d3f69a637c6d8a6f4b => RECV: '<'
2014-04-25 08:04:06+0000 [XmlStream,client] SID: 3166094157ff8f45a7ecb6d3f69a637c6d8a6f4b => RECV: "presence from='[email protected]' to='[email protected]/2isc6xvg' type='unavailable'/>"
2014-04-25 08:04:06+0000 [XmlStream,client]
The error 200 is strange.
The things I tried:
Any help..
Thanks..
The fix for Twisted ticket #2618 changed the way the STREAM_END_EVENT callback is called. It now receives a failure object with the reason for the stream ending and no longer receives the stream itself. Kind of annoying that it acts differently than all the other stream events...
The function affected is here: https://github.com/twonds/punjab/blob/master/punjab/session.py#L534
Recent Twisted deprecated unicode string support in the DNS handling, and broke wokkel and punjab.
Adding bytes(domain)
instead of domain
when calling SRVConnector's constructor seems to fix this.
hi
is it possible to avoid using rid sequence?
Users being disconnected for "Reason unknown":
2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] HTTPB POST :
2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] <body rid='2926047266' xmlns='http://jabber.org/protocol/httpbind' sid='e167924e5bada7983f4e8c4ac9b03ad64dd02e37
2014-02-14 08:38:22+0000 [HTTPChannel,4684,127.0.0.1] 2926047266
2014-02-14 08:39:21+0000 [-]
RETURN HTTPB 1392367161.06:
2014-02-14 08:39:21+0000 [-] <body xmlns='http://jabber.org/protocol/httpbind'/>
2014-02-14 08:39:21+0000 [-] 2926047266
2014-02-14 08:39:21+0000 [-] Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/punjab/session.py", line 109, in doCallback
self.deferred.callback(data)
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 280, in callback
self._startRunCallbacks(result)
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 354, in _startRunCallbacks
self._runCallbacks()
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 371, in _runCallbacks
self.result = callback(self.result, *args, **kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.6/dist-packages/punjab/httpb.py", line 494, in return_error
self.send_http_error(error.conditions[str(e.value)]['code'],
exceptions.KeyError: 'Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.'
2014-02-14 08:40:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: ' '
2014-02-14 08:41:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: ' '
2014-02-14 08:41:13+0000 [-] SESSION -> Terminate
2014-02-14 08:41:13+0000 [-] expire (e167924e5bada7983f4e8c4ac9b03ad64dd02e37)
2014-02-14 08:41:13+0000 [-] 0
2014-02-14 08:41:13+0000 [-] SID: e167924e5bada7983f4e8c4ac9b03ad64dd02e37 => SEND: '</stream:stream>'
2014-02-14 08:41:13+0000 [XmlStream,client] connect ERROR: Reason unknown
Hello,
First, thank's for reading my message - I'm working with Punjab for several weeks and I found it very helpful.
I am working on a webchat based on Jabber and I use Openfire and Punjab (StropheJS for the HTTP).
I had no problem on my mac, that was my openfire server and apache server for my webchat. With the Apache Proxy module, both with OpenFire HTTP Bind (7070 port) or with Punjab.
But now I would like to install my openfire server on a different computer, a CentOS server based on my network.
The server starts correctly and has exactly the same configuration as the openfire server on my mac.
The problem is that when I connect with my script and Punjab, the response is not complete and the script stops after few requests.
On my Mac, I sent :
<body rid='12280337' xmlns='http://jabber.org/protocol/httpbind' to='192.168.3.19' 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.168.3.19:5222'/>
And received :
<body xmlns='http://jabber.org/protocol/httpbind' inactivity='60' secure='true' authid='fa9f1480' content='text/xml; charset=utf-8' window='3' polling='15' sid='0243dfbe037378336c987619e1d780c1314f7e2d' requests='2' wait='60'><stream:features xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features></body>
(notice that I added an attribute "route").
The response I received after about 100ms. And the connection works great after that.
On the CentOS server, I sent :
<body rid='3437025422' xmlns='http://jabber.org/protocol/httpbind' to='192.168.3.164' 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.168.3.164:5222'/>
And the response is :
<body xmlns='http://jabber.org/protocol/httpbind' inactivity='60' secure='true' authid='5d33a1d9' content='text/xml; charset=utf-8' window='3' polling='15' sid='9b41950633542eff7e22eb8b02c025ff882476a6' requests='2' wait='60'/>
And after that, I have maybe 2 or 3 queries made, including pings, and the connections stops with this response :
<body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
Does anybody have any idea?
Thank you very much for your answers !
Hi @twonds
I'm running punjab as so: ./bin/twistd -n punjab --port=33773 --ssl=true --ssl_privkey=/etc/ssl/private/xxx.key --ssl_cert=/etc/ssl/certs/xxx.pem
Here's the log output:
2016-05-17 08:57:43+0200 [-] Log opened.
2016-05-17 08:57:43+0200 [-] twistd 16.1.1 (/home/punjab/punjab.buildout/bin/python 2.7.11) starting up.
2016-05-17 08:57:43+0200 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2016-05-17 08:57:43+0200 [-] Site (TLS) starting on 33773
2016-05-17 08:57:43+0200 [-] Starting factory <twisted.web.server.Site instance at 0x7fd79fe2c710>
I then try to load http-bind
in a browser:
elinks https://localhost:33773/http-bind
And only get the message Making connection
With journalctl -f
I see the following log message:
May 17 08:57:46 xxx kernel: TCP: request_sock_TCP: Possible SYN flooding on port 33773. Dropping request. Check SNMP counters.
Now the funny/strange thing, when I start punjab in verbose mode with -v
, then suddenly I can make HTTPS connections and I don't get SYN flooding errors.
Do you have any idea what might be going on here? I'm thinking that perhaps SSL is not enabled when verbose mode is on?
I tried this on two different Hetzner VServers, and get the same result on both. On a root server from a different provider I am able to start Punjab with SSL (without -v
) and there everything works fine, so I'm wondering whether it's a VServer issue.
Any help greatly appreciated.
On connection to a MUC room, a part of the messages get transmitted, there's a wait, and then the rest get sent too. Is this hiccup punjab related?
Also, the console i run it from (windows) shows everything punjab does, how can i disable that and will it make it faster if i disable it? It's like it's verbose by default, "-v" would only enable what i want to disable.
Sorry for asking here but there's very little documentation on the web for this project.
I'm running punjab in ssl mode using following command :
twistd -r epoll -l /var/log/punjab.log punjab -v --ssl= --ssl_cert=/root/punjab_cacert.pem --ssl_privkey=/root/punjab_privkey.pem
It starts properly, but in log there is no indication that it has started in ssl mode. It is listening on 5280 port.
When I try to connect to punjab using openssl, it hangs (i.e openssl hangs without any output)
openssl s_client -connect 127.0.0.1:5280
Is there any mistake in my command above ?
The certificates are self signed certificates.
I'm using ejjaberd as jabber server or openfire, the problem appears in both.
Python 2.7.2
Twisted 11.0.0 for Python 2.7
pyOpenSSL 0.12
zope.interface 3.7.0
and the last version of punjab.
I'm installing all from msi installer, except zope and punjab, can execute punjab, but when a sample that is included strophe library, basic.html, connect to punjab, this error occurs:
2011-09-02 09:46:48-0300 [HTTPChannel,0,10.1.1.36] 10.1.1.36 - - [02/Sep/2011:12:46:48 +0000] "POST /http-bind HTTP/1.1" 500 14499 "http://parati/strophe/examples/basic.html" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
2011-09-02 09:47:52-0300 [HTTPChannel,1,10.1.1.36] Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1349, in dataReceived
finishCallback(data[contentLength:])
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1563, in _finishRequestBody
self.allContentReceived()
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1619, in allContentReceived
req.requestReceived(command, path, version)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 773, in requestReceived
self.process()
--- ---
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 127, in process
self.render(resrc)
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 147, in render
body = resrc.render(self)
File "C:\Python27\lib\site-packages\twisted\web\resource.py", line 216, in render
return m(request)
File "C:\Python27\lib\site-packages\punjab\httpb.py", line 412, in render_POST
s, d = self.service.startSession(body_tag, xmpp_elements)
File "C:\Python27\lib\site-packages\punjab\httpb.py", line 670, in startSession
return self.make_session(self, body.attributes)
File "C:\Python27\lib\site-packages\punjab\session.py", line 70, in make_session
connect_srv = self.connect_srv
exceptions.NameError: global name 'self' is not defined
Please, I need urgent help!
Thank you for your attention
Punjab doesn't handle old-style SSL anymore, and they're still many server that use that
I am trying to connect to my jabberd2 server (nginx bosh) and I am getting the following:
2014-08-08 10:28:44+0000 [XmlStream,client] SID: 4f05cbb1c15353349ccf8ebbc6a00c6259221c37 => SEND: "<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='jabberpl.org' version='1.0'>"
2014-08-08 10:28:44+0000 [XmlStream,client] connect ERROR: [Failure instance: Traceback: <class 'OpenSSL.SSL.Error'>: [('SSL routines', 'SSL3_GET_RECORD', 'wrong version number')]
/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py:215:doRead
/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py:221:_dataReceived
/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py:412:dataReceived
--- <exception caught here> ---
/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py:519:_write
/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py:950:send
/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py:871:_raise_ssl_error
/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py:22:exception_from_error_queue
]
2014-08-08 10:28:44+0000 [XmlStream,client] HTTPB Error 200
2014-08-08 10:28:44+0000 [XmlStream,client] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
Other clients have no problems to connect.
Problems appear when I try to run bosh with converse.js but also with Pigdin.
Come to think of it, why is there no Ubuntu package for punjab? Not even on launchpad.net
Hello,
I'm doing a benchmark test of openfire+bosh. I'm comparing punjab vs openfire built-in connection manager. Following is my test setup :
Server : VirtualBox VM running RHEL 6.0 with 2 cpu + 2 gb ram.
Client : VirtualBox VM running CentOS 6.0
Hardware : Desktop Intel 64 bit - i3, 16gb ram ( client and server are run on different physical servers)
Test tool : tsung
Total number of users : 10000
Testing for users : 300
Number of contacts in each user's roster : 1000
Testing process : 300 users login via bosh at a rate of 120/second. Then they come online - i.e presence. For presence there is no rate defined.
The test results are quite unexpected.
Openfire builtin connection manager : About 250 users manage to login and come online.
Punjab (using use_raw) : About 200 users manage to login.
Actually we were expecting that punjab will give us much better performance than Openfire built in connection manager.
Is the above test showing correct result - or am I missing something ?
Is there any performance tuning other than use_raw for punjab?
Thanks in advance,
Amol
I'd like it when my users close their Strophe-running browser for them to be disconnected after 5 seconds of not-returning to the BOSH server. Is that possible to configure now?
I need it to properly implement chat on my site (it's not good in this case if a user appears online 30 seconds after he closed the browser)
I am having issues connecting to my Openfire via Candy Chat + Punjab.
-The http-bind url is fine (returns XEP-0124 - BOSH )
-When proxypass is set to Openfire's http-bind (7070), chat logs in fine (so Openfire is not an issue).
That's what I see in the browser:
Response Headers
Access-Control-Allow-Head... Content-Type
Access-Control-Allow-Orig... *
Connection Keep-Alive
Content-Encoding gzip
Content-Length 107
Content-Type text/xml
Date Thu, 13 Feb 2014 04:36:42 GMT
Keep-Alive timeout=5, max=120
Server TwistedWeb/13.0.0
Vary Accept-Encoding
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length 207
Content-Type text/plain; charset=UTF-8
Cookie SESSID=il9pqufgugh99p90jkat9ckkk3
Host callision.info
Referer https://website.info/public/gui/candy-chat/example/
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Post is:
<body rid='2642190037' xmlns='http://jabber.org/protocol/httpbind' to='website' 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'/>
Response:
<body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
Here's the log:
==================================
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] DNSDatagramProtocol starting on 4303
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344910>
2014-02-12 23:31:48-0500 [-] (UDP Port 4303 Closed)
2014-02-12 23:31:48-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344910>
2014-02-12 23:31:48-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2348ef0> will retry in 3 seconds
2014-02-12 23:31:48-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:51-0500 [-] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:51-0500 [-] DNSDatagramProtocol starting on 27535
2014-02-12 23:31:51-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x23449d0>
2014-02-12 23:31:51-0500 [-] (UDP Port 27535 Closed)
2014-02-12 23:31:51-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x23449d0>
2014-02-12 23:31:51-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2348ef0> will retry in 9 seconds
2014-02-12 23:31:51-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:01-0500 [-] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:01-0500 [-] DNSDatagramProtocol starting on 32671
2014-02-12 23:32:01-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344590>
2014-02-12 23:32:01-0500 [-] (UDP Port 32671 Closed)
2014-02-12 23:32:01-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344590>
2014-02-12 23:32:01-0500 [-] Abandoning <punjab.session.XMPPClientConnector instance at 0x2348ef0> after 3 retries.
2014-02-12 23:32:01-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:16-0500 [-] ================================== 955218fa57d30bb0c3287d44d4aa92522178edfd 1392265936.14 startup timeout ==================================
2014-02-12 23:32:16-0500 [-] HTTPB Error 200
2014-02-12 23:32:16-0500 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-02-12 23:32:16-0500 [-] 162.242.220.52 - - [13/Feb/2014:04:32:15 +0000] "POST /http-bind HTTP/1.1" 200 105 "https://website.info/public/gui/candy-chat/example/" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"
2014-02-12 23:33:48-0500 [-] SESSION -> Terminate
2014-02-12 23:33:48-0500 [-] expire (955218fa57d30bb0c3287d44d4aa92522178edfd)
2014-02-12 23:33:48-0500 [-] 0
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] HEADERS 1392266202.22:
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] <twisted.web.http_headers._DictHeaders object at 0x228f690>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] HTTPB POST :
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] <body rid='3499346755' xmlns='http://jabber.org/protocol/httpbind' to='website' 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'/>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Session Created : aae4cf27919de6c4ccbdb52df50925fda1fd79b9 1392266202.22
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] ================================== 1392266202.22 connect to website:5222 ==================================
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] DNSDatagramProtocol starting on 6857
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344a90>
2014-02-12 23:36:42-0500 [-] (UDP Port 6857 Closed)
2014-02-12 23:36:42-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344a90>
2014-02-12 23:36:42-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2349ea8> will retry in 3 seconds
2014-02-12 23:36:42-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:45-0500 [-] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:45-0500 [-] DNSDatagramProtocol starting on 19014
2014-02-12 23:36:45-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344790>
2014-02-12 23:36:45-0500 [-] (UDP Port 19014 Closed)
2014-02-12 23:36:45-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344790>
2014-02-12 23:36:45-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2349ea8> will retry in 9 seconds
2014-02-12 23:36:45-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:54-0500 [-] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:54-0500 [-] DNSDatagramProtocol starting on 19668
2014-02-12 23:36:54-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344310>
2014-02-12 23:36:54-0500 [-] (UDP Port 19668 Closed)
2014-02-12 23:36:54-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344310>
2014-02-12 23:36:54-0500 [-] Abandoning <punjab.session.XMPPClientConnector instance at 0x2349ea8> after 3 retries.
2014-02-12 23:36:54-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:37:10-0500 [-] ================================== aae4cf27919de6c4ccbdb52df50925fda1fd79b9 1392266230.14 startup timeout ==================================
2014-02-12 23:37:10-0500 [-] HTTPB Error 200
2014-02-12 23:37:10-0500 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-02-12 23:37:10-0500 [-] 162.242.220.52 - - [13/Feb/2014:04:37:09 +0000] "POST /http-bind HTTP/1.1" 200 105 "https://website.info/public/gui/candy-chat/example/" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"
2014-02-12 23:38:42-0500 [-] SESSION -> Terminate
2014-02-12 23:38:42-0500 [-] expire (aae4cf27919de6c4ccbdb52df50925fda1fd79b9)
2014-02-12 23:38:42-0500 [-] 0
Please advise.
Thanks!
I noticed that HttpbService has a param -bindAddress- in its init function patched by somebody(Sorry for forgetting his/her name) to fix problem with machine having multiple NICs.
But this patch would cause punjab can't work on OpenShift for OpenShift does allow to bind to a specific IP address and range of port. I think the good default value for this param is None instead of ('0.0.0.0', 0).
And so:
-- def init(self,
verbose = 0, polling = 15,
use_raw = False, bindAddress=("0.0.0.0", 0),
session_creator = None):
++ def init(self,
verbose = 0, polling = 15,
use_raw = False, bindAddress=None,
session_creator = None):
Works on OpenShift.
iJab
I'm try to run de basic strophe example, but is error appears:
2011-09-05 16:02:03-0300 [-] Log opened.
2011-09-05 16:02:03-0300 [-] twistd 11.0.0 (C:\Python27\python.exe 2.7.1) starting up.
2011-09-05 16:02:03-0300 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2011-09-05 16:02:03-0300 [-] twisted.web.server.Site starting on 7070
2011-09-05 16:02:03-0300 [-] Starting factory <twisted.web.server.Site instance at 0x0156E0D0>
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] HEADERS 1315249330.82:
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] {'content-length': '204', 'accept-language': 'pt-br', 'accept-encoding': 'gzip, deflate', 'host': 'parati.carros.local:7070', 'accept': '/', 'user-agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)', 'connection': 'Keep-Alive', 'referer': 'http://parati.carros.local/strophe/examples/basic.html', 'cache-control': 'no-cache'}
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] HTTPB POST :
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36]
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] Session Created : 17a781e9c8b2c02afbafacf201cc3f6cbe0218b6 1315249330.82
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] ================================== 1315249330.82 connect to parati:5222 ==================================
2011-09-05 16:02:10-0300 [HTTPChannel,0,10.1.1.36] Starting factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:10-0300 [-] <class 'twisted.names.dns.DNSDatagramProtocol'> starting on 6751
2011-09-05 16:02:10-0300 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:11-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] <punjab.session.XMPPClientConnector instance at 0x01572648> will retry in 2 seconds
2011-09-05 16:02:11-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:11-0300 [-](Port 6751 Closed)
2011-09-05 16:02:11-0300 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:13-0300 [-] Starting factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:13-0300 [-] <class 'twisted.names.dns.DNSDatagramProtocol'> starting on 44155
2011-09-05 16:02:13-0300 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:13-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] <punjab.session.XMPPClientConnector instance at 0x01572648> will retry in 8 seconds
2011-09-05 16:02:13-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:13-0300 [-](Port 44155 Closed)
2011-09-05 16:02:13-0300 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:22-0300 [-] Starting factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:22-0300 [-] <class 'twisted.names.dns.DNSDatagramProtocol'> starting on 63821
2011-09-05 16:02:22-0300 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:22-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] Abandoning <punjab.session.XMPPClientConnector instance at 0x01572648> after 3 retries.
2011-09-05 16:02:22-0300 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session object at 0x01568AB0>
2011-09-05 16:02:22-0300 [-](Port 63821 Closed)
2011-09-05 16:02:22-0300 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x01577D50>
2011-09-05 16:02:39-0300 [-] ================================== 17a781e9c8b2c02afbafacf201cc3f6cbe0218b6 1315249359.2 startup timeout ==================================
2011-09-05 16:02:39-0300 [-] HTTPB Error 200
2011-09-05 16:02:39-0300 [-] HTTPB Return Error: 200 ->
2011-09-05 16:02:39-0300 [-] 10.1.1.36 - - [05/Sep/2011:19:02:38 +0000] "POST /http-bind/ HTTP/1.1" 200 105 "http://parati.carros.local/strophe/examples/basic.html" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
I'm using ejjaberd as jabber server or openfire, the problem appears in both.
Python 2.7.2
Twisted 11.0.0 for Python 2.7
pyOpenSSL 0.12
zope.interface 3.7.0
Thank you for your attention
The url value in setup.py
is wrong (github.com.com
instead of github.com
):
url='https://github.com.com/twonds/punjab',
$ git branch -r --merged|grep origin|grep -v master
origin/attribute-error-35
origin/bind-36
origin/remove-mktap
origin/ssl-config
origin/ssl-help-40
$
Just that it would make your repo a little bit more interesting for investigation. And of course you can add |xargs -n 1 git branch -r -d
to this pipe to remote all merged branches. I can do it myself too, but unfortunately those removed branches return with every git fetch origin
.
2019-04-12T11:03:03+0200 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x0000025DA3975A90>
2019-04-12T11:03:17+0200 [-] ================================== b770819c2429a07c58bc91fed744995117242ff5 1555059797.832153 startup timeout ==================================
2019-04-12T11:03:17+0200 [-] HTTPB Error 200
2019-04-12T11:03:17+0200 [-] HTTPB Return Error: 200 ->
2019-04-12T11:03:17+0200 [-] Unhandled Error
Traceback (most recent call last):
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\punjab-0.15-py3.7.egg\punjab\session.py", line 118, in doErrback
self.deferred.errback(data)
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\internet\defer.py", line 501, in errback
self._startRunCallbacks(fail)
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\internet\defer.py", line 568, in _startRunCallbacks
self._runCallbacks()
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\internet\defer.py", line 654, in _runCallbacks
current.result = callback(current.result, *args, **kw)
--- ---
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\punjab-0.15-py3.7.egg\punjab\httpb.py", line 494, in return_error
children=echildren)
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\punjab-0.15-py3.7.egg\punjab\httpb.py", line 563, in send_http_error
request.setHeader("content-length", len(bxml))
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\web\http.py", line 1271, in setHeader
self.responseHeaders.setRawHeaders(name, [value])
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\web\http_headers.py", line 220, in setRawHeaders
for v in self._encodeValues(values)]
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\web\http_headers.py", line 220, in
for v in self._encodeValues(values)]
File "c:\users\dirk\appdata\local\programs\python\python37\lib\site-packages\twisted\web\http_headers.py", line 40, in _sanitizeLinearWhitespace
return b' '.join(headerComponent.splitlines())
builtins.AttributeError: 'int' object has no attribute 'splitlines'
2019-04-12T11:04:48+0200 [-] SESSION -> Terminate
Hi,
I noticed that Punjab does not allow RIDs that were not initiated, meaning that if my BOSH client sends a request with a RID which Punjab does not know about, it will end the BOSH session with a terminate (item-not-found).
In some rare cases, it causes disconnection errors (using it into Jappix which binds a lot), and it makes Jappix Mini unusable.
Others BOSH servers are really tolerant with RIDs, and it makes life easier and disconnection issues more rare. The disconnection issues can be explained because of parallel HTTP requests. Sometimes the client sends a bad RID, or one packet with a "future" RID is received by Punjab BEFORE the previous packet.
Thanks to fix it, and again, thanks for your huge work !
C:\Users\harish.kumar>python C:/python/punjab_bosh/setup.py install
running install
running build
running build_py
error: package directory 'punjab' does not exist
getting error
error: package directory 'punjab' does not exist
please help me to setup the things
Thanks in advance
while giving command >twistd punjab
exceptions are raised and following is displayed.
Traceback (most recent call last):
File "/usr/bin/twistd", line 14, in
run()
File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 27, in run
app.run(runApp, ServerOptions)
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 652, in run
runApp(config)
File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 386, in run
self.application = self.createOrGetApplication()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 446, in createOrGetApplication
ser = plg.makeService(self.config.subOptions)
File "/opt/punjab-master/twisted/plugins/punjab_plugin.py", line 46, in makeService
return punjab.makeService(options)
File "/opt/punjab-master/punjab/init.py", line 65, in makeService
import httpb
File "/opt/punjab-master/punjab/httpb.py", line 18, in
from session import make_session
File "/opt/punjab-master/punjab/session.py", line 8, in
from twisted.names.srvconnect import SRVConnector
File "/usr/lib/python2.7/dist-packages/twisted/names/srvconnect.py", line 11, in
from twisted.names import client, dns
File "/usr/lib/python2.7/dist-packages/twisted/names/client.py", line 31, in
from twisted.names import dns, common
File "/usr/lib/python2.7/dist-packages/twisted/names/dns.py", line 62, in
from twisted.python import _utilpy3 as tputil
ImportError: cannot import name _utilpy3
I am using window and I wanted to integrate Punjab with ejabberd server and I followed instruction given in Install.txt of Punjab-master.zip folder but I am not sure whether I am going properly and finally I don`t know how to integrate Punjab with ejabberd server. please help me . Below is step what i followed and what output I received .
step 1. I downloaded python, punjab-master.zip, twisted.mis
step 2. Installed Python, twisted.mis and Extracted punjab-master.zip in a folder
step 3. I executed "python setup.py install" command in cmd then below text appeared
D:\punjab-master>python setup.py install
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\punjab
copying punjab\error.py -> build\lib\punjab
copying punjab\httpb.py -> build\lib\punjab
copying punjab\httpb_client.py -> build\lib\punjab
copying punjab\jabber.py -> build\lib\punjab
copying punjab\patches.py -> build\lib\punjab
copying punjab\session.py -> build\lib\punjab
copying punjab\ssl.py -> build\lib\punjab
copying punjab\stream.py -> build\lib\punjab
copying punjab\__init__.py -> build\lib\punjab
creating build\lib\punjab\xmpp
copying punjab\xmpp\error.py -> build\lib\punjab\xmpp
copying punjab\xmpp\ns.py -> build\lib\punjab\xmpp
copying punjab\xmpp\server.py -> build\lib\punjab\xmpp
copying punjab\xmpp\__init__.py -> build\lib\punjab\xmpp
package init file 'twisted\plugins\__init__.py' not found (or not a regular file)
creating build\lib\twisted
creating build\lib\twisted\plugins
copying twisted\plugins\punjab_plugin.py -> build\lib\twisted\plugins
package init file 'twisted\plugins\__init__.py' not found (or not a regular file)
running install_lib
running install_egg_info
Removing C:\Python27\Lib\site-packages\punjab-0.15-py2.7.egg-info
Writing C:\Python27\Lib\site-packages\punjab-0.15-py2.7.egg-info
step 4. executed "twistd.py punjab" command then below text appeared i think it is giving some error
D:\punjab-master>twistd.py punjab
Traceback (most recent call last):
File "C:\Python27\Scripts\twistd.py", line 13, in <module>
from twisted.scripts.twistd import run
File "C:\Python27\lib\site-packages\twisted\scripts\twistd.py", line 11, in <module>
from twisted.application import app
File "C:\Python27\lib\site-packages\twisted\application\app.py", line 8, in <module>
from twisted.python import runtime, log, usage, failure, util, logfile
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 17, in <module>
from zope.interface import Interface
ImportError: No module named zope.interface
Please help me to integrate Punjab with ejabberd
Hi, i have installed punjab and its running successfully at port 5281 as given below
C:\Program Files\punjab-master>twistd.py -y punjab.tac
2012-12-18 11:13:10+0530 [-] Log opened.
2012-12-18 11:13:10+0530 [-] twistd 12.2.0 (C:\Python27\python.exe 2.7.3) starting up.
2012-12-18 11:13:10+0530 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2012-12-18 11:13:10+0530 [-] Site starting on 5281
2012-12-18 11:13:10+0530 [-] Starting factory <twisted.web.server.Site instance at 0x013B0C88>
but I don`t know how to configure punjab to work with ejabberd xmpp server. My ejabberd server is running on port number 5280.
I have used below given softwares :
apache as web server
candy chat candy as chat client
ejabberd as xmpp server
punjab as bosh connection manager
please help me to integrate punjab with my application .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.