[Twisted-Python] twisted.web2's equivalent to setHeader?
It took some searching, but I found something that states directly that Twisted doesn't support pipelining ( http://www.dalkescientific.com/writings/diary/archive/2006/08/28/levels_of_a... ". Twisted doesn't support HTTP/1.1 pipelining and neither does urllib.") I think I read elsewhere that web2 does support pipelining, but I'm not sure if FireFox is using pipelining with twisted.web2; it uses heuristics to determine whether to use pipelining or not (provided you enabled pipelining) based on the server type. Wikipedia says most servers support pipelining so I assume Apache does, so I was thinking I could make web2 pose as an Apache server by doing setHeader("Server", "Apache/2.2.8(Unix)"), but I get this error.. ctx.setHeader("Server", "Apache/2.2.8(Unix)") exceptions.AttributeError: 'Request' object has no attribute 'setHeader' so how do I set a header using web2?
1. You probably want to use twisted-web mailing list for these questions. 2. twisted.web *server* does support pipelining, if I remember correctly. The client doesn't.
On 4/24/08, inhahe
ctx.setHeader("Server", "Apache/2.2.8(Unix)") exceptions.AttributeError: 'Request' object has no attribute 'setHeader'
so how do I set a header using web2?
Try ctx.headers.setHeader(). web2 requests have a headers attribute of this class: http://twistedmatrix.com/documents/2.5.0/api/twisted.web2.http_headers.Heade... Cameron
participants (3)
-
Cameron Dale
-
inhahe
-
Itamar Shtull-Trauring