Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1482

Show
Ignore:
Timestamp:
12/09/06 12:40:58
Author:
fumanchu
Message:

2.x Fix for #508 (Content-Type for 304s).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-2.x/cherrypy/_cperror.py

    r1210 r1482  
    103103        response = cherrypy.response 
    104104        response.status = status = self.status 
    105         response.headers['Content-Type'] = "text/html" 
    106105         
    107106        if status in (300, 301, 302, 303, 307): 
     107            response.headers['Content-Type'] = "text/html" 
     108             
    108109            # "The ... URI SHOULD be given by the Location field 
    109110            # in the response." 
  • branches/cherrypy-2.x/cherrypy/filters/cachefilter.py

    r906 r1482  
    117117            # found a hit! check the if-modified-since request header 
    118118            expirationTime, lastModified, obj = cacheData 
     119            s, h, b = obj 
    119120            modifiedSince = cherrypy.request.headers.get('If-Modified-Since', None) 
    120121            if modifiedSince is not None and modifiedSince == lastModified: 
    121122                cherrypy._cache.totNonModified += 1 
    122123                cherrypy.response.status = "304 Not Modified" 
     124                ct = h.get("Content-Type") 
     125                if ct: 
     126                    cherrypy.response.header_list["Content-Type"] = ct 
    123127                cherrypy.response.body = None 
    124128            else: 
    125129                # serve it & get out from the request 
    126                 cherrypy.response.status, cherrypy.response.header_list, body = obj 
     130                cherrypy.response.status, cherrypy.response.header_list, body = s, h, b 
    127131                cherrypy.response.body = body 
    128132            raise cherrypy.RequestHandled() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets