Send the correct Content-Type header for conditional requests

[email protected] Mon, 07 Dec 2009 17:32:45 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from garetjax <None>:

The `twisted.static.File.render` method correctly returns a `NOT_MODIFIED` response for conditional `If-Modified-Since` requests but does not set the correct `Content-Type` header (leaving the default `text/html`).

As the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.3 section 13.5.3 of the HTML 1.1 spec] says, any headers sent as a response to a conditional request should replace the cached ones, this means that a response to a conditional request will always change the `Content-Type` of the cached resource to `text/html`.

The incriminated code chunk is here:[[BR]]
http://twistedmatrix.com/trac/browser/tags/releases/twisted-9.0.0/twisted/web/static.py#L620



----------
Type     : defect
Component: web
Keywords : web request conditional content-type
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4156