The Twisted tree that you can download and browse following this link is a modified version of the Twisted project that is running on the CPUShare servers.
In the CPUShare-Twisted branch unit-tests are welcome, but they're certainly not mandatory for inclusion of new features and bugfixes. At the moment the tree includes new features and several bugfixes that are missing in the SVN trunk. If you've objectives to reach quickly and you need all bugfixes and features, you may find this project useful to you.
Some of the differences include:- Allows running php (or other .whatever cgi) through static.File (i.e. to run SquirrelMail or phpBB) on top of web2.
- Fix locking bug in wsgi to run run wsgi applications on top of web2 (i.e. to run mercurial or MoinMoin) without hangs.
- Avoid hanging forever if the peer disconnects even when the socket is paused (only available with poll reactor) with the Protocol.pausedConnectionLost() backwards compatible API addition. This is already actively used by the CPUShare server.
- Fix race condition when connectionLost is posted through a timer.
- Stop the *StringReceived buffered higher level protocols while socket is disconnecting.
- Avoid hanging web2 channel-clients forever (or php would hang forever if http disconnects before the script is done). Solved with a notifyDisconnect API to allow a channel-client to declare if it wants its stream to be interrupted if the web-client disconnects before the processing is complete.
- Added GetCookie/SetCookie basic functionality to web2 header class.
- Avoid huge resumeProducing() recursion with large documents.
- SCGI fixes (CPUShare heavily uses SCGI for separation, security and scalability).
The CPUShare version of Twisted will focus on performance and integration with Cheetah, FormEncode (incidentally the two packages used for the html rendering of this website) and other already existing and popular self contained and fast html rendering and storage librarians.
CPUShare-Twisted will try to avoid duplication and it aims to join the python web community for everything that can be shared (like Cheetah, FormEncode, Mochikit, psycopg2). Supporting CPUShare-Twisted as an alternative to the threaded http engine in Turbogears is not a duplicated effort, because of the async model. None of the other python http engines out there is using the async model, and the network capabilities that twisted offers out of the box to the web applications are significant.
Download + Install quickstart:
wget http://www.selenic.com/mercurial/mercurial-snapshot.tar.gz tar xzf mercurial-snapshot.tar.gz cd mercurial-snapshot python setup.py install hg clone https://www.cpushare.com/hg/Twisted /whereveryouwant/Twisted cd /whereveryouwant/Twisted python setup.py install
If you're interested to contribute you're welcome to subscribe to the cpushare-twisted mailing list archived here.
You can submit your Twisted modifications as patches or by exporting your own outgoing mercurial tree. To export your mercurial tree with twisted you can use or modify this script:
# hg export through web2 # Copyright (C) 2006 Andrea Arcangeli# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; only version 2 of the License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from twisted.web2 import server, channel, log, wsgi from mercurial.hgweb.hgwebdir_mod import hgwebdir from mercurial.hgweb.request import wsgiapplication import os #LOGPATH = os.path.expanduser('~hg/hg_logs/http.log') def hgweb_app(): return hgwebdir({ 'Twisted' : '/home/hg/Twisted', 'TwistedSVN' : '/home/hg/TwistedSVN/Twisted', 'FormEncode' : '/home/hg/FormEncode', 'FormEncodeSVN' : '/home/hg/FormEncodeSVN/FormEncode', 'pyOpenSSL' : '/home/hg/pyOpenSSL', }) root = wsgi.WSGIResource(wsgiapplication(hgweb_app)) # the below enables standard http logging #root = log.LogWrapperResource(root) #log.FileAccessLoggingObserver(LOGPATH).start() site = server.Site(root) from twisted.application import service, strports application = service.Application("hg") s = strports.service('tcp:8080', channel.HTTPFactory(site)) # the below is to export through scgi for higher security and separation #s = strports.service('tcp:8827:interface=127.0.0.1', channel.SCGIFactory(site)) s.setServiceParent(application)
An automatically updated readonly TwistedSVN trunk is also exported here.
By subscribing you agree to take full responsibility for all the email messages that you will post to the mailing lists.
CPUShare may stop using Twisted at anytime, so the use of the CPUShare-Twisted branch is at your own risk.
All CPUShare mailing lists and email accounts are filtered with amavisd-new, SpamAssassin and Clam AntiVirus. HTML postings are discouraged, but they're not forbidden.
cpushare.com has no control on the messages that are being posted in real time because the mailing lists are not moderated, but IP addresses, timings and mail hops are being safely logged on the server and they will be published publically in case of spamming or abuse: you're not anonymous when you post to mailing lists at cpushare.com.