[Twisted-Python] Newbie to Twisted: Bug in http.py?

Wari Wahab wari at home.wari.org
Thu May 8 02:48:44 EDT 2003

I was playing around with twisted.web today (1.0.4), and tried to make a 
manual HTTP connection using telnet. Naturally I forgot to type in the 
"HOST: hostname" during the request, and got a nice traceback from it. 
Here are the details:

./pyblosxom.py, line 50 in render
50    serverName = string.split(request.getRequestHostname(), ':')[0]
/usr/lib/python2.2/site-packages/twisted/protocols/http.py, line 756 in 
756    return (self.getHeader('host') or 
exceptions.AttributeError: 'tuple' object has no attribute 'split'

Is this a bug or I really have to use the HOST header (HTTP/1.0 does not 
have the HOST header, or is not necessary, I think). Looking at http.py, 
self.getHost() is just returning self.host, and self.host can either be:
self.host = (method, host, port)
self.host = self.channel.transport.getHost()

I'm pretty much a newbie in twisted (just toyed around with it since 
yesterday) and I was trying to make pyblosxom to be a twisted web server 
(don't you like how that sounds). I almost got it to work the way I want 
except that I cannot get the standard python cgi module to work (to get 
requests like ?foo=bar).

Forgive me if this is not a bug though :)

More information about the Twisted-Python mailing list