[Twisted-Python] twcgi duplicate Content-Type

Hi! I'm using twcgi to serve a Fossil repository through CGI (it's that or xinetd). For some reason, Chrome wasn't rendering the CSS. Looking at the HTTP response headers for the GET request for the CSS file, I saw this: HTTP/1.1 200 OK Date: Sat, 01 Jan 2011 00:14:58 GMT Content-Length: 13484 Expires: Sat, 8 Jan 2011 00:14:58 GMT Content-Type: text/html Content-Type: text/css; charset=utf-8 Server: TwistedWeb/10.2.0 I'm pretty sure duplicate Content-Type headers aren't supposed to happen. After some digging, I'm convinced the Server, Date and the first Content-Type are the default values set in t.w.server [1]. Meanwhile, twcgi [2] users self.request.responseHeaders.addRawHeader, so the default header is never overwritten. I'm pretty sure that's not supposed to happen, but I'm not sure what the correct way to fix this is. Options: 1) Should a list of things that need setRawHeader be introduced? 2) Should setRawHeader be the default, and instead have a list of things that need addRawHeader? 3) Should that twcgi code use request.setHeader instead, like the t.w.server code? I have a feeling it's the last option. but like I said, I'm not sure. [1] http://twistedmatrix.com/trac/browser/tags/releases/twisted-10.2.0/twisted/w... [2] http://twistedmatrix.com/trac/browser/tags/releases/twisted-10.2.0/twisted/w... cheers and happy new year, lvh

Aha! For posterity, this is a known bug: http://twistedmatrix.com/trac/ticket/4742 Fixed in trunk but not yet released. cheers lvh

Apparently I was mistaken. That patch is already in the release I'm running -- this is what *broke* it, apparently. The first ticket fixed a bug, but introduced a new one. I made a ticket: http://twistedmatrix.com/trac/ticket/4786 cheers lvh

Aha! For posterity, this is a known bug: http://twistedmatrix.com/trac/ticket/4742 Fixed in trunk but not yet released. cheers lvh

Apparently I was mistaken. That patch is already in the release I'm running -- this is what *broke* it, apparently. The first ticket fixed a bug, but introduced a new one. I made a ticket: http://twistedmatrix.com/trac/ticket/4786 cheers lvh
participants (1)
-
Laurens Van Houtven