[Twisted-Python] no 'headers' in server.Request instance problem
Jon Dyte
jon at totient.demon.co.uk
Wed Jun 12 16:54:42 EDT 2002
with mozilla build
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020206,build 2002020615
sending a request to a quixote/twisted server (actually a modified
Andrew Kuchling Example), I get the following error
Installing SelectReactor, since unspecified.
__main__.QuixoteFactory starting on 8098
Traceback (most recent call last):
File "/sw/release/python/lib/python2.2/site-packages/twisted/internet/default.py", line 347, in doSelect
why = getattr(selectable, method)()
File "/sw/release/python/lib/python2.2/site-packages/twisted/internet/tcp.py", line 93, in doRead
return self.protocol.dataReceived(data)
File "/sw/release/python/lib/python2.2/site-packages/twisted/protocols/basic.py", line 161, in dataReceived
self.lineReceived(line)
File "/sw/release/python/lib/python2.2/site-packages/twisted/protocols/http.py", line 684, in lineReceived
self.allHeadersReceived()
File "/sw/release/python/lib/python2.2/site-packages/twisted/protocols/http.py", line 733, in allHeadersReceived
self.persistent = self.checkPersistence(req, self.__version)
File "/sw/release/python/lib/python2.2/site-packages/twisted/protocols/http.py", line 759, in checkPersistence
request.setHeader('connection', 'close')
File "/sw/release/python/lib/python2.2/site-packages/twisted/protocols/http.py", line 561, in setHeader
self.headers[string.lower(k)] = v
exceptions.AttributeError: QuixoteTWRequest instance has no attribute
'headers'
The object QuixoteTWRequest is defined
class QuixoteTWRequest (server.Request):
......
it looks to me like on some execution path thru http.py (dataReceived,
lineReceived) etc etc the headers slot of the server.Request object
doesnt get set. which would appear to mean requestReceived has not
been called as this sets self.headers to an empty dict at least.
The headers sent by the browser are :-
Host: localhost:9999
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020206
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: en-us
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Connection: close
localhost.localdomain - - [12/Jun/2002 21:40:50] "GET / HTTP/1.1" 200 -
I'm pretty new to Twisted, so I might be missing something here, but
the script works with lynx and netscape 4.76.
Jon
More information about the Twisted-Python
mailing list