makeProducer calls _setContentHeaders, which sets Content-Type. This is conveniently skipped when returning a 304.
But RFC2616 says:
If a cache uses a received 304 response to update a cache entry, the
cache MUST update the entry to reflect any new field values given in
the response.
So twisted.web should really always be returning the correctly Content-Type.
From twisted. web.static. File.render_ GET:
if request. setLastModified (self.getmtime( )) is http.CACHED:
return ''
producer = self.makeProduc er(request, fileForReading)
makeProducer calls _setContentHeaders, which sets Content-Type. This is conveniently skipped when returning a 304.
But RFC2616 says:
If a cache uses a received 304 response to update a cache entry, the
cache MUST update the entry to reflect any new field values given in
the response.
So twisted.web should really always be returning the correctly Content-Type.