Opened 6 years ago

Closed 6 years ago

#5201 defect closed duplicate (duplicate)

t.web.server.Request should delete Content-Type header when responding with http status code 304.

Reported by: Overmind Jiang Owned by:
Priority: normal Milestone:
Component: web Keywords: twisted.web Content-Type 304
Cc: jknight Branch:
Author:

Description

Each response generated by the t.w.Server will by default have a Content-Type header of 'text/html' as stated in t.w.Request.process (twisted/web/server.py:120).

However, when the server is responding with a http status code of 304, the Content-Type header is not removed (twisted/web/server.py:218) and thus each cached files will have a wrong mimetype.

A quick fix is to add those two lines after :218:

if self.responseHeaders.hasHeader('content-type'):
    self.responseHeaders.removeHeader('content-type')

Change History (2)

comment:1 Changed 6 years ago by DefaultCC Plugin

Cc: jknight added

comment:2 Changed 6 years ago by Jean-Paul Calderone

Branch: trunk
Milestone: Twisted-11.1
Resolution: duplicate
Status: newclosed

Duplicate of #4156

Note: See TracTickets for help on using tickets.