Twisted HTTP Servers Oh My!

April 23rd, 2007 by Mario Balibrera

So lately I’ve been hearing a lot of hype about Twisted. Twisted is event based. Twisted is fast. Twisted does every single thing in the universe.

I recently started working on a secret Orbited project with a generous helping of Twisted, which practically wrote the bulk of it for me.

This time yesterday, I sat here with a (rather skeletal) backend that seemed to do what it was told. This was encouraging, but I knew that it was all pointless without a web interface. I mean, web integration is the whole point of Orbited.

The problem at this point was a little strange: there were multiple Twisted HTTP libraries, they were too comprehensive, too featured, too big, and I was too tired to figure it out. Maybe I was burned out on the Twisted API, perhaps I was even a little crazy at this point, but I didn’t want anything to do with IResource and leaf nodes, and I decided that it would be easier to just write my own HTTP server.

This, of course, isn’t to say Twisted abandoned me in my hour of need. I mean, really, most of http.py IS Twisted (including Twisted’s famous Protocol and ServerFactory). But it’s exactly what I needed, something simple: the status line, the headers, the form, and a way to write your response. All it does is call your App().dispatch(request) function and provide headers and a response object.

More on the secret Orbited project coming soon…

One Response to “Twisted HTTP Servers Oh My!”

  1. Orbited Blog » Blog Archive » MUD (!) Says:

    [...] http.py [...]

Leave a Reply