Creating a hybrid server in Twisted

Jashank Jeremy <[email protected]>
Newsgroups gmane.comp.python.twisted.web,gmane.comp.python.twisted
Message-ID <[email protected]>
--text follows this line--

Hi,

I'm trying to write a hybrid server that serves either HTTP or my own
custom protocol depending on how it's addressed (distantly inspired by
the IRC bouncer ZNC).  If it receives a standard GET, POST, HEAD,
etc. it sends HTTP traffic, or if it receives the bareword `CORDELIA',
it switches to Cordelia mode.

HTTP works fine with Twisted.Web.  I can serve pages over HTTP (which is
my desired outcome).  However, I'm not sure how to write the Cordelia
handling code.  I've tried my own custom `render_CORDELIA' function, but
it acts too much like HTTP (ie. it returns a result and terminates the
connection), which is not what I want, as the protocol I've designed
involves establishing a two-way conversation, not a single request and
response pair.

So I'm pretty much stuck in a rut.  I don't want to totally reinvent the
wheel just to be able to protocol-switch; I'd prefer to make use of
existing code from Twisted.  How do I hijack Twisted.Web to add protocol
switching?

Jashank

-- 
Jashank Jeremy
PGP: 0x25A5C309

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
signature.asc (application/pgp-signature, 196 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)

iEYEARECAAYFAk2ZjzQACgkQrMXkZyWlwwlzCgCffS3+l5psz5hG5Cy634EQJjay
Q2UAn2wUqZ8d9eNinLwr9MwWEoSh5h1c
=W1Jm
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.